Lines Matching +full:reset +full:- +full:post +full:- +full:delay +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0-or-later
8 #include <linux/delay.h>
48 * w1_touch_bit() - Generates a write-0 or write-1 cycle and samples the level.
50 * @bit: 0 - write a 0, 1 - write a 0 read the level
54 if (dev->bus_master->touch_bit) in w1_touch_bit()
55 return dev->bus_master->touch_bit(dev->bus_master->data, bit); in w1_touch_bit()
66 * w1_write_bit() - Generates a write-0 or write-1 cycle.
70 * Only call if dev->bus_master->touch_bit is NULL
79 dev->bus_master->write_bit(dev->bus_master->data, 0); in w1_write_bit()
81 dev->bus_master->write_bit(dev->bus_master->data, 1); in w1_write_bit()
84 dev->bus_master->write_bit(dev->bus_master->data, 0); in w1_write_bit()
86 dev->bus_master->write_bit(dev->bus_master->data, 1); in w1_write_bit()
94 * w1_pre_write() - pre-write operations
97 * Pre-write operation, currently only supporting strong pullups.
103 if (dev->pullup_duration && in w1_pre_write()
104 dev->enable_pullup && dev->bus_master->set_pullup) { in w1_pre_write()
105 dev->bus_master->set_pullup(dev->bus_master->data, in w1_pre_write()
106 dev->pullup_duration); in w1_pre_write()
111 * w1_post_write() - post-write options
114 * Post-write operation, currently only supporting strong pullups.
116 * them, or execute the delay otherwise, in either case clear the request.
120 if (dev->pullup_duration) { in w1_post_write()
121 if (dev->enable_pullup && dev->bus_master->set_pullup) in w1_post_write()
122 dev->bus_master->set_pullup(dev->bus_master->data, 0); in w1_post_write()
124 msleep(dev->pullup_duration); in w1_post_write()
125 dev->pullup_duration = 0; in w1_post_write()
130 * w1_write_8() - Writes 8 bits.
138 if (dev->bus_master->write_byte) { in w1_write_8()
140 dev->bus_master->write_byte(dev->bus_master->data, byte); in w1_write_8()
154 * w1_read_bit() - Generates a write-1 cycle and samples the level.
157 * Only call if dev->bus_master->touch_bit is NULL
166 dev->bus_master->write_bit(dev->bus_master->data, 0); in w1_read_bit()
168 dev->bus_master->write_bit(dev->bus_master->data, 1); in w1_read_bit()
171 result = dev->bus_master->read_bit(dev->bus_master->data); in w1_read_bit()
180 * w1_triplet() - * Does a triplet - used for searching ROM addresses.
191 * Return: bit fields - see above
195 if (dev->bus_master->triplet) in w1_triplet()
196 return dev->bus_master->triplet(dev->bus_master->data, bdir); in w1_triplet()
214 if (dev->bus_master->touch_bit) in w1_triplet()
224 * w1_read_8() - Reads 8 bits.
234 if (dev->bus_master->read_byte) in w1_read_8()
235 res = dev->bus_master->read_byte(dev->bus_master->data); in w1_read_8()
245 * w1_write_block() - Writes a series of bytes.
254 if (dev->bus_master->write_block) { in w1_write_block()
256 dev->bus_master->write_block(dev->bus_master->data, buf, len); in w1_write_block()
266 * w1_touch_block() - Touches a series of bytes.
290 * w1_read_block() - Reads a series of bytes.
301 if (dev->bus_master->read_block) in w1_read_block()
302 ret = dev->bus_master->read_block(dev->bus_master->data, buf, len); in w1_read_block()
314 * w1_reset_bus() - Issues a reset bus sequence.
325 if (dev->bus_master->reset_bus) in w1_reset_bus()
326 result = dev->bus_master->reset_bus(dev->bus_master->data) & 0x1; in w1_reset_bus()
328 dev->bus_master->write_bit(dev->bus_master->data, 0); in w1_reset_bus()
329 /* minimum 480, max ? us in w1_reset_bus()
330 * be nice and sleep, except 18b20 spec lists 960us maximum, in w1_reset_bus()
337 dev->bus_master->write_bit(dev->bus_master->data, 1); in w1_reset_bus()
340 result = dev->bus_master->read_bit(dev->bus_master->data) & 0x1; in w1_reset_bus()
341 /* minimum 70 (above) + 430 = 500 us in w1_reset_bus()
342 * There aren't any timing requirements between a reset and in w1_reset_bus()
359 while (len--) in w1_calc_crc8()
368 dev->attempts++; in w1_search_devices()
369 if (dev->bus_master->search) in w1_search_devices()
370 dev->bus_master->search(dev->bus_master->data, dev, in w1_search_devices()
377 * w1_reset_select_slave() - reset and select a slave
389 if (w1_reset_bus(sl->master)) in w1_reset_select_slave()
390 return -1; in w1_reset_select_slave()
392 if (sl->master->slave_count == 1) in w1_reset_select_slave()
393 w1_write_8(sl->master, W1_SKIP_ROM); in w1_reset_select_slave()
396 u64 rn = le64_to_cpu(*((u64*)&sl->reg_num)); in w1_reset_select_slave()
399 w1_write_block(sl->master, match, 9); in w1_reset_select_slave()
406 * w1_reset_resume_command() - resume instead of another match ROM
410 * successive commands a reset between each, this function is similar
411 * to doing a reset then a match ROM for the last matched ROM. The
416 * and a "SKIP ROM" is done for efficiency. On multi-slave busses, this
424 return -1; in w1_reset_resume_command()
426 w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM); in w1_reset_resume_command()
432 * w1_next_pullup() - register for a strong pullup
434 * @delay: time in milliseconds
436 * Put out a strong pull-up of the specified duration after the next write
445 void w1_next_pullup(struct w1_master *dev, int delay) in w1_next_pullup() argument
447 dev->pullup_duration = delay; in w1_next_pullup()