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()
189 bit_dbg(2, &i2c_adap->dev, "i2c_outb: 0x%02x %s\n", (int)c, in i2c_outb()
198 static int i2c_inb(struct i2c_adapter *i2c_adap) in i2c_inb() argument
204 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in i2c_inb()
210 bit_dbg(1, &i2c_adap->dev, in i2c_inb()
229 static int test_bus(struct i2c_adapter *i2c_adap) in test_bus() argument
231 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in test_bus()
232 const char *name = i2c_adap->name; in test_bus()
236 ret = adap->pre_xfer(i2c_adap); in test_bus()
310 adap->post_xfer(i2c_adap); in test_bus()
319 adap->post_xfer(i2c_adap); in test_bus()
334 static int try_address(struct i2c_adapter *i2c_adap, in try_address() argument
337 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in try_address()
341 ret = i2c_outb(i2c_adap, addr); in try_address()
344 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); in try_address()
348 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); in try_address()
352 bit_dbg(1, &i2c_adap->dev, in try_address()
359 static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in sendbytes() argument
368 retval = i2c_outb(i2c_adap, *temp); in sendbytes()
381 dev_err(&i2c_adap->dev, "sendbytes: NAK bailout.\n"); in sendbytes()
392 dev_err(&i2c_adap->dev, "sendbytes: error %d\n", in sendbytes()
400 static int acknak(struct i2c_adapter *i2c_adap, int is_ack) in acknak() argument
402 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in acknak()
409 dev_err(&i2c_adap->dev, "readbytes: ack/nak timeout\n"); in acknak()
416 static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in readbytes() argument
425 inval = i2c_inb(i2c_adap); in readbytes()
441 acknak(i2c_adap, 0); in readbytes()
442 dev_err(&i2c_adap->dev, in readbytes()
454 bit_dbg(2, &i2c_adap->dev, "readbytes: 0x%02x %s\n", in readbytes()
461 inval = acknak(i2c_adap, count); in readbytes()
477 static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) in bit_doAddress() argument
481 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_doAddress()
486 retries = nak_ok ? 0 : i2c_adap->retries; in bit_doAddress()
491 bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); in bit_doAddress()
493 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
495 dev_err(&i2c_adap->dev, in bit_doAddress()
500 ret = i2c_outb(i2c_adap, msg->addr & 0xff); in bit_doAddress()
503 dev_err(&i2c_adap->dev, "died at 2nd address code\n"); in bit_doAddress()
507 bit_dbg(3, &i2c_adap->dev, in bit_doAddress()
512 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
514 dev_err(&i2c_adap->dev, in bit_doAddress()
523 ret = try_address(i2c_adap, addr, retries); in bit_doAddress()
531 static int bit_xfer(struct i2c_adapter *i2c_adap, in bit_xfer() argument
535 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer()
540 ret = adap->pre_xfer(i2c_adap); in bit_xfer()
545 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); in bit_xfer()
553 bit_dbg(3, &i2c_adap->dev, in bit_xfer()
558 bit_dbg(3, &i2c_adap->dev, in bit_xfer()
563 ret = bit_doAddress(i2c_adap, pmsg); in bit_xfer()
565 bit_dbg(1, &i2c_adap->dev, in bit_xfer()
573 ret = readbytes(i2c_adap, pmsg); in bit_xfer()
575 bit_dbg(2, &i2c_adap->dev, "read %d byte%s\n", in bit_xfer()
584 ret = sendbytes(i2c_adap, pmsg); in bit_xfer()
586 bit_dbg(2, &i2c_adap->dev, "wrote %d byte%s\n", in bit_xfer()
598 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); in bit_xfer()
602 adap->post_xfer(i2c_adap); in bit_xfer()
612 static int bit_xfer_atomic(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], in bit_xfer_atomic() argument
615 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer_atomic()
618 dev_warn(&i2c_adap->dev, "not flagged for atomic transfers\n"); in bit_xfer_atomic()
620 return bit_xfer(i2c_adap, msgs, num); in bit_xfer_atomic()