Lines Matching refs:pdev

106 	struct ds2482_data	*pdev;  member
148 static inline int ds2482_select_register(struct ds2482_data *pdev, u8 read_ptr) in ds2482_select_register() argument
150 if (pdev->read_prt != read_ptr) { in ds2482_select_register()
151 if (i2c_smbus_write_byte_data(pdev->client, in ds2482_select_register()
156 pdev->read_prt = read_ptr; in ds2482_select_register()
169 static inline int ds2482_send_cmd(struct ds2482_data *pdev, u8 cmd) in ds2482_send_cmd() argument
171 if (i2c_smbus_write_byte(pdev->client, cmd) < 0) in ds2482_send_cmd()
174 pdev->read_prt = DS2482_PTR_CODE_STATUS; in ds2482_send_cmd()
188 static inline int ds2482_send_cmd_data(struct ds2482_data *pdev, in ds2482_send_cmd_data() argument
191 if (i2c_smbus_write_byte_data(pdev->client, cmd, byte) < 0) in ds2482_send_cmd_data()
195 pdev->read_prt = (cmd != DS2482_CMD_WRITE_CONFIG) ? in ds2482_send_cmd_data()
213 static int ds2482_wait_1wire_idle(struct ds2482_data *pdev) in ds2482_wait_1wire_idle() argument
218 if (!ds2482_select_register(pdev, DS2482_PTR_CODE_STATUS)) { in ds2482_wait_1wire_idle()
220 temp = i2c_smbus_read_byte(pdev->client); in ds2482_wait_1wire_idle()
227 __func__, pdev->channel); in ds2482_wait_1wire_idle()
240 static int ds2482_set_channel(struct ds2482_data *pdev, u8 channel) in ds2482_set_channel() argument
242 if (i2c_smbus_write_byte_data(pdev->client, DS2482_CMD_CHANNEL_SELECT, in ds2482_set_channel()
246 pdev->read_prt = DS2482_PTR_CODE_CHANNEL; in ds2482_set_channel()
247 pdev->channel = -1; in ds2482_set_channel()
248 if (i2c_smbus_read_byte(pdev->client) == ds2482_chan_rd[channel]) { in ds2482_set_channel()
249 pdev->channel = channel; in ds2482_set_channel()
266 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_touch_bit() local
269 mutex_lock(&pdev->access_lock); in ds2482_w1_touch_bit()
272 ds2482_wait_1wire_idle(pdev); in ds2482_w1_touch_bit()
273 if (pdev->w1_count > 1) in ds2482_w1_touch_bit()
274 ds2482_set_channel(pdev, pchan->channel); in ds2482_w1_touch_bit()
277 if (!ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_SINGLE_BIT, in ds2482_w1_touch_bit()
279 status = ds2482_wait_1wire_idle(pdev); in ds2482_w1_touch_bit()
281 mutex_unlock(&pdev->access_lock); in ds2482_w1_touch_bit()
298 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_triplet() local
301 mutex_lock(&pdev->access_lock); in ds2482_w1_triplet()
304 ds2482_wait_1wire_idle(pdev); in ds2482_w1_triplet()
305 if (pdev->w1_count > 1) in ds2482_w1_triplet()
306 ds2482_set_channel(pdev, pchan->channel); in ds2482_w1_triplet()
309 if (!ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_TRIPLET, in ds2482_w1_triplet()
311 status = ds2482_wait_1wire_idle(pdev); in ds2482_w1_triplet()
313 mutex_unlock(&pdev->access_lock); in ds2482_w1_triplet()
328 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_write_byte() local
330 mutex_lock(&pdev->access_lock); in ds2482_w1_write_byte()
333 ds2482_wait_1wire_idle(pdev); in ds2482_w1_write_byte()
334 if (pdev->w1_count > 1) in ds2482_w1_write_byte()
335 ds2482_set_channel(pdev, pchan->channel); in ds2482_w1_write_byte()
338 ds2482_send_cmd_data(pdev, DS2482_CMD_1WIRE_WRITE_BYTE, byte); in ds2482_w1_write_byte()
340 mutex_unlock(&pdev->access_lock); in ds2482_w1_write_byte()
352 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_read_byte() local
355 mutex_lock(&pdev->access_lock); in ds2482_w1_read_byte()
358 ds2482_wait_1wire_idle(pdev); in ds2482_w1_read_byte()
359 if (pdev->w1_count > 1) in ds2482_w1_read_byte()
360 ds2482_set_channel(pdev, pchan->channel); in ds2482_w1_read_byte()
363 ds2482_send_cmd(pdev, DS2482_CMD_1WIRE_READ_BYTE); in ds2482_w1_read_byte()
366 ds2482_wait_1wire_idle(pdev); in ds2482_w1_read_byte()
369 ds2482_select_register(pdev, DS2482_PTR_CODE_DATA); in ds2482_w1_read_byte()
372 result = i2c_smbus_read_byte(pdev->client); in ds2482_w1_read_byte()
374 mutex_unlock(&pdev->access_lock); in ds2482_w1_read_byte()
389 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_reset_bus() local
393 mutex_lock(&pdev->access_lock); in ds2482_w1_reset_bus()
396 ds2482_wait_1wire_idle(pdev); in ds2482_w1_reset_bus()
397 if (pdev->w1_count > 1) in ds2482_w1_reset_bus()
398 ds2482_set_channel(pdev, pchan->channel); in ds2482_w1_reset_bus()
401 err = ds2482_send_cmd(pdev, DS2482_CMD_1WIRE_RESET); in ds2482_w1_reset_bus()
404 err = ds2482_wait_1wire_idle(pdev); in ds2482_w1_reset_bus()
409 ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG, in ds2482_w1_reset_bus()
413 mutex_unlock(&pdev->access_lock); in ds2482_w1_reset_bus()
421 struct ds2482_data *pdev = pchan->pdev; in ds2482_w1_set_pullup() local
433 ds2482_wait_1wire_idle(pdev); in ds2482_w1_set_pullup()
435 retval = ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG, in ds2482_w1_set_pullup()
438 ds2482_wait_1wire_idle(pdev); in ds2482_w1_set_pullup()
496 data->w1_ch[idx].pdev = data; in ds2482_probe()
510 data->w1_ch[idx].pdev = NULL; in ds2482_probe()
519 if (data->w1_ch[idx].pdev != NULL) in ds2482_probe()
535 if (data->w1_ch[idx].pdev != NULL) in ds2482_remove()