Lines Matching refs:li2c
16 static void __lsdc_gpio_i2c_set(struct lsdc_i2c * const li2c, int mask, int state) in __lsdc_gpio_i2c_set() argument
18 struct lsdc_device *ldev = to_lsdc(li2c->ddev); in __lsdc_gpio_i2c_set()
29 val = readb(li2c->dir_reg); in __lsdc_gpio_i2c_set()
31 writeb(val, li2c->dir_reg); in __lsdc_gpio_i2c_set()
34 val = readb(li2c->dir_reg); in __lsdc_gpio_i2c_set()
36 writeb(val, li2c->dir_reg); in __lsdc_gpio_i2c_set()
39 val = readb(li2c->dat_reg); in __lsdc_gpio_i2c_set()
41 writeb(val, li2c->dat_reg); in __lsdc_gpio_i2c_set()
52 static int __lsdc_gpio_i2c_get(struct lsdc_i2c * const li2c, int mask) in __lsdc_gpio_i2c_get() argument
54 struct lsdc_device *ldev = to_lsdc(li2c->ddev); in __lsdc_gpio_i2c_get()
61 val = readb(li2c->dir_reg); in __lsdc_gpio_i2c_get()
63 writeb(val, li2c->dir_reg); in __lsdc_gpio_i2c_get()
66 val = readb(li2c->dat_reg); in __lsdc_gpio_i2c_get()
75 struct lsdc_i2c * const li2c = (struct lsdc_i2c *)i2c; in lsdc_gpio_i2c_set_sda() local
77 return __lsdc_gpio_i2c_set(li2c, li2c->sda, state); in lsdc_gpio_i2c_set_sda()
82 struct lsdc_i2c * const li2c = (struct lsdc_i2c *)i2c; in lsdc_gpio_i2c_set_scl() local
84 return __lsdc_gpio_i2c_set(li2c, li2c->scl, state); in lsdc_gpio_i2c_set_scl()
89 struct lsdc_i2c * const li2c = (struct lsdc_i2c *)i2c; in lsdc_gpio_i2c_get_sda() local
91 return __lsdc_gpio_i2c_get(li2c, li2c->sda); in lsdc_gpio_i2c_get_sda()
96 struct lsdc_i2c * const li2c = (struct lsdc_i2c *)i2c; in lsdc_gpio_i2c_get_scl() local
98 return __lsdc_gpio_i2c_get(li2c, li2c->scl); in lsdc_gpio_i2c_get_scl()
103 struct lsdc_i2c *li2c = (struct lsdc_i2c *)data; in lsdc_destroy_i2c() local
105 if (li2c) { in lsdc_destroy_i2c()
106 i2c_del_adapter(&li2c->adapter); in lsdc_destroy_i2c()
107 kfree(li2c); in lsdc_destroy_i2c()
123 struct lsdc_i2c *li2c; in lsdc_create_i2c_chan() local
126 li2c = kzalloc(sizeof(*li2c), GFP_KERNEL); in lsdc_create_i2c_chan()
127 if (!li2c) in lsdc_create_i2c_chan()
130 dispipe->li2c = li2c; in lsdc_create_i2c_chan()
133 li2c->sda = 0x01; /* pin 0 */ in lsdc_create_i2c_chan()
134 li2c->scl = 0x02; /* pin 1 */ in lsdc_create_i2c_chan()
136 li2c->sda = 0x04; /* pin 2 */ in lsdc_create_i2c_chan()
137 li2c->scl = 0x08; /* pin 3 */ in lsdc_create_i2c_chan()
142 li2c->ddev = ddev; in lsdc_create_i2c_chan()
143 li2c->dir_reg = ldev->reg_base + LS7A_DC_GPIO_DIR_REG; in lsdc_create_i2c_chan()
144 li2c->dat_reg = ldev->reg_base + LS7A_DC_GPIO_DAT_REG; in lsdc_create_i2c_chan()
146 li2c->bit.setsda = lsdc_gpio_i2c_set_sda; in lsdc_create_i2c_chan()
147 li2c->bit.setscl = lsdc_gpio_i2c_set_scl; in lsdc_create_i2c_chan()
148 li2c->bit.getsda = lsdc_gpio_i2c_get_sda; in lsdc_create_i2c_chan()
149 li2c->bit.getscl = lsdc_gpio_i2c_get_scl; in lsdc_create_i2c_chan()
150 li2c->bit.udelay = 5; in lsdc_create_i2c_chan()
151 li2c->bit.timeout = usecs_to_jiffies(2200); in lsdc_create_i2c_chan()
152 li2c->bit.data = li2c; in lsdc_create_i2c_chan()
154 adapter = &li2c->adapter; in lsdc_create_i2c_chan()
155 adapter->algo_data = &li2c->bit; in lsdc_create_i2c_chan()
163 i2c_set_adapdata(adapter, li2c); in lsdc_create_i2c_chan()
167 kfree(li2c); in lsdc_create_i2c_chan()
171 ret = drmm_add_action_or_reset(ddev, lsdc_destroy_i2c, li2c); in lsdc_create_i2c_chan()
176 adapter->name, li2c->sda, li2c->scl); in lsdc_create_i2c_chan()