aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-parport.h
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-05-24 14:58:49 -0400
committerJean Delvare <khali@endymion.delvare>2011-05-24 14:58:49 -0400
commit07da0372dd6ca5517400ce95040861def25930c8 (patch)
tree417c8b0a982f8d24cce4550bfa78acdb11bcea8d /drivers/i2c/busses/i2c-parport.h
parent8eacfcebf0274310a751924c02c5c31cbdf057b3 (diff)
i2c-parport: Various cleanups
* Fix white space. * Rename labels to something meaningful. * Prefix defines with PORT_ to avoid collision with macros from <linux/parport.h>. * Add const markers where possible. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-parport.h')
-rw-r--r--drivers/i2c/busses/i2c-parport.h74
1 files changed, 35 insertions, 39 deletions
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
index a9f66816546c..3fe652302ea7 100644
--- a/drivers/i2c/busses/i2c-parport.h
+++ b/drivers/i2c/busses/i2c-parport.h
@@ -2,7 +2,7 @@
2 * i2c-parport.h I2C bus over parallel port * 2 * i2c-parport.h I2C bus over parallel port *
3 * ------------------------------------------------------------------------ * 3 * ------------------------------------------------------------------------ *
4 Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> 4 Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org>
5 5
6 This program is free software; you can redistribute it and/or modify 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 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 8 the Free Software Foundation; either version 2 of the License, or
@@ -18,13 +18,9 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * ------------------------------------------------------------------------ */ 19 * ------------------------------------------------------------------------ */
20 20
21#ifdef DATA 21#define PORT_DATA 0
22#undef DATA 22#define PORT_STAT 1
23#endif 23#define PORT_CTRL 2
24
25#define DATA 0
26#define STAT 1
27#define CTRL 2
28 24
29struct lineop { 25struct lineop {
30 u8 val; 26 u8 val;
@@ -41,61 +37,61 @@ struct adapter_parm {
41 unsigned int smbus_alert:1; 37 unsigned int smbus_alert:1;
42}; 38};
43 39
44static struct adapter_parm adapter_parm[] = { 40static const struct adapter_parm adapter_parm[] = {
45 /* type 0: Philips adapter */ 41 /* type 0: Philips adapter */
46 { 42 {
47 .setsda = { 0x80, DATA, 1 }, 43 .setsda = { 0x80, PORT_DATA, 1 },
48 .setscl = { 0x08, CTRL, 0 }, 44 .setscl = { 0x08, PORT_CTRL, 0 },
49 .getsda = { 0x80, STAT, 0 }, 45 .getsda = { 0x80, PORT_STAT, 0 },
50 .getscl = { 0x08, STAT, 0 }, 46 .getscl = { 0x08, PORT_STAT, 0 },
51 }, 47 },
52 /* type 1: home brew teletext adapter */ 48 /* type 1: home brew teletext adapter */
53 { 49 {
54 .setsda = { 0x02, DATA, 0 }, 50 .setsda = { 0x02, PORT_DATA, 0 },
55 .setscl = { 0x01, DATA, 0 }, 51 .setscl = { 0x01, PORT_DATA, 0 },
56 .getsda = { 0x80, STAT, 1 }, 52 .getsda = { 0x80, PORT_STAT, 1 },
57 }, 53 },
58 /* type 2: Velleman K8000 adapter */ 54 /* type 2: Velleman K8000 adapter */
59 { 55 {
60 .setsda = { 0x02, CTRL, 1 }, 56 .setsda = { 0x02, PORT_CTRL, 1 },
61 .setscl = { 0x08, CTRL, 1 }, 57 .setscl = { 0x08, PORT_CTRL, 1 },
62 .getsda = { 0x10, STAT, 0 }, 58 .getsda = { 0x10, PORT_STAT, 0 },
63 }, 59 },
64 /* type 3: ELV adapter */ 60 /* type 3: ELV adapter */
65 { 61 {
66 .setsda = { 0x02, DATA, 1 }, 62 .setsda = { 0x02, PORT_DATA, 1 },
67 .setscl = { 0x01, DATA, 1 }, 63 .setscl = { 0x01, PORT_DATA, 1 },
68 .getsda = { 0x40, STAT, 1 }, 64 .getsda = { 0x40, PORT_STAT, 1 },
69 .getscl = { 0x08, STAT, 1 }, 65 .getscl = { 0x08, PORT_STAT, 1 },
70 }, 66 },
71 /* type 4: ADM1032 evaluation board */ 67 /* type 4: ADM1032 evaluation board */
72 { 68 {
73 .setsda = { 0x02, DATA, 1 }, 69 .setsda = { 0x02, PORT_DATA, 1 },
74 .setscl = { 0x01, DATA, 1 }, 70 .setscl = { 0x01, PORT_DATA, 1 },
75 .getsda = { 0x10, STAT, 1 }, 71 .getsda = { 0x10, PORT_STAT, 1 },
76 .init = { 0xf0, DATA, 0 }, 72 .init = { 0xf0, PORT_DATA, 0 },
77 .smbus_alert = 1, 73 .smbus_alert = 1,
78 }, 74 },
79 /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */ 75 /* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
80 { 76 {
81 .setsda = { 0x02, DATA, 1 }, 77 .setsda = { 0x02, PORT_DATA, 1 },
82 .setscl = { 0x01, DATA, 1 }, 78 .setscl = { 0x01, PORT_DATA, 1 },
83 .getsda = { 0x10, STAT, 1 }, 79 .getsda = { 0x10, PORT_STAT, 1 },
84 }, 80 },
85 /* type 6: Barco LPT->DVI (K5800236) adapter */ 81 /* type 6: Barco LPT->DVI (K5800236) adapter */
86 { 82 {
87 .setsda = { 0x02, DATA, 1 }, 83 .setsda = { 0x02, PORT_DATA, 1 },
88 .setscl = { 0x01, DATA, 1 }, 84 .setscl = { 0x01, PORT_DATA, 1 },
89 .getsda = { 0x20, STAT, 0 }, 85 .getsda = { 0x20, PORT_STAT, 0 },
90 .getscl = { 0x40, STAT, 0 }, 86 .getscl = { 0x40, PORT_STAT, 0 },
91 .init = { 0xfc, DATA, 0 }, 87 .init = { 0xfc, PORT_DATA, 0 },
92 }, 88 },
93 /* type 7: One For All JP1 parallel port adapter */ 89 /* type 7: One For All JP1 parallel port adapter */
94 { 90 {
95 .setsda = { 0x01, DATA, 0 }, 91 .setsda = { 0x01, PORT_DATA, 0 },
96 .setscl = { 0x02, DATA, 0 }, 92 .setscl = { 0x02, PORT_DATA, 0 },
97 .getsda = { 0x80, STAT, 1 }, 93 .getsda = { 0x80, PORT_STAT, 1 },
98 .init = { 0x04, DATA, 1 }, 94 .init = { 0x04, PORT_DATA, 1 },
99 }, 95 },
100}; 96};
101 97