Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* ------------------------------------------------------------------------ * |
2 | * i2c-parport.h I2C bus over parallel port * | |
3 | * ------------------------------------------------------------------------ * | |
7c81c60f | 4 | Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de> |
07da0372 | 5 | |
1da177e4 LT |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
1da177e4 LT |
15 | * ------------------------------------------------------------------------ */ |
16 | ||
07da0372 JD |
17 | #define PORT_DATA 0 |
18 | #define PORT_STAT 1 | |
19 | #define PORT_CTRL 2 | |
1da177e4 LT |
20 | |
21 | struct lineop { | |
22 | u8 val; | |
23 | u8 port; | |
24 | u8 inverted; | |
25 | }; | |
26 | ||
27 | struct adapter_parm { | |
28 | struct lineop setsda; | |
29 | struct lineop setscl; | |
30 | struct lineop getsda; | |
31 | struct lineop getscl; | |
32 | struct lineop init; | |
35859254 | 33 | unsigned int smbus_alert:1; |
1da177e4 LT |
34 | }; |
35 | ||
07da0372 | 36 | static const struct adapter_parm adapter_parm[] = { |
1da177e4 LT |
37 | /* type 0: Philips adapter */ |
38 | { | |
07da0372 JD |
39 | .setsda = { 0x80, PORT_DATA, 1 }, |
40 | .setscl = { 0x08, PORT_CTRL, 0 }, | |
41 | .getsda = { 0x80, PORT_STAT, 0 }, | |
42 | .getscl = { 0x08, PORT_STAT, 0 }, | |
1da177e4 LT |
43 | }, |
44 | /* type 1: home brew teletext adapter */ | |
45 | { | |
07da0372 JD |
46 | .setsda = { 0x02, PORT_DATA, 0 }, |
47 | .setscl = { 0x01, PORT_DATA, 0 }, | |
48 | .getsda = { 0x80, PORT_STAT, 1 }, | |
1da177e4 LT |
49 | }, |
50 | /* type 2: Velleman K8000 adapter */ | |
51 | { | |
07da0372 JD |
52 | .setsda = { 0x02, PORT_CTRL, 1 }, |
53 | .setscl = { 0x08, PORT_CTRL, 1 }, | |
54 | .getsda = { 0x10, PORT_STAT, 0 }, | |
1da177e4 LT |
55 | }, |
56 | /* type 3: ELV adapter */ | |
57 | { | |
07da0372 JD |
58 | .setsda = { 0x02, PORT_DATA, 1 }, |
59 | .setscl = { 0x01, PORT_DATA, 1 }, | |
60 | .getsda = { 0x40, PORT_STAT, 1 }, | |
61 | .getscl = { 0x08, PORT_STAT, 1 }, | |
1da177e4 LT |
62 | }, |
63 | /* type 4: ADM1032 evaluation board */ | |
64 | { | |
07da0372 JD |
65 | .setsda = { 0x02, PORT_DATA, 1 }, |
66 | .setscl = { 0x01, PORT_DATA, 1 }, | |
67 | .getsda = { 0x10, PORT_STAT, 1 }, | |
68 | .init = { 0xf0, PORT_DATA, 0 }, | |
35859254 | 69 | .smbus_alert = 1, |
1da177e4 LT |
70 | }, |
71 | /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ | |
72 | { | |
07da0372 JD |
73 | .setsda = { 0x02, PORT_DATA, 1 }, |
74 | .setscl = { 0x01, PORT_DATA, 1 }, | |
75 | .getsda = { 0x10, PORT_STAT, 1 }, | |
1da177e4 | 76 | }, |
1d26f455 PK |
77 | /* type 6: Barco LPT->DVI (K5800236) adapter */ |
78 | { | |
07da0372 JD |
79 | .setsda = { 0x02, PORT_DATA, 1 }, |
80 | .setscl = { 0x01, PORT_DATA, 1 }, | |
81 | .getsda = { 0x20, PORT_STAT, 0 }, | |
82 | .getscl = { 0x40, PORT_STAT, 0 }, | |
83 | .init = { 0xfc, PORT_DATA, 0 }, | |
1d26f455 | 84 | }, |
55249cf7 JM |
85 | /* type 7: One For All JP1 parallel port adapter */ |
86 | { | |
07da0372 JD |
87 | .setsda = { 0x01, PORT_DATA, 0 }, |
88 | .setscl = { 0x02, PORT_DATA, 0 }, | |
89 | .getsda = { 0x80, PORT_STAT, 1 }, | |
90 | .init = { 0x04, PORT_DATA, 1 }, | |
55249cf7 | 91 | }, |
82cd5d04 OZ |
92 | /* type 8: VCT-jig */ |
93 | { | |
94 | .setsda = { 0x04, PORT_DATA, 1 }, | |
95 | .setscl = { 0x01, PORT_DATA, 1 }, | |
96 | .getsda = { 0x40, PORT_STAT, 0 }, | |
97 | .getscl = { 0x80, PORT_STAT, 1 }, | |
98 | }, | |
1da177e4 LT |
99 | }; |
100 | ||
e97b81dd | 101 | static int type = -1; |
1da177e4 LT |
102 | module_param(type, int, 0); |
103 | MODULE_PARM_DESC(type, | |
104 | "Type of adapter:\n" | |
105 | " 0 = Philips adapter\n" | |
106 | " 1 = home brew teletext adapter\n" | |
107 | " 2 = Velleman K8000 adapter\n" | |
108 | " 3 = ELV adapter\n" | |
109 | " 4 = ADM1032 evaluation board\n" | |
1d26f455 PK |
110 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" |
111 | " 6 = Barco LPT->DVI (K5800236) adapter\n" | |
55249cf7 | 112 | " 7 = One For All JP1 parallel port adapter\n" |
82cd5d04 | 113 | " 8 = VCT-jig\n" |
1d26f455 | 114 | ); |