25 #include <linux/module.h>
33 #define VIAFB_NUM_I2C 5
37 static void via_i2c_setscl(
void *
data,
int state)
49 switch (adap_data->
type) {
60 spin_unlock_irqrestore(&i2c_vdev->
reg_lock, flags);
63 static int via_i2c_getscl(
void *data)
75 spin_unlock_irqrestore(&i2c_vdev->
reg_lock, flags);
79 static int via_i2c_getsda(
void *data)
91 spin_unlock_irqrestore(&i2c_vdev->
reg_lock, flags);
95 static void via_i2c_setsda(
void *data,
int state)
107 switch (adap_data->
type) {
118 spin_unlock_irqrestore(&i2c_vdev->
reg_lock, flags);
132 msgs[0].
addr = msgs[1].
addr = slave_addr / 2;
134 msgs[0].
len = 1; msgs[1].
len = 1;
154 msgs.
addr = slave_addr / 2;
176 msgs[0].
addr = msgs[1].
addr = slave_addr / 2;
178 msgs[0].
len = 1; msgs[1].
len = buff_len;
179 msgs[0].
buf = mm1; msgs[1].
buf = buff;
207 algo->
setsda = via_i2c_setsda;
208 algo->
setscl = via_i2c_setscl;
209 algo->
getsda = via_i2c_getsda;
210 algo->
getscl = via_i2c_getscl;
213 algo->
data = adap_cfg;
215 sprintf(adapter->
name,
"viafb i2c io_port idx 0x%02x",
221 adapter->
dev.parent = &pdev->
dev;
227 via_i2c_setsda(adap_cfg, 1);
228 via_i2c_setscl(adap_cfg, 1);
239 i2c_vdev = platdev->
dev.platform_data;
249 ret = create_i2c_bus(&i2c_stuff->
adapter,
250 &i2c_stuff->
algo, adap_cfg,
283 .probe = viafb_i2c_probe,
284 .remove = viafb_i2c_remove,