• Home
  • Raw
  • Download

Lines Matching refs:adap

48 #define setsda(adap, val)	adap->setsda(adap->data, val)  argument
49 #define setscl(adap, val) adap->setscl(adap->data, val) argument
50 #define getsda(adap) adap->getsda(adap->data) argument
51 #define getscl(adap) adap->getscl(adap->data) argument
53 static inline void sdalo(struct i2c_algo_bit_data *adap) in sdalo() argument
55 setsda(adap, 0); in sdalo()
56 udelay((adap->udelay + 1) / 2); in sdalo()
59 static inline void sdahi(struct i2c_algo_bit_data *adap) in sdahi() argument
61 setsda(adap, 1); in sdahi()
62 udelay((adap->udelay + 1) / 2); in sdahi()
65 static inline void scllo(struct i2c_algo_bit_data *adap) in scllo() argument
67 setscl(adap, 0); in scllo()
68 udelay(adap->udelay / 2); in scllo()
75 static int sclhi(struct i2c_algo_bit_data *adap) in sclhi() argument
79 setscl(adap, 1); in sclhi()
82 if (!adap->getscl) in sclhi()
86 while (!getscl(adap)) { in sclhi()
92 if (time_after(jiffies, start + adap->timeout)) { in sclhi()
96 if (getscl(adap)) in sclhi()
109 udelay(adap->udelay); in sclhi()
115 static void i2c_start(struct i2c_algo_bit_data *adap) in i2c_start() argument
118 setsda(adap, 0); in i2c_start()
119 udelay(adap->udelay); in i2c_start()
120 scllo(adap); in i2c_start()
123 static void i2c_repstart(struct i2c_algo_bit_data *adap) in i2c_repstart() argument
126 sdahi(adap); in i2c_repstart()
127 sclhi(adap); in i2c_repstart()
128 setsda(adap, 0); in i2c_repstart()
129 udelay(adap->udelay); in i2c_repstart()
130 scllo(adap); in i2c_repstart()
134 static void i2c_stop(struct i2c_algo_bit_data *adap) in i2c_stop() argument
137 sdalo(adap); in i2c_stop()
138 sclhi(adap); in i2c_stop()
139 setsda(adap, 1); in i2c_stop()
140 udelay(adap->udelay); in i2c_stop()
157 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in i2c_outb() local
162 setsda(adap, sb); in i2c_outb()
163 udelay((adap->udelay + 1) / 2); in i2c_outb()
164 if (sclhi(adap) < 0) { /* timed out */ in i2c_outb()
176 scllo(adap); in i2c_outb()
178 sdahi(adap); in i2c_outb()
179 if (sclhi(adap) < 0) { /* timeout */ in i2c_outb()
188 ack = !getsda(adap); /* ack: sda is pulled low -> success */ in i2c_outb()
192 scllo(adap); in i2c_outb()
204 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in i2c_inb() local
207 sdahi(adap); in i2c_inb()
209 if (sclhi(adap) < 0) { /* timeout */ in i2c_inb()
216 if (getsda(adap)) in i2c_inb()
218 setscl(adap, 0); in i2c_inb()
219 udelay(i == 7 ? adap->udelay / 2 : adap->udelay); in i2c_inb()
231 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in test_bus() local
235 if (adap->pre_xfer) { in test_bus()
236 ret = adap->pre_xfer(i2c_adap); in test_bus()
241 if (adap->getscl == NULL) in test_bus()
244 sda = getsda(adap); in test_bus()
245 scl = (adap->getscl == NULL) ? 1 : getscl(adap); in test_bus()
253 sdalo(adap); in test_bus()
254 sda = getsda(adap); in test_bus()
255 scl = (adap->getscl == NULL) ? 1 : getscl(adap); in test_bus()
267 sdahi(adap); in test_bus()
268 sda = getsda(adap); in test_bus()
269 scl = (adap->getscl == NULL) ? 1 : getscl(adap); in test_bus()
281 scllo(adap); in test_bus()
282 sda = getsda(adap); in test_bus()
283 scl = (adap->getscl == NULL) ? 0 : getscl(adap); in test_bus()
295 sclhi(adap); in test_bus()
296 sda = getsda(adap); in test_bus()
297 scl = (adap->getscl == NULL) ? 1 : getscl(adap); in test_bus()
309 if (adap->post_xfer) in test_bus()
310 adap->post_xfer(i2c_adap); in test_bus()
315 sdahi(adap); in test_bus()
316 sclhi(adap); in test_bus()
318 if (adap->post_xfer) in test_bus()
319 adap->post_xfer(i2c_adap); in test_bus()
337 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in try_address() local
345 i2c_stop(adap); in try_address()
346 udelay(adap->udelay); in try_address()
349 i2c_start(adap); in try_address()
402 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in acknak() local
406 setsda(adap, 0); in acknak()
407 udelay((adap->udelay + 1) / 2); in acknak()
408 if (sclhi(adap) < 0) { /* timeout */ in acknak()
412 scllo(adap); in acknak()
481 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_doAddress() local
509 i2c_repstart(adap); in bit_doAddress()
535 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer() local
539 if (adap->pre_xfer) { in bit_xfer()
540 ret = adap->pre_xfer(i2c_adap); in bit_xfer()
546 i2c_start(adap); in bit_xfer()
555 i2c_stop(adap); in bit_xfer()
556 i2c_start(adap); in bit_xfer()
560 i2c_repstart(adap); in bit_xfer()
599 i2c_stop(adap); in bit_xfer()
601 if (adap->post_xfer) in bit_xfer()
602 adap->post_xfer(i2c_adap); in bit_xfer()
615 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; in bit_xfer_atomic() local
617 if (!adap->can_do_atomic) in bit_xfer_atomic()
623 static u32 bit_func(struct i2c_adapter *adap) in bit_func() argument
646 static int __i2c_bit_add_bus(struct i2c_adapter *adap, in __i2c_bit_add_bus() argument
649 struct i2c_algo_bit_data *bit_adap = adap->algo_data; in __i2c_bit_add_bus()
653 ret = test_bus(adap); in __i2c_bit_add_bus()
659 adap->algo = &i2c_bit_algo; in __i2c_bit_add_bus()
660 adap->retries = 3; in __i2c_bit_add_bus()
662 adap->quirks = &i2c_bit_quirk_no_clk_stretch; in __i2c_bit_add_bus()
669 ret = add_adapter(adap); in __i2c_bit_add_bus()
675 dev_warn(&adap->dev, "Not I2C compliant: can't read SCL\n"); in __i2c_bit_add_bus()
676 dev_warn(&adap->dev, "Bus may be unreliable\n"); in __i2c_bit_add_bus()
681 int i2c_bit_add_bus(struct i2c_adapter *adap) in i2c_bit_add_bus() argument
683 return __i2c_bit_add_bus(adap, i2c_add_adapter); in i2c_bit_add_bus()
687 int i2c_bit_add_numbered_bus(struct i2c_adapter *adap) in i2c_bit_add_numbered_bus() argument
689 return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter); in i2c_bit_add_numbered_bus()