25 #include <linux/module.h>
26 #include <linux/slab.h>
40 static void vp3054_bit_setscl(
void *
data,
int state)
47 vp3054_i2c->
state |= 0x0001;
48 vp3054_i2c->
state &= ~0x0100;
50 vp3054_i2c->
state &= ~0x0001;
51 vp3054_i2c->
state |= 0x0100;
57 static void vp3054_bit_setsda(
void *data,
int state)
64 vp3054_i2c->
state |= 0x0002;
65 vp3054_i2c->
state &= ~0x0200;
67 vp3054_i2c->
state &= ~0x0002;
68 vp3054_i2c->
state |= 0x0200;
74 static int vp3054_bit_getscl(
void *data)
81 return (state & 0x01) ? 1 : 0;
84 static int vp3054_bit_getsda(
void *data)
91 return (state & 0x02) ? 1 : 0;
97 .setsda = vp3054_bit_setsda,
98 .setscl = vp3054_bit_setscl,
99 .getsda = vp3054_bit_getsda,
100 .getscl = vp3054_bit_getscl,
116 vp3054_i2c = kzalloc(
sizeof(*vp3054_i2c),
GFP_KERNEL);
117 if (vp3054_i2c ==
NULL)
119 dev->vp3054 = vp3054_i2c;
121 memcpy(&vp3054_i2c->
algo, &vp3054_i2c_algo_template,
122 sizeof(vp3054_i2c->
algo));
124 vp3054_i2c->
adap.dev.parent = &dev->
pci->dev;
126 sizeof(vp3054_i2c->
adap.name));
129 i2c_set_adapdata(&vp3054_i2c->
adap, dev);
130 vp3054_i2c->
adap.algo_data = &vp3054_i2c->
algo;
132 vp3054_bit_setscl(dev,1);
133 vp3054_bit_setsda(dev,1);
137 printk(
"%s: vp3054_i2c register FAILED\n", core->
name);
150 if (vp3054_i2c ==
NULL ||