28 #include <linux/export.h>
29 #include <linux/i2c.h>
35 static int mga_i2c_read_gpio(
struct mga_device *mdev)
57 mga_i2c_set_gpio(mdev, ~mask, state);
60 static void mga_gpio_setsda(
void *
data,
int state)
64 mga_i2c_set(mdev, i2c->
data, state);
67 static void mga_gpio_setscl(
void *
data,
int state)
71 mga_i2c_set(mdev, i2c->
clock, state);
74 static int mga_gpio_getsda(
void *
data)
78 return (mga_i2c_read_gpio(mdev) & i2c->
data) ? 1 : 0;
81 static int mga_gpio_getscl(
void *data)
85 return (mga_i2c_read_gpio(mdev) & i2c->
clock) ? 1 : 0;
125 i2c->
adapter.dev.parent = &dev->pdev->dev;
127 i2c_set_adapdata(&i2c->
adapter, i2c);
132 i2c->
bit.udelay = 10;
133 i2c->
bit.timeout = 2;
135 i2c->
bit.setsda = mga_gpio_setsda;
136 i2c->
bit.setscl = mga_gpio_setscl;
137 i2c->
bit.getsda = mga_gpio_getsda;
138 i2c->
bit.getscl = mga_gpio_getscl;