Lines Matching refs:sl
38 static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf) in _read_reg() argument
41 dev_dbg(&sl->dev, in _read_reg()
43 sl, (unsigned int)address, buf); in _read_reg()
48 mutex_lock(&sl->master->bus_mutex); in _read_reg()
49 dev_dbg(&sl->dev, "mutex locked"); in _read_reg()
51 if (w1_reset_select_slave(sl)) { in _read_reg()
52 mutex_unlock(&sl->master->bus_mutex); in _read_reg()
59 w1_write_block(sl->master, wrbuf, 3); in _read_reg()
60 *buf = w1_read_8(sl->master); in _read_reg()
62 mutex_unlock(&sl->master->bus_mutex); in _read_reg()
63 dev_dbg(&sl->dev, "mutex unlocked"); in _read_reg()
140 static bool optional_read_back_valid(struct w1_slave *sl, u8 expected) in optional_read_back_valid() argument
144 if (w1_reset_resume_command(sl->master)) in optional_read_back_valid()
151 w1_write_block(sl->master, w1_buf, 3); in optional_read_back_valid()
153 return (w1_read_8(sl->master) == expected); in optional_read_back_valid()
156 static bool optional_read_back_valid(struct w1_slave *sl, u8 expected) in optional_read_back_valid() argument
166 struct w1_slave *sl = kobj_to_w1_slave(kobj); in output_write() local
174 dev_dbg(&sl->dev, "locking mutex for write_output"); in output_write()
175 mutex_lock(&sl->master->bus_mutex); in output_write()
176 dev_dbg(&sl->dev, "mutex locked"); in output_write()
178 if (w1_reset_select_slave(sl)) in output_write()
186 w1_write_block(sl->master, w1_buf, 3); in output_write()
188 if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE && in output_write()
189 optional_read_back_valid(sl, *buf)) { in output_write()
194 if (w1_reset_resume_command(sl->master)) in output_write()
200 mutex_unlock(&sl->master->bus_mutex); in output_write()
202 dev_dbg(&sl->dev, "%s, mutex unlocked retries:%d\n", in output_write()
216 struct w1_slave *sl = kobj_to_w1_slave(kobj); in activity_write() local
222 mutex_lock(&sl->master->bus_mutex); in activity_write()
224 if (w1_reset_select_slave(sl)) in activity_write()
228 w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES); in activity_write()
229 if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) { in activity_write()
230 mutex_unlock(&sl->master->bus_mutex); in activity_write()
233 if (w1_reset_resume_command(sl->master)) in activity_write()
238 mutex_unlock(&sl->master->bus_mutex); in activity_write()
246 struct w1_slave *sl = kobj_to_w1_slave(kobj); in status_control_write() local
253 mutex_lock(&sl->master->bus_mutex); in status_control_write()
255 if (w1_reset_select_slave(sl)) in status_control_write()
264 w1_write_block(sl->master, w1_buf, 4); in status_control_write()
265 if (w1_reset_resume_command(sl->master)) in status_control_write()
272 w1_write_block(sl->master, w1_buf, 3); in status_control_write()
273 if (w1_read_8(sl->master) == *buf) { in status_control_write()
275 mutex_unlock(&sl->master->bus_mutex); in status_control_write()
280 mutex_unlock(&sl->master->bus_mutex); in status_control_write()
291 static int w1_f29_disable_test_mode(struct w1_slave *sl) in w1_f29_disable_test_mode() argument
295 u64 rn = le64_to_cpu(*((u64*)&sl->reg_num)); in w1_f29_disable_test_mode()
300 mutex_lock(&sl->master->bus_mutex); in w1_f29_disable_test_mode()
302 res = w1_reset_bus(sl->master); in w1_f29_disable_test_mode()
305 w1_write_block(sl->master, magic, ARRAY_SIZE(magic)); in w1_f29_disable_test_mode()
307 res = w1_reset_bus(sl->master); in w1_f29_disable_test_mode()
309 mutex_unlock(&sl->master->bus_mutex); in w1_f29_disable_test_mode()