Lines Matching refs:i2c_adap
36 static inline int i2c_slave_did_ack(struct i2c_adapter *i2c_adap) in i2c_slave_did_ack() argument
38 struct cx25821_i2c *bus = i2c_adap->algo_data; in i2c_slave_did_ack()
43 static inline int i2c_is_busy(struct i2c_adapter *i2c_adap) in i2c_is_busy() argument
45 struct cx25821_i2c *bus = i2c_adap->algo_data; in i2c_is_busy()
50 static int i2c_wait_done(struct i2c_adapter *i2c_adap) in i2c_wait_done() argument
55 if (!i2c_is_busy(i2c_adap)) in i2c_wait_done()
66 static int i2c_sendbytes(struct i2c_adapter *i2c_adap, in i2c_sendbytes() argument
69 struct cx25821_i2c *bus = i2c_adap->algo_data; in i2c_sendbytes()
85 if (!i2c_wait_done(i2c_adap)) in i2c_sendbytes()
88 if (!i2c_slave_did_ack(i2c_adap)) in i2c_sendbytes()
110 retval = i2c_wait_done(i2c_adap); in i2c_sendbytes()
136 retval = i2c_wait_done(i2c_adap); in i2c_sendbytes()
160 static int i2c_readbytes(struct i2c_adapter *i2c_adap, in i2c_readbytes() argument
163 struct cx25821_i2c *bus = i2c_adap->algo_data; in i2c_readbytes()
175 if (!i2c_wait_done(i2c_adap)) in i2c_readbytes()
177 if (!i2c_slave_did_ack(i2c_adap)) in i2c_readbytes()
201 retval = i2c_wait_done(i2c_adap); in i2c_readbytes()
224 static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) in i2c_xfer() argument
226 struct cx25821_i2c *bus = i2c_adap->algo_data; in i2c_xfer()
238 retval = i2c_readbytes(i2c_adap, &msgs[i], 0); in i2c_xfer()
242 retval = i2c_sendbytes(i2c_adap, &msgs[i], in i2c_xfer()
248 retval = i2c_readbytes(i2c_adap, &msgs[i], 1); in i2c_xfer()
251 retval = i2c_sendbytes(i2c_adap, &msgs[i], 0); in i2c_xfer()
295 bus->i2c_adap = cx25821_i2c_adap_template; in cx25821_i2c_register()
297 bus->i2c_adap.dev.parent = &dev->pci->dev; in cx25821_i2c_register()
299 strscpy(bus->i2c_adap.name, bus->dev->name, sizeof(bus->i2c_adap.name)); in cx25821_i2c_register()
301 bus->i2c_adap.algo_data = bus; in cx25821_i2c_register()
302 i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev); in cx25821_i2c_register()
303 i2c_add_adapter(&bus->i2c_adap); in cx25821_i2c_register()
305 bus->i2c_client.adapter = &bus->i2c_adap; in cx25821_i2c_register()
315 i2c_del_adapter(&bus->i2c_adap); in cx25821_i2c_unregister()
340 i2c_xfer(&dev->i2c_bus[0].i2c_adap, &msg, 1);