Lines Matching +full:data +full:- +full:gpios

5  * This file is based on: drivers/i2c/soft-i2c.c,
6 * with added driver-model support and code cleanup.
29 * udelay - delay [us] between GPIO toggle operations,
34 struct gpio_desc gpios[PIN_COUNT]; member
85 /* START: High -> Low on SDA while SCL is High */
98 /* STOP: Low -> High on SDA while SCL is High */
122 * Send a reset sequence consisting of 9 clocks with the data signal high
137 /* Set sda high with low clock, before reading slave data */
149 int delay, uchar data) in i2c_gpio_write_byte() argument
155 i2c_gpio_write_bit(scl, sda, delay, data & 0x80); in i2c_gpio_write_byte()
156 data <<= 1; in i2c_gpio_write_byte()
175 int data; in i2c_gpio_read_byte() local
179 data = 0; in i2c_gpio_read_byte()
181 data <<= 1; in i2c_gpio_read_byte()
182 data |= i2c_gpio_read_bit(scl, sda, delay); in i2c_gpio_read_byte()
186 return data; in i2c_gpio_read_byte()
197 return -EIO; in i2c_send_slave_addr()
207 struct gpio_desc *scl = &bus->gpios[PIN_SCL]; in i2c_gpio_write_data()
208 struct gpio_desc *sda = &bus->gpios[PIN_SDA]; in i2c_gpio_write_data()
209 unsigned int delay = bus->udelay; in i2c_gpio_write_data()
216 return -EIO; in i2c_gpio_write_data()
219 while (len-- > 0) { in i2c_gpio_write_data()
231 return -EIO; in i2c_gpio_write_data()
240 struct gpio_desc *scl = &bus->gpios[PIN_SCL]; in i2c_gpio_read_data()
241 struct gpio_desc *sda = &bus->gpios[PIN_SDA]; in i2c_gpio_read_data()
242 unsigned int delay = bus->udelay; in i2c_gpio_read_data()
246 while (len-- > 0) in i2c_gpio_read_data()
259 for (; nmsgs > 0; nmsgs--, msg++) { in i2c_gpio_xfer()
262 if (msg->flags & I2C_M_RD) { in i2c_gpio_xfer()
263 ret = i2c_gpio_read_data(bus, msg->addr, msg->buf, in i2c_gpio_xfer()
264 msg->len); in i2c_gpio_xfer()
266 ret = i2c_gpio_write_data(bus, msg->addr, msg->buf, in i2c_gpio_xfer()
267 msg->len, next_is_read); in i2c_gpio_xfer()
271 return -EREMOTEIO; in i2c_gpio_xfer()
280 struct gpio_desc *scl = &bus->gpios[PIN_SCL]; in i2c_gpio_probe()
281 struct gpio_desc *sda = &bus->gpios[PIN_SDA]; in i2c_gpio_probe()
282 unsigned int delay = bus->udelay; in i2c_gpio_probe()
290 __func__, dev->seq, dev->name, chip, chip_flags, ret); in i2c_gpio_probe()
298 struct gpio_desc *scl = &bus->gpios[PIN_SCL]; in i2c_gpio_set_bus_speed()
299 struct gpio_desc *sda = &bus->gpios[PIN_SDA]; in i2c_gpio_set_bus_speed()
301 bus->udelay = 1000000 / (speed_hz << 2); in i2c_gpio_set_bus_speed()
303 i2c_gpio_send_reset(scl, sda, bus->udelay); in i2c_gpio_set_bus_speed()
311 const void *blob = gd->fdt_blob; in i2c_gpio_ofdata_to_platdata()
315 ret = gpio_request_list_by_name(dev, "gpios", bus->gpios, in i2c_gpio_ofdata_to_platdata()
316 ARRAY_SIZE(bus->gpios), 0); in i2c_gpio_ofdata_to_platdata()
320 bus->udelay = fdtdec_get_int(blob, node, "i2c-gpio,delay-us", in i2c_gpio_ofdata_to_platdata()
325 pr_err("Can't get %s gpios! Error: %d", dev->name, ret); in i2c_gpio_ofdata_to_platdata()
336 { .compatible = "i2c-gpio" },
341 .name = "i2c-gpio",