Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ------------------------------------------------------------------------ * |
| 2 | * i2c-parport.h I2C bus over parallel port * |
| 3 | * ------------------------------------------------------------------------ * |
Jean Delvare | 3585925 | 2010-03-02 12:23:44 +0100 | [diff] [blame] | 4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | * ------------------------------------------------------------------------ */ |
| 20 | |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 21 | #define PORT_DATA 0 |
| 22 | #define PORT_STAT 1 |
| 23 | #define PORT_CTRL 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
| 25 | struct lineop { |
| 26 | u8 val; |
| 27 | u8 port; |
| 28 | u8 inverted; |
| 29 | }; |
| 30 | |
| 31 | struct adapter_parm { |
| 32 | struct lineop setsda; |
| 33 | struct lineop setscl; |
| 34 | struct lineop getsda; |
| 35 | struct lineop getscl; |
| 36 | struct lineop init; |
Jean Delvare | 3585925 | 2010-03-02 12:23:44 +0100 | [diff] [blame] | 37 | unsigned int smbus_alert:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 40 | static const struct adapter_parm adapter_parm[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | /* type 0: Philips adapter */ |
| 42 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 43 | .setsda = { 0x80, PORT_DATA, 1 }, |
| 44 | .setscl = { 0x08, PORT_CTRL, 0 }, |
| 45 | .getsda = { 0x80, PORT_STAT, 0 }, |
| 46 | .getscl = { 0x08, PORT_STAT, 0 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | }, |
| 48 | /* type 1: home brew teletext adapter */ |
| 49 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 50 | .setsda = { 0x02, PORT_DATA, 0 }, |
| 51 | .setscl = { 0x01, PORT_DATA, 0 }, |
| 52 | .getsda = { 0x80, PORT_STAT, 1 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | }, |
| 54 | /* type 2: Velleman K8000 adapter */ |
| 55 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 56 | .setsda = { 0x02, PORT_CTRL, 1 }, |
| 57 | .setscl = { 0x08, PORT_CTRL, 1 }, |
| 58 | .getsda = { 0x10, PORT_STAT, 0 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | }, |
| 60 | /* type 3: ELV adapter */ |
| 61 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 62 | .setsda = { 0x02, PORT_DATA, 1 }, |
| 63 | .setscl = { 0x01, PORT_DATA, 1 }, |
| 64 | .getsda = { 0x40, PORT_STAT, 1 }, |
| 65 | .getscl = { 0x08, PORT_STAT, 1 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | }, |
| 67 | /* type 4: ADM1032 evaluation board */ |
| 68 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 69 | .setsda = { 0x02, PORT_DATA, 1 }, |
| 70 | .setscl = { 0x01, PORT_DATA, 1 }, |
| 71 | .getsda = { 0x10, PORT_STAT, 1 }, |
| 72 | .init = { 0xf0, PORT_DATA, 0 }, |
Jean Delvare | 3585925 | 2010-03-02 12:23:44 +0100 | [diff] [blame] | 73 | .smbus_alert = 1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | }, |
| 75 | /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ |
| 76 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 77 | .setsda = { 0x02, PORT_DATA, 1 }, |
| 78 | .setscl = { 0x01, PORT_DATA, 1 }, |
| 79 | .getsda = { 0x10, PORT_STAT, 1 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | }, |
Peter Korsgaard | 1d26f45 | 2005-11-26 20:18:43 +0100 | [diff] [blame] | 81 | /* type 6: Barco LPT->DVI (K5800236) adapter */ |
| 82 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 83 | .setsda = { 0x02, PORT_DATA, 1 }, |
| 84 | .setscl = { 0x01, PORT_DATA, 1 }, |
| 85 | .getsda = { 0x20, PORT_STAT, 0 }, |
| 86 | .getscl = { 0x40, PORT_STAT, 0 }, |
| 87 | .init = { 0xfc, PORT_DATA, 0 }, |
Peter Korsgaard | 1d26f45 | 2005-11-26 20:18:43 +0100 | [diff] [blame] | 88 | }, |
Jonathan McDowell | 55249cf | 2007-02-13 22:09:02 +0100 | [diff] [blame] | 89 | /* type 7: One For All JP1 parallel port adapter */ |
| 90 | { |
Jean Delvare | 07da037 | 2011-05-24 20:58:49 +0200 | [diff] [blame] | 91 | .setsda = { 0x01, PORT_DATA, 0 }, |
| 92 | .setscl = { 0x02, PORT_DATA, 0 }, |
| 93 | .getsda = { 0x80, PORT_STAT, 1 }, |
| 94 | .init = { 0x04, PORT_DATA, 1 }, |
Jonathan McDowell | 55249cf | 2007-02-13 22:09:02 +0100 | [diff] [blame] | 95 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | }; |
| 97 | |
Mark M. Hoffman | e97b81d | 2006-03-23 16:50:25 +0100 | [diff] [blame] | 98 | static int type = -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | module_param(type, int, 0); |
| 100 | MODULE_PARM_DESC(type, |
| 101 | "Type of adapter:\n" |
| 102 | " 0 = Philips adapter\n" |
| 103 | " 1 = home brew teletext adapter\n" |
| 104 | " 2 = Velleman K8000 adapter\n" |
| 105 | " 3 = ELV adapter\n" |
| 106 | " 4 = ADM1032 evaluation board\n" |
Peter Korsgaard | 1d26f45 | 2005-11-26 20:18:43 +0100 | [diff] [blame] | 107 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" |
| 108 | " 6 = Barco LPT->DVI (K5800236) adapter\n" |
Jonathan McDowell | 55249cf | 2007-02-13 22:09:02 +0100 | [diff] [blame] | 109 | " 7 = One For All JP1 parallel port adapter\n" |
Peter Korsgaard | 1d26f45 | 2005-11-26 20:18:43 +0100 | [diff] [blame] | 110 | ); |