blob: 3b32d92b1264c4b105312a44275462c50aebfb2a [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/* ------------------------------------------------------------------------ *
3 * i2c-parport.h I2C bus over parallel port *
4 * ------------------------------------------------------------------------ *
Jean Delvare7c81c60f2014-01-29 20:40:08 +01005 Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de>
Jean Delvare07da0372011-05-24 20:58:49 +02006
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * ------------------------------------------------------------------------ */
8
Jean Delvare07da0372011-05-24 20:58:49 +02009#define PORT_DATA 0
10#define PORT_STAT 1
11#define PORT_CTRL 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13struct lineop {
14 u8 val;
15 u8 port;
16 u8 inverted;
17};
18
19struct adapter_parm {
20 struct lineop setsda;
21 struct lineop setscl;
22 struct lineop getsda;
23 struct lineop getscl;
24 struct lineop init;
Jean Delvare35859252010-03-02 12:23:44 +010025 unsigned int smbus_alert:1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026};
27
Jean Delvare07da0372011-05-24 20:58:49 +020028static const struct adapter_parm adapter_parm[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 /* type 0: Philips adapter */
30 {
Jean Delvare07da0372011-05-24 20:58:49 +020031 .setsda = { 0x80, PORT_DATA, 1 },
32 .setscl = { 0x08, PORT_CTRL, 0 },
33 .getsda = { 0x80, PORT_STAT, 0 },
34 .getscl = { 0x08, PORT_STAT, 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 },
36 /* type 1: home brew teletext adapter */
37 {
Jean Delvare07da0372011-05-24 20:58:49 +020038 .setsda = { 0x02, PORT_DATA, 0 },
39 .setscl = { 0x01, PORT_DATA, 0 },
40 .getsda = { 0x80, PORT_STAT, 1 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 },
42 /* type 2: Velleman K8000 adapter */
43 {
Jean Delvare07da0372011-05-24 20:58:49 +020044 .setsda = { 0x02, PORT_CTRL, 1 },
45 .setscl = { 0x08, PORT_CTRL, 1 },
46 .getsda = { 0x10, PORT_STAT, 0 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 },
48 /* type 3: ELV adapter */
49 {
Jean Delvare07da0372011-05-24 20:58:49 +020050 .setsda = { 0x02, PORT_DATA, 1 },
51 .setscl = { 0x01, PORT_DATA, 1 },
52 .getsda = { 0x40, PORT_STAT, 1 },
53 .getscl = { 0x08, PORT_STAT, 1 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 },
55 /* type 4: ADM1032 evaluation board */
56 {
Jean Delvare07da0372011-05-24 20:58:49 +020057 .setsda = { 0x02, PORT_DATA, 1 },
58 .setscl = { 0x01, PORT_DATA, 1 },
59 .getsda = { 0x10, PORT_STAT, 1 },
60 .init = { 0xf0, PORT_DATA, 0 },
Jean Delvare35859252010-03-02 12:23:44 +010061 .smbus_alert = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 },
63 /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
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 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 },
Peter Korsgaard1d26f452005-11-26 20:18:43 +010069 /* type 6: Barco LPT->DVI (K5800236) adapter */
70 {
Jean Delvare07da0372011-05-24 20:58:49 +020071 .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 },
Peter Korsgaard1d26f452005-11-26 20:18:43 +010076 },
Jonathan McDowell55249cf2007-02-13 22:09:02 +010077 /* type 7: One For All JP1 parallel port adapter */
78 {
Jean Delvare07da0372011-05-24 20:58:49 +020079 .setsda = { 0x01, PORT_DATA, 0 },
80 .setscl = { 0x02, PORT_DATA, 0 },
81 .getsda = { 0x80, PORT_STAT, 1 },
82 .init = { 0x04, PORT_DATA, 1 },
Jonathan McDowell55249cf2007-02-13 22:09:02 +010083 },
Ondrej Zary82cd5d02015-07-13 19:31:12 +020084 /* 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 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
92
Mark M. Hoffmane97b81d2006-03-23 16:50:25 +010093static int type = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070094module_param(type, int, 0);
95MODULE_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"
Peter Korsgaard1d26f452005-11-26 20:18:43 +0100102 " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"
103 " 6 = Barco LPT->DVI (K5800236) adapter\n"
Jonathan McDowell55249cf2007-02-13 22:09:02 +0100104 " 7 = One For All JP1 parallel port adapter\n"
Ondrej Zary82cd5d02015-07-13 19:31:12 +0200105 " 8 = VCT-jig\n"
Peter Korsgaard1d26f452005-11-26 20:18:43 +0100106);