blob: 84a6616b072f943024e7b14277ef4fb994a9e32b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* ------------------------------------------------------------------------ *
2 * i2c-parport.h I2C bus over parallel port *
3 * ------------------------------------------------------------------------ *
Jean Delvare7c81c602014-01-29 20:40:08 +01004 Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de>
Jean Delvare07da0372011-05-24 20:58:49 +02005
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 * ------------------------------------------------------------------------ */
16
Jean Delvare07da0372011-05-24 20:58:49 +020017#define PORT_DATA 0
18#define PORT_STAT 1
19#define PORT_CTRL 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21struct lineop {
22 u8 val;
23 u8 port;
24 u8 inverted;
25};
26
27struct adapter_parm {
28 struct lineop setsda;
29 struct lineop setscl;
30 struct lineop getsda;
31 struct lineop getscl;
32 struct lineop init;
Jean Delvare35859252010-03-02 12:23:44 +010033 unsigned int smbus_alert:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034};
35
Jean Delvare07da0372011-05-24 20:58:49 +020036static const struct adapter_parm adapter_parm[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 /* type 0: Philips adapter */
38 {
Jean Delvare07da0372011-05-24 20:58:49 +020039 .setsda = { 0x80, PORT_DATA, 1 },
40 .setscl = { 0x08, PORT_CTRL, 0 },
41 .getsda = { 0x80, PORT_STAT, 0 },
42 .getscl = { 0x08, PORT_STAT, 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 },
44 /* type 1: home brew teletext adapter */
45 {
Jean Delvare07da0372011-05-24 20:58:49 +020046 .setsda = { 0x02, PORT_DATA, 0 },
47 .setscl = { 0x01, PORT_DATA, 0 },
48 .getsda = { 0x80, PORT_STAT, 1 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 },
50 /* type 2: Velleman K8000 adapter */
51 {
Jean Delvare07da0372011-05-24 20:58:49 +020052 .setsda = { 0x02, PORT_CTRL, 1 },
53 .setscl = { 0x08, PORT_CTRL, 1 },
54 .getsda = { 0x10, PORT_STAT, 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 },
56 /* type 3: ELV adapter */
57 {
Jean Delvare07da0372011-05-24 20:58:49 +020058 .setsda = { 0x02, PORT_DATA, 1 },
59 .setscl = { 0x01, PORT_DATA, 1 },
60 .getsda = { 0x40, PORT_STAT, 1 },
61 .getscl = { 0x08, PORT_STAT, 1 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 },
63 /* type 4: ADM1032 evaluation board */
64 {
Jean Delvare07da0372011-05-24 20:58:49 +020065 .setsda = { 0x02, PORT_DATA, 1 },
66 .setscl = { 0x01, PORT_DATA, 1 },
67 .getsda = { 0x10, PORT_STAT, 1 },
68 .init = { 0xf0, PORT_DATA, 0 },
Jean Delvare35859252010-03-02 12:23:44 +010069 .smbus_alert = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 },
71 /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
72 {
Jean Delvare07da0372011-05-24 20:58:49 +020073 .setsda = { 0x02, PORT_DATA, 1 },
74 .setscl = { 0x01, PORT_DATA, 1 },
75 .getsda = { 0x10, PORT_STAT, 1 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 },
Peter Korsgaard1d26f452005-11-26 20:18:43 +010077 /* type 6: Barco LPT->DVI (K5800236) adapter */
78 {
Jean Delvare07da0372011-05-24 20:58:49 +020079 .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 },
Peter Korsgaard1d26f452005-11-26 20:18:43 +010084 },
Jonathan McDowell55249cf2007-02-13 22:09:02 +010085 /* type 7: One For All JP1 parallel port adapter */
86 {
Jean Delvare07da0372011-05-24 20:58:49 +020087 .setsda = { 0x01, PORT_DATA, 0 },
88 .setscl = { 0x02, PORT_DATA, 0 },
89 .getsda = { 0x80, PORT_STAT, 1 },
90 .init = { 0x04, PORT_DATA, 1 },
Jonathan McDowell55249cf2007-02-13 22:09:02 +010091 },
Ondrej Zary82cd5d02015-07-13 19:31:12 +020092 /* 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 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070099};
100
Mark M. Hoffmane97b81d2006-03-23 16:50:25 +0100101static int type = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102module_param(type, int, 0);
103MODULE_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"
Peter Korsgaard1d26f452005-11-26 20:18:43 +0100110 " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
111 " 6 = Barco LPT->DVI (K5800236) adapter\n"
Jonathan McDowell55249cf2007-02-13 22:09:02 +0100112 " 7 = One For All JP1 parallel port adapter\n"
Ondrej Zary82cd5d02015-07-13 19:31:12 +0200113 " 8 = VCT-jig\n"
Peter Korsgaard1d26f452005-11-26 20:18:43 +0100114);