27 #include <linux/kernel.h>
28 #include <linux/module.h>
33 #include <linux/i2c.h>
39 #define DEFAULT_BASE 0x378
40 #define DRVNAME "i2c-parport-light"
54 static inline void port_write(
unsigned char p,
unsigned char d)
59 static inline unsigned char port_read(
unsigned char p)
66 static inline void line_set(
int state,
const struct lineop *
op)
72 port_write(op->
port, oldval | op->
val);
74 port_write(op->
port, oldval & ~op->
val);
77 static inline int line_get(
const struct lineop *op)
87 static void parport_setscl(
void *
data,
int state)
92 static void parport_setsda(
void *
data,
int state)
97 static int parport_getscl(
void *
data)
102 static int parport_getsda(
void *
data)
111 .setsda = parport_setsda,
112 .setscl = parport_setscl,
113 .getsda = parport_getsda,
114 .getscl = parport_getscl,
124 .algo_data = &parport_algo_data,
125 .name =
"Parallel port adapter (light)",
130 .alert_edge_triggered = 1,
133 static struct lineop parport_ctrl_irq = {
143 parport_setsda(
NULL, 1);
144 parport_setscl(
NULL, 1);
152 parport_adapter.
dev.parent = &pdev->
dev;
155 dev_err(&pdev->
dev,
"Unable to register with I2C\n");
161 alert_data.
irq = irq;
164 line_set(1, &parport_ctrl_irq);
166 dev_warn(&pdev->
dev,
"Failed to register ARA client\n");
175 line_set(0, &parport_ctrl_irq);
193 .probe = i2c_parport_probe,
212 goto exit_device_put;
223 static int __init i2c_parport_init(
void)
252 err = i2c_parport_device_add(base);
269 static void __exit i2c_parport_exit(
void)