• Home
  • Raw
  • Download

Lines Matching refs:sl

85 static int w1_f19_i2c_busy_wait(struct w1_slave *sl, size_t count)  in w1_f19_i2c_busy_wait()  argument
88 struct w1_f19_data *data = sl->family_data; in w1_f19_i2c_busy_wait()
92 if (w1_touch_bit(sl->master, 1) == 0) in w1_f19_i2c_busy_wait()
108 if (w1_touch_bit(sl->master, 1) == 0) in w1_f19_i2c_busy_wait()
116 dev_warn(&sl->dev, "busy timeout\n"); in w1_f19_i2c_busy_wait()
122 static size_t w1_f19_error(struct w1_slave *sl, u8 w1_buf[]) in w1_f19_error() argument
126 dev_warn(&sl->dev, "crc16 mismatch\n"); in w1_f19_error()
128 dev_warn(&sl->dev, "i2c device not responding\n"); in w1_f19_error()
131 dev_warn(&sl->dev, "i2c short write, %d bytes not acknowledged\n", in w1_f19_error()
149 static int __w1_f19_i2c_write(struct w1_slave *sl, in __w1_f19_i2c_write() argument
159 w1_write_block(sl->master, command, command_count); in __w1_f19_i2c_write()
163 w1_write_8(sl->master, w1_buf[0]); in __w1_f19_i2c_write()
166 w1_write_block(sl->master, buffer, count); in __w1_f19_i2c_write()
170 w1_write_block(sl->master, w1_buf, 2); in __w1_f19_i2c_write()
173 if (w1_f19_i2c_busy_wait(sl, count + 1) < 0) in __w1_f19_i2c_write()
177 w1_read_block(sl->master, w1_buf, 2); in __w1_f19_i2c_write()
180 error = w1_f19_error(sl, w1_buf); in __w1_f19_i2c_write()
190 static int w1_f19_i2c_write(struct w1_slave *sl, u16 i2c_address, in w1_f19_i2c_write() argument
213 result = __w1_f19_i2c_write(sl, command, 2, buffer, count); in w1_f19_i2c_write()
221 result = __w1_f19_i2c_write(sl, command, 2, p, in w1_f19_i2c_write()
227 if (w1_reset_resume_command(sl->master)) in w1_f19_i2c_write()
237 result = __w1_f19_i2c_write(sl, command, 1, p, in w1_f19_i2c_write()
243 if (w1_reset_resume_command(sl->master)) in w1_f19_i2c_write()
254 result = __w1_f19_i2c_write(sl, command, 1, p, remaining); in w1_f19_i2c_write()
262 static int w1_f19_i2c_read(struct w1_slave *sl, u16 i2c_address, in w1_f19_i2c_read() argument
280 w1_write_block(sl->master, w1_buf, 5); in w1_f19_i2c_read()
283 if (w1_f19_i2c_busy_wait(sl, count + 1) < 0) in w1_f19_i2c_read()
287 w1_buf[0] = w1_read_8(sl->master); in w1_f19_i2c_read()
291 error = w1_f19_error(sl, w1_buf); in w1_f19_i2c_read()
296 return w1_read_block(sl->master, buffer, count); in w1_f19_i2c_read()
301 static int w1_f19_i2c_write_read(struct w1_slave *sl, u16 i2c_address, in w1_f19_i2c_write_read() argument
317 w1_write_block(sl->master, w1_buf, 3); in w1_f19_i2c_write_read()
320 w1_write_block(sl->master, wbuffer, wcount); in w1_f19_i2c_write_read()
326 w1_write_block(sl->master, w1_buf, 3); in w1_f19_i2c_write_read()
329 if (w1_f19_i2c_busy_wait(sl, wcount + rcount + 2) < 0) in w1_f19_i2c_write_read()
333 w1_read_block(sl->master, w1_buf, 2); in w1_f19_i2c_write_read()
336 error = w1_f19_error(sl, w1_buf); in w1_f19_i2c_write_read()
341 return w1_read_block(sl->master, rbuffer, rcount); in w1_f19_i2c_write_read()
349 struct w1_slave *sl = (struct w1_slave *) adapter->algo_data; in w1_f19_i2c_master_transfer() local
354 mutex_lock(&sl->master->bus_mutex); in w1_f19_i2c_master_transfer()
357 if (w1_reset_select_slave(sl)) { in w1_f19_i2c_master_transfer()
377 result = w1_f19_i2c_write_read(sl, msgs[i].addr, in w1_f19_i2c_master_transfer()
392 result = w1_f19_i2c_read(sl, msgs[i+1].addr, in w1_f19_i2c_master_transfer()
404 result = w1_f19_i2c_read(sl, msgs[i].addr, in w1_f19_i2c_master_transfer()
418 result = w1_f19_i2c_read(sl, in w1_f19_i2c_master_transfer()
433 result = w1_f19_i2c_write(sl, in w1_f19_i2c_master_transfer()
450 if (w1_reset_resume_command(sl->master)) { in w1_f19_i2c_master_transfer()
459 mutex_unlock(&sl->master->bus_mutex); in w1_f19_i2c_master_transfer()
500 static int w1_f19_get_i2c_speed(struct w1_slave *sl) in w1_f19_get_i2c_speed() argument
502 struct w1_f19_data *data = sl->family_data; in w1_f19_get_i2c_speed()
506 mutex_lock(&sl->master->bus_mutex); in w1_f19_get_i2c_speed()
509 if (w1_reset_select_slave(sl)) in w1_f19_get_i2c_speed()
513 w1_write_8(sl->master, W1_F19_READ_CONFIGURATION); in w1_f19_get_i2c_speed()
514 result = w1_read_8(sl->master); in w1_f19_get_i2c_speed()
525 mutex_unlock(&sl->master->bus_mutex); in w1_f19_get_i2c_speed()
532 static int __w1_f19_set_i2c_speed(struct w1_slave *sl, u8 speed) in __w1_f19_set_i2c_speed() argument
534 struct w1_f19_data *data = sl->family_data; in __w1_f19_set_i2c_speed()
539 if (w1_reset_select_slave(sl)) in __w1_f19_set_i2c_speed()
544 w1_write_block(sl->master, w1_buf, 2); in __w1_f19_set_i2c_speed()
549 dev_info(&sl->dev, "i2c speed set to %d kBaud\n", i2c_speeds[speed]); in __w1_f19_set_i2c_speed()
554 static int w1_f19_set_i2c_speed(struct w1_slave *sl, u8 speed) in w1_f19_set_i2c_speed() argument
559 mutex_lock(&sl->master->bus_mutex); in w1_f19_set_i2c_speed()
562 result = __w1_f19_set_i2c_speed(sl, speed); in w1_f19_set_i2c_speed()
565 mutex_unlock(&sl->master->bus_mutex); in w1_f19_set_i2c_speed()
577 struct w1_slave *sl = dev_to_w1_slave(dev); in speed_show() local
581 result = w1_f19_get_i2c_speed(sl); in speed_show()
592 struct w1_slave *sl = dev_to_w1_slave(dev); in speed_store() local
606 error = w1_f19_set_i2c_speed(sl, 0); in speed_store()
609 error = w1_f19_set_i2c_speed(sl, 1); in speed_store()
612 error = w1_f19_set_i2c_speed(sl, 2); in speed_store()
632 struct w1_slave *sl = dev_to_w1_slave(dev); in stretch_show() local
633 struct w1_f19_data *data = sl->family_data; in stretch_show()
642 struct w1_slave *sl = dev_to_w1_slave(dev); in stretch_store() local
643 struct w1_f19_data *data = sl->family_data; in stretch_store()
681 static int w1_f19_add_slave(struct w1_slave *sl) in w1_f19_add_slave() argument
686 data = devm_kzalloc(&sl->dev, sizeof(*data), GFP_KERNEL); in w1_f19_add_slave()
689 sl->family_data = data; in w1_f19_add_slave()
694 __w1_f19_set_i2c_speed(sl, 0); in w1_f19_add_slave()
697 __w1_f19_set_i2c_speed(sl, 1); in w1_f19_add_slave()
700 __w1_f19_set_i2c_speed(sl, 2); in w1_f19_add_slave()
721 data->adapter.algo_data = sl; in w1_f19_add_slave()
723 strcat(data->adapter.name, sl->name); in w1_f19_add_slave()
724 data->adapter.dev.parent = &sl->dev; in w1_f19_add_slave()
730 static void w1_f19_remove_slave(struct w1_slave *sl) in w1_f19_remove_slave() argument
732 struct w1_f19_data *family_data = sl->family_data; in w1_f19_remove_slave()
738 devm_kfree(&sl->dev, family_data); in w1_f19_remove_slave()
739 sl->family_data = NULL; in w1_f19_remove_slave()