Lines Matching full:bus
24 #include "bus.h"
32 nvkm_i2c_drive_scl(struct nvkm_i2c_bus *bus, int state) in nvkm_i2c_drive_scl() argument
34 bus->func->drive_scl(bus, state); in nvkm_i2c_drive_scl()
38 nvkm_i2c_drive_sda(struct nvkm_i2c_bus *bus, int state) in nvkm_i2c_drive_sda() argument
40 bus->func->drive_sda(bus, state); in nvkm_i2c_drive_sda()
44 nvkm_i2c_sense_scl(struct nvkm_i2c_bus *bus) in nvkm_i2c_sense_scl() argument
46 return bus->func->sense_scl(bus); in nvkm_i2c_sense_scl()
50 nvkm_i2c_sense_sda(struct nvkm_i2c_bus *bus) in nvkm_i2c_sense_sda() argument
52 return bus->func->sense_sda(bus); in nvkm_i2c_sense_sda()
56 nvkm_i2c_delay(struct nvkm_i2c_bus *bus, u32 nsec) in nvkm_i2c_delay() argument
62 nvkm_i2c_raise_scl(struct nvkm_i2c_bus *bus) in nvkm_i2c_raise_scl() argument
66 nvkm_i2c_drive_scl(bus, 1); in nvkm_i2c_raise_scl()
68 nvkm_i2c_delay(bus, T_RISEFALL); in nvkm_i2c_raise_scl()
69 } while (!nvkm_i2c_sense_scl(bus) && --timeout); in nvkm_i2c_raise_scl()
75 i2c_start(struct nvkm_i2c_bus *bus) in i2c_start() argument
79 if (!nvkm_i2c_sense_scl(bus) || in i2c_start()
80 !nvkm_i2c_sense_sda(bus)) { in i2c_start()
81 nvkm_i2c_drive_scl(bus, 0); in i2c_start()
82 nvkm_i2c_drive_sda(bus, 1); in i2c_start()
83 if (!nvkm_i2c_raise_scl(bus)) in i2c_start()
87 nvkm_i2c_drive_sda(bus, 0); in i2c_start()
88 nvkm_i2c_delay(bus, T_HOLD); in i2c_start()
89 nvkm_i2c_drive_scl(bus, 0); in i2c_start()
90 nvkm_i2c_delay(bus, T_HOLD); in i2c_start()
95 i2c_stop(struct nvkm_i2c_bus *bus) in i2c_stop() argument
97 nvkm_i2c_drive_scl(bus, 0); in i2c_stop()
98 nvkm_i2c_drive_sda(bus, 0); in i2c_stop()
99 nvkm_i2c_delay(bus, T_RISEFALL); in i2c_stop()
101 nvkm_i2c_drive_scl(bus, 1); in i2c_stop()
102 nvkm_i2c_delay(bus, T_HOLD); in i2c_stop()
103 nvkm_i2c_drive_sda(bus, 1); in i2c_stop()
104 nvkm_i2c_delay(bus, T_HOLD); in i2c_stop()
108 i2c_bitw(struct nvkm_i2c_bus *bus, int sda) in i2c_bitw() argument
110 nvkm_i2c_drive_sda(bus, sda); in i2c_bitw()
111 nvkm_i2c_delay(bus, T_RISEFALL); in i2c_bitw()
113 if (!nvkm_i2c_raise_scl(bus)) in i2c_bitw()
115 nvkm_i2c_delay(bus, T_HOLD); in i2c_bitw()
117 nvkm_i2c_drive_scl(bus, 0); in i2c_bitw()
118 nvkm_i2c_delay(bus, T_HOLD); in i2c_bitw()
123 i2c_bitr(struct nvkm_i2c_bus *bus) in i2c_bitr() argument
127 nvkm_i2c_drive_sda(bus, 1); in i2c_bitr()
128 nvkm_i2c_delay(bus, T_RISEFALL); in i2c_bitr()
130 if (!nvkm_i2c_raise_scl(bus)) in i2c_bitr()
132 nvkm_i2c_delay(bus, T_HOLD); in i2c_bitr()
134 sda = nvkm_i2c_sense_sda(bus); in i2c_bitr()
136 nvkm_i2c_drive_scl(bus, 0); in i2c_bitr()
137 nvkm_i2c_delay(bus, T_HOLD); in i2c_bitr()
142 nvkm_i2c_get_byte(struct nvkm_i2c_bus *bus, u8 *byte, bool last) in nvkm_i2c_get_byte() argument
148 bit = i2c_bitr(bus); in nvkm_i2c_get_byte()
154 return i2c_bitw(bus, last ? 1 : 0); in nvkm_i2c_get_byte()
158 nvkm_i2c_put_byte(struct nvkm_i2c_bus *bus, u8 byte) in nvkm_i2c_put_byte() argument
162 ret = i2c_bitw(bus, !!(byte & (1 << i))); in nvkm_i2c_put_byte()
167 ret = i2c_bitr(bus); in nvkm_i2c_put_byte()
174 i2c_addr(struct nvkm_i2c_bus *bus, struct i2c_msg *msg) in i2c_addr() argument
179 return nvkm_i2c_put_byte(bus, addr); in i2c_addr()
183 nvkm_i2c_bit_xfer(struct nvkm_i2c_bus *bus, struct i2c_msg *msgs, int num) in nvkm_i2c_bit_xfer() argument
192 ret = i2c_start(bus); in nvkm_i2c_bit_xfer()
194 ret = i2c_addr(bus, msg); in nvkm_i2c_bit_xfer()
198 ret = nvkm_i2c_get_byte(bus, ptr++, !remaining); in nvkm_i2c_bit_xfer()
201 ret = nvkm_i2c_put_byte(bus, *ptr++); in nvkm_i2c_bit_xfer()
207 i2c_stop(bus); in nvkm_i2c_bit_xfer()
212 nvkm_i2c_bit_xfer(struct nvkm_i2c_bus *bus, struct i2c_msg *msgs, int num) in nvkm_i2c_bit_xfer() argument