1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* ------------------------------------------------------------------------ * 3 * i2c-parport.h I2C bus over parallel port * 4 * ------------------------------------------------------------------------ * 5 Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de> 6 7 * ------------------------------------------------------------------------ */ 8 9 #define PORT_DATA 0 10 #define PORT_STAT 1 11 #define PORT_CTRL 2 12 13 struct lineop { 14 u8 val; 15 u8 port; 16 u8 inverted; 17 }; 18 19 struct adapter_parm { 20 struct lineop setsda; 21 struct lineop setscl; 22 struct lineop getsda; 23 struct lineop getscl; 24 struct lineop init; 25 unsigned int smbus_alert:1; 26 }; 27 28 static const struct adapter_parm adapter_parm[] = { 29 /* type 0: Philips adapter */ 30 { 31 .setsda = { 0x80, PORT_DATA, 1 }, 32 .setscl = { 0x08, PORT_CTRL, 0 }, 33 .getsda = { 0x80, PORT_STAT, 0 }, 34 .getscl = { 0x08, PORT_STAT, 0 }, 35 }, 36 /* type 1: home brew teletext adapter */ 37 { 38 .setsda = { 0x02, PORT_DATA, 0 }, 39 .setscl = { 0x01, PORT_DATA, 0 }, 40 .getsda = { 0x80, PORT_STAT, 1 }, 41 }, 42 /* type 2: Velleman K8000 adapter */ 43 { 44 .setsda = { 0x02, PORT_CTRL, 1 }, 45 .setscl = { 0x08, PORT_CTRL, 1 }, 46 .getsda = { 0x10, PORT_STAT, 0 }, 47 }, 48 /* type 3: ELV adapter */ 49 { 50 .setsda = { 0x02, PORT_DATA, 1 }, 51 .setscl = { 0x01, PORT_DATA, 1 }, 52 .getsda = { 0x40, PORT_STAT, 1 }, 53 .getscl = { 0x08, PORT_STAT, 1 }, 54 }, 55 /* type 4: ADM1032 evaluation board */ 56 { 57 .setsda = { 0x02, PORT_DATA, 1 }, 58 .setscl = { 0x01, PORT_DATA, 1 }, 59 .getsda = { 0x10, PORT_STAT, 1 }, 60 .init = { 0xf0, PORT_DATA, 0 }, 61 .smbus_alert = 1, 62 }, 63 /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ 64 { 65 .setsda = { 0x02, PORT_DATA, 1 }, 66 .setscl = { 0x01, PORT_DATA, 1 }, 67 .getsda = { 0x10, PORT_STAT, 1 }, 68 }, 69 /* type 6: Barco LPT->DVI (K5800236) adapter */ 70 { 71 .setsda = { 0x02, PORT_DATA, 1 }, 72 .setscl = { 0x01, PORT_DATA, 1 }, 73 .getsda = { 0x20, PORT_STAT, 0 }, 74 .getscl = { 0x40, PORT_STAT, 0 }, 75 .init = { 0xfc, PORT_DATA, 0 }, 76 }, 77 /* type 7: One For All JP1 parallel port adapter */ 78 { 79 .setsda = { 0x01, PORT_DATA, 0 }, 80 .setscl = { 0x02, PORT_DATA, 0 }, 81 .getsda = { 0x80, PORT_STAT, 1 }, 82 .init = { 0x04, PORT_DATA, 1 }, 83 }, 84 /* type 8: VCT-jig */ 85 { 86 .setsda = { 0x04, PORT_DATA, 1 }, 87 .setscl = { 0x01, PORT_DATA, 1 }, 88 .getsda = { 0x40, PORT_STAT, 0 }, 89 .getscl = { 0x80, PORT_STAT, 1 }, 90 }, 91 }; 92 93 static int type = -1; 94 module_param(type, int, 0); 95 MODULE_PARM_DESC(type, 96 "Type of adapter:\n" 97 " 0 = Philips adapter\n" 98 " 1 = home brew teletext adapter\n" 99 " 2 = Velleman K8000 adapter\n" 100 " 3 = ELV adapter\n" 101 " 4 = ADM1032 evaluation board\n" 102 " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" 103 " 6 = Barco LPT->DVI (K5800236) adapter\n" 104 " 7 = One For All JP1 parallel port adapter\n" 105 " 8 = VCT-jig\n" 106 ); 107