Lines Matching +full:left +full:- +full:most
1 // SPDX-License-Identifier: GPL-2.0-only
3 * w1_ds2413.c - w1 family 3a (DS2413) driver
4 * based on w1_ds2408.c by Jean-Francois Dagenais <dagenaisj@sonatest.com>
33 ssize_t bytes_read = -EIO; in state_read()
36 dev_dbg(&sl->dev, in state_read()
38 bin_attr->attr.name, kobj, (unsigned int)off, count, buf); in state_read()
43 return -EINVAL; in state_read()
45 mutex_lock(&sl->master->bus_mutex); in state_read()
46 dev_dbg(&sl->dev, "mutex locked"); in state_read()
52 while (retries--) { in state_read()
53 w1_write_8(sl->master, W1_F3A_FUNC_PIO_ACCESS_READ); in state_read()
55 state = w1_read_8(sl->master); in state_read()
63 dev_warn(&sl->dev, "slave device did not respond to PIO_ACCESS_READ, " \ in state_read()
64 "reselecting, retries left: %d\n", retries); in state_read()
68 if (w1_reset_resume_command(sl->master)) in state_read()
71 dev_warn(&sl->dev, "PIO_ACCESS_READ error, retries left: %d\n", retries); in state_read()
75 mutex_unlock(&sl->master->bus_mutex); in state_read()
76 dev_dbg(&sl->dev, "%s, mutex unlocked, retries: %d\n", in state_read()
90 ssize_t bytes_written = -EIO; in output_write()
93 return -EFAULT; in output_write()
95 dev_dbg(&sl->dev, "locking mutex for write_output"); in output_write()
96 mutex_lock(&sl->master->bus_mutex); in output_write()
97 dev_dbg(&sl->dev, "mutex locked"); in output_write()
103 * according to the DS2413 datasheet the most significant 6 bits in output_write()
108 while (retries--) { in output_write()
112 w1_write_block(sl->master, w1_buf, 3); in output_write()
114 if (w1_read_8(sl->master) == W1_F3A_SUCCESS_CONFIRM_BYTE) { in output_write()
118 if (w1_reset_resume_command(sl->master)) in output_write()
121 dev_warn(&sl->dev, "PIO_ACCESS_WRITE error, retries left: %d\n", retries); in output_write()
125 mutex_unlock(&sl->master->bus_mutex); in output_write()
126 dev_dbg(&sl->dev, "%s, mutex unlocked, retries: %d\n", in output_write()
161 MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_DS2413));