Lines Matching full:sl

61 static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf)  in w1_ds2438_get_page()  argument
69 if (w1_reset_select_slave(sl)) in w1_ds2438_get_page()
73 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_get_page()
75 if (w1_reset_select_slave(sl)) in w1_ds2438_get_page()
79 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_get_page()
81 count = w1_read_block(sl->master, buf, DS2438_PAGE_SIZE + 1); in w1_ds2438_get_page()
93 static int w1_ds2438_get_temperature(struct w1_slave *sl, int16_t *temperature) in w1_ds2438_get_temperature() argument
101 mutex_lock(&sl->master->bus_mutex); in w1_ds2438_get_temperature()
104 if (w1_reset_select_slave(sl)) in w1_ds2438_get_temperature()
106 w1_write_8(sl->master, W1_DS2438_CONVERT_TEMP); in w1_ds2438_get_temperature()
108 mutex_unlock(&sl->master->bus_mutex); in w1_ds2438_get_temperature()
115 if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { in w1_ds2438_get_temperature()
123 if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { in w1_ds2438_get_temperature()
129 mutex_unlock(&sl->master->bus_mutex); in w1_ds2438_get_temperature()
135 static int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) in w1_ds2438_change_config_bit() argument
143 if (w1_reset_select_slave(sl)) in w1_ds2438_change_config_bit()
147 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_change_config_bit()
149 if (w1_reset_select_slave(sl)) in w1_ds2438_change_config_bit()
153 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_change_config_bit()
156 status = w1_read_8(sl->master); in w1_ds2438_change_config_bit()
175 if (w1_reset_select_slave(sl)) in w1_ds2438_change_config_bit()
180 w1_write_block(sl->master, w1_buf, 3); in w1_ds2438_change_config_bit()
182 if (w1_reset_select_slave(sl)) in w1_ds2438_change_config_bit()
186 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_change_config_bit()
194 static int w1_ds2438_change_offset_register(struct w1_slave *sl, u8 *value) in w1_ds2438_change_offset_register() argument
200 if (w1_ds2438_get_page(sl, 1, w1_page1_buf) == 0) { in w1_ds2438_change_offset_register()
205 if (w1_reset_select_slave(sl)) in w1_ds2438_change_offset_register()
209 w1_write_block(sl->master, w1_buf, 9); in w1_ds2438_change_offset_register()
211 if (w1_reset_select_slave(sl)) in w1_ds2438_change_offset_register()
215 w1_write_block(sl->master, w1_buf, 2); in w1_ds2438_change_offset_register()
222 static int w1_ds2438_get_voltage(struct w1_slave *sl, in w1_ds2438_get_voltage() argument
231 mutex_lock(&sl->master->bus_mutex); in w1_ds2438_get_voltage()
233 if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_AD, adc_input)) { in w1_ds2438_get_voltage()
239 if (w1_reset_select_slave(sl)) in w1_ds2438_get_voltage()
241 w1_write_8(sl->master, W1_DS2438_CONVERT_VOLTAGE); in w1_ds2438_get_voltage()
243 mutex_unlock(&sl->master->bus_mutex); in w1_ds2438_get_voltage()
250 if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { in w1_ds2438_get_voltage()
258 if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { in w1_ds2438_get_voltage()
265 mutex_unlock(&sl->master->bus_mutex); in w1_ds2438_get_voltage()
271 static int w1_ds2438_get_current(struct w1_slave *sl, int16_t *voltage) in w1_ds2438_get_current() argument
276 mutex_lock(&sl->master->bus_mutex); in w1_ds2438_get_current()
278 if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { in w1_ds2438_get_current()
285 mutex_unlock(&sl->master->bus_mutex); in w1_ds2438_get_current()
294 struct w1_slave *sl = kobj_to_w1_slave(kobj); in iad_write() local
300 mutex_lock(&sl->master->bus_mutex); in iad_write()
302 if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_IAD, *buf & 0x01) == 0) in iad_write()
307 mutex_unlock(&sl->master->bus_mutex); in iad_write()
316 struct w1_slave *sl = kobj_to_w1_slave(kobj); in iad_read() local
325 if (w1_ds2438_get_current(sl, &voltage) == 0) in iad_read()
337 struct w1_slave *sl = kobj_to_w1_slave(kobj); in page0_read() local
346 mutex_lock(&sl->master->bus_mutex); in page0_read()
352 if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { in page0_read()
358 mutex_unlock(&sl->master->bus_mutex); in page0_read()
367 struct w1_slave *sl = kobj_to_w1_slave(kobj); in page1_read() local
376 mutex_lock(&sl->master->bus_mutex); in page1_read()
382 if (w1_ds2438_get_page(sl, 1, w1_buf) == 0) { in page1_read()
388 mutex_unlock(&sl->master->bus_mutex); in page1_read()
397 struct w1_slave *sl = kobj_to_w1_slave(kobj); in offset_write() local
400 mutex_lock(&sl->master->bus_mutex); in offset_write()
402 if (w1_ds2438_change_offset_register(sl, buf) == 0) in offset_write()
407 mutex_unlock(&sl->master->bus_mutex); in offset_write()
416 struct w1_slave *sl = kobj_to_w1_slave(kobj); in temperature_read() local
425 if (w1_ds2438_get_temperature(sl, &temp) == 0) in temperature_read()
437 struct w1_slave *sl = kobj_to_w1_slave(kobj); in vad_read() local
446 if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, &voltage) == 0) in vad_read()
458 struct w1_slave *sl = kobj_to_w1_slave(kobj); in vdd_read() local
467 if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, &voltage) == 0) in vdd_read()