Lines Matching +full:num +full:- +full:addresses

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 #include <media/v4l2-common.h>
28 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_slave_did_read_ack()
51 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_is_read_busy()
74 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_is_write_done()
97 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_is_busy()
123 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_sendbytes()
124 u8 i2c_speed = dev->board.i2c_clk_divider; in i2c_sendbytes()
130 if (((dev->board.tuner_type == TUNER_XC5000) || in i2c_sendbytes()
131 (dev->board.tuner_type == TUNER_XC5000C)) && in i2c_sendbytes()
132 (dev->board.tuner_addr == msg->addr)) { in i2c_sendbytes()
138 if (msg->len == 64) in i2c_sendbytes()
146 /* Hardware needs 8 bit addresses */ in i2c_sendbytes()
147 au0828_write(dev, AU0828_I2C_DEST_ADDR_203, msg->addr << 1); in i2c_sendbytes()
149 dprintk(4, "SEND: %02x\n", msg->addr); in i2c_sendbytes()
152 if (msg->len == 0) { in i2c_sendbytes()
163 return -EIO; in i2c_sendbytes()
166 return -EIO; in i2c_sendbytes()
171 for (i = 0; i < msg->len;) { in i2c_sendbytes()
173 dprintk(4, " %02x\n", msg->buf[i]); in i2c_sendbytes()
175 au0828_write(dev, AU0828_I2C_WRITE_FIFO_205, msg->buf[i]); in i2c_sendbytes()
180 if ((strobe >= 4) || (i >= msg->len)) { in i2c_sendbytes()
183 if (i < msg->len) in i2c_sendbytes()
195 return -EIO; in i2c_sendbytes()
201 return -EIO; in i2c_sendbytes()
205 return msg->len; in i2c_sendbytes()
212 struct au0828_dev *dev = i2c_adap->algo_data; in i2c_readbytes()
213 u8 i2c_speed = dev->board.i2c_clk_divider; in i2c_readbytes()
224 if (((dev->board.tuner_type == TUNER_XC5000) || in i2c_readbytes()
225 (dev->board.tuner_type == TUNER_XC5000C)) && in i2c_readbytes()
226 (dev->board.tuner_addr == msg->addr)) in i2c_readbytes()
232 /* Hardware needs 8 bit addresses */ in i2c_readbytes()
233 au0828_write(dev, AU0828_I2C_DEST_ADDR_203, msg->addr << 1); in i2c_readbytes()
238 if (msg->len == 0) { in i2c_readbytes()
243 return -EIO; in i2c_readbytes()
247 for (i = 0; i < msg->len;) { in i2c_readbytes()
251 if (i < msg->len) in i2c_readbytes()
260 return -EIO; in i2c_readbytes()
262 msg->buf[i-1] = au0828_read(dev, AU0828_I2C_READ_FIFO_209) & in i2c_readbytes()
265 dprintk(4, " %02x\n", msg->buf[i-1]); in i2c_readbytes()
268 return -EIO; in i2c_readbytes()
272 return msg->len; in i2c_readbytes()
276 struct i2c_msg *msgs, int num) in i2c_xfer() argument
280 dprintk(4, "%s(num = %d)\n", __func__, num); in i2c_xfer()
282 for (i = 0; i < num; i++) { in i2c_xfer()
283 dprintk(4, "%s(num = %d) addr = 0x%02x len = 0x%x\n", in i2c_xfer()
284 __func__, num, msgs[i].addr, msgs[i].len); in i2c_xfer()
288 } else if (i + 1 < num && (msgs[i + 1].flags & I2C_M_RD) && in i2c_xfer()
304 return num; in i2c_xfer()
320 /* ----------------------------------------------------------------------- */
344 c->addr = i; in do_i2c_scan()
358 dev->i2c_adap = au0828_i2c_adap_template; in au0828_i2c_register()
359 dev->i2c_algo = au0828_i2c_algo_template; in au0828_i2c_register()
360 dev->i2c_client = au0828_i2c_client_template; in au0828_i2c_register()
362 dev->i2c_adap.dev.parent = &dev->usbdev->dev; in au0828_i2c_register()
364 strscpy(dev->i2c_adap.name, KBUILD_MODNAME, in au0828_i2c_register()
365 sizeof(dev->i2c_adap.name)); in au0828_i2c_register()
367 dev->i2c_adap.algo = &dev->i2c_algo; in au0828_i2c_register()
368 dev->i2c_adap.algo_data = dev; in au0828_i2c_register()
370 i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); in au0828_i2c_register()
372 i2c_set_adapdata(&dev->i2c_adap, dev); in au0828_i2c_register()
374 i2c_add_adapter(&dev->i2c_adap); in au0828_i2c_register()
376 dev->i2c_client.adapter = &dev->i2c_adap; in au0828_i2c_register()
378 if (0 == dev->i2c_rc) { in au0828_i2c_register()
381 do_i2c_scan(KBUILD_MODNAME, &dev->i2c_client); in au0828_i2c_register()
385 return dev->i2c_rc; in au0828_i2c_register()
390 i2c_del_adapter(&dev->i2c_adap); in au0828_i2c_unregister()