Lines Matching refs:i2c_adap
152 static int i2c_outb(struct i2c_adapter *i2c_adap, unsigned char c) in i2c_outb() argument
157 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in i2c_outb()
165 bit_dbg(1, &i2c_adap->dev, in i2c_outb()
180 bit_dbg(1, &i2c_adap->dev, in i2c_outb()
190 bit_dbg(2, &i2c_adap->dev, "i2c_outb: 0x%02x %s\n", (int)c, in i2c_outb()
199 static int i2c_inb(struct i2c_adapter *i2c_adap) in i2c_inb() argument
205 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in i2c_inb()
211 bit_dbg(1, &i2c_adap->dev, in i2c_inb()
230 static int test_bus(struct i2c_adapter *i2c_adap) in test_bus() argument
232 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in test_bus()
233 const char *name = i2c_adap->name; in test_bus()
237 ret = adap->pre_xfer(i2c_adap); in test_bus()
295 adap->post_xfer(i2c_adap); in test_bus()
304 adap->post_xfer(i2c_adap); in test_bus()
319 static int try_address(struct i2c_adapter *i2c_adap, in try_address() argument
322 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in try_address()
326 ret = i2c_outb(i2c_adap, addr); in try_address()
329 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); in try_address()
333 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); in try_address()
337 bit_dbg(1, &i2c_adap->dev, in try_address()
344 static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in sendbytes() argument
353 retval = i2c_outb(i2c_adap, *temp); in sendbytes()
366 dev_err(&i2c_adap->dev, "sendbytes: NAK bailout.\n"); in sendbytes()
377 dev_err(&i2c_adap->dev, "sendbytes: error %d\n", in sendbytes()
385 static int acknak(struct i2c_adapter *i2c_adap, int is_ack) in acknak() argument
387 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in acknak()
394 dev_err(&i2c_adap->dev, "readbytes: ack/nak timeout\n"); in acknak()
401 static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in readbytes() argument
408 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in readbytes()
414 inval = i2c_inb(i2c_adap); in readbytes()
430 acknak(i2c_adap, 0); in readbytes()
431 dev_err(&i2c_adap->dev, in readbytes()
443 bit_dbg(2, &i2c_adap->dev, "readbytes: 0x%02x %s\n", in readbytes()
450 inval = acknak(i2c_adap, count); in readbytes()
466 static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in bit_doAddress() argument
470 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_doAddress()
475 retries = nak_ok ? 0 : i2c_adap->retries; in bit_doAddress()
480 bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); in bit_doAddress()
482 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
484 dev_err(&i2c_adap->dev, in bit_doAddress()
489 ret = i2c_outb(i2c_adap, msg->addr & 0xff); in bit_doAddress()
492 dev_err(&i2c_adap->dev, "died at 2nd address code\n"); in bit_doAddress()
496 bit_dbg(3, &i2c_adap->dev, in bit_doAddress()
501 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
503 dev_err(&i2c_adap->dev, in bit_doAddress()
512 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
520 static int bit_xfer(struct i2c_adapter *i2c_adap, in bit_xfer() argument
524 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer()
529 ret = adap->pre_xfer(i2c_adap); in bit_xfer()
534 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); in bit_xfer()
542 bit_dbg(3, &i2c_adap->dev, in bit_xfer()
547 bit_dbg(3, &i2c_adap->dev, in bit_xfer()
552 ret = bit_doAddress(i2c_adap, pmsg); in bit_xfer()
554 bit_dbg(1, &i2c_adap->dev, in bit_xfer()
562 ret = readbytes(i2c_adap, pmsg); in bit_xfer()
564 bit_dbg(2, &i2c_adap->dev, "read %d byte%s\n", in bit_xfer()
573 ret = sendbytes(i2c_adap, pmsg); in bit_xfer()
575 bit_dbg(2, &i2c_adap->dev, "wrote %d byte%s\n", in bit_xfer()
587 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); in bit_xfer()
591 adap->post_xfer(i2c_adap); in bit_xfer()
601 static int bit_xfer_atomic(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], in bit_xfer_atomic() argument
604 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer_atomic()
607 dev_warn(&i2c_adap->dev, "not flagged for atomic transfers\n"); in bit_xfer_atomic()
609 return bit_xfer(i2c_adap, msgs, num); in bit_xfer_atomic()