Lines Matching refs:adis
25 struct adis *adis = iio_device_get_drvdata(indio_dev); in adis_update_scan_mode_burst() local
29 burst_length = adis->data->burst_len + adis->burst_extra_len; in adis_update_scan_mode_burst()
31 if (adis->data->burst_max_len) in adis_update_scan_mode_burst()
32 burst_max_length = adis->data->burst_max_len; in adis_update_scan_mode_burst()
36 adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL); in adis_update_scan_mode_burst()
37 if (!adis->xfer) in adis_update_scan_mode_burst()
40 adis->buffer = kzalloc(burst_max_length + sizeof(u16), GFP_KERNEL); in adis_update_scan_mode_burst()
41 if (!adis->buffer) { in adis_update_scan_mode_burst()
42 kfree(adis->xfer); in adis_update_scan_mode_burst()
43 adis->xfer = NULL; in adis_update_scan_mode_burst()
47 tx = adis->buffer + burst_max_length; in adis_update_scan_mode_burst()
48 tx[0] = ADIS_READ_REG(adis->data->burst_reg_cmd); in adis_update_scan_mode_burst()
51 adis->xfer[0].tx_buf = tx; in adis_update_scan_mode_burst()
52 adis->xfer[0].bits_per_word = 8; in adis_update_scan_mode_burst()
53 adis->xfer[0].len = 2; in adis_update_scan_mode_burst()
54 adis->xfer[1].rx_buf = adis->buffer; in adis_update_scan_mode_burst()
55 adis->xfer[1].bits_per_word = 8; in adis_update_scan_mode_burst()
56 adis->xfer[1].len = burst_length; in adis_update_scan_mode_burst()
58 spi_message_init(&adis->msg); in adis_update_scan_mode_burst()
59 spi_message_add_tail(&adis->xfer[0], &adis->msg); in adis_update_scan_mode_burst()
60 spi_message_add_tail(&adis->xfer[1], &adis->msg); in adis_update_scan_mode_burst()
68 struct adis *adis = iio_device_get_drvdata(indio_dev); in adis_update_scan_mode() local
74 kfree(adis->xfer); in adis_update_scan_mode()
75 kfree(adis->buffer); in adis_update_scan_mode()
77 if (adis->data->burst_len) in adis_update_scan_mode()
82 adis->xfer = kcalloc(scan_count + 1, sizeof(*adis->xfer), GFP_KERNEL); in adis_update_scan_mode()
83 if (!adis->xfer) in adis_update_scan_mode()
86 adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL); in adis_update_scan_mode()
87 if (!adis->buffer) { in adis_update_scan_mode()
88 kfree(adis->xfer); in adis_update_scan_mode()
89 adis->xfer = NULL; in adis_update_scan_mode()
93 rx = adis->buffer; in adis_update_scan_mode()
96 spi_message_init(&adis->msg); in adis_update_scan_mode()
99 adis->xfer[j].bits_per_word = 8; in adis_update_scan_mode()
101 adis->xfer[j].cs_change = 1; in adis_update_scan_mode()
102 adis->xfer[j].len = 2; in adis_update_scan_mode()
103 adis->xfer[j].delay.value = adis->data->read_delay; in adis_update_scan_mode()
104 adis->xfer[j].delay.unit = SPI_DELAY_UNIT_USECS; in adis_update_scan_mode()
106 adis->xfer[j].tx_buf = &tx[j]; in adis_update_scan_mode()
108 adis->xfer[j].rx_buf = &rx[j - 1]; in adis_update_scan_mode()
109 spi_message_add_tail(&adis->xfer[j], &adis->msg); in adis_update_scan_mode()
129 struct adis *adis = iio_device_get_drvdata(indio_dev); in adis_trigger_handler() local
132 if (adis->data->has_paging) { in adis_trigger_handler()
133 mutex_lock(&adis->state_lock); in adis_trigger_handler()
134 if (adis->current_page != 0) { in adis_trigger_handler()
135 adis->tx[0] = ADIS_WRITE_REG(ADIS_REG_PAGE_ID); in adis_trigger_handler()
136 adis->tx[1] = 0; in adis_trigger_handler()
137 spi_write(adis->spi, adis->tx, 2); in adis_trigger_handler()
141 ret = spi_sync(adis->spi, &adis->msg); in adis_trigger_handler()
143 dev_err(&adis->spi->dev, "Failed to read data: %d", ret); in adis_trigger_handler()
146 if (adis->data->has_paging) { in adis_trigger_handler()
147 adis->current_page = 0; in adis_trigger_handler()
148 mutex_unlock(&adis->state_lock); in adis_trigger_handler()
151 iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer, in adis_trigger_handler()
161 struct adis *adis = arg; in adis_buffer_cleanup() local
163 kfree(adis->buffer); in adis_buffer_cleanup()
164 kfree(adis->xfer); in adis_buffer_cleanup()
182 devm_adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, in devm_adis_setup_buffer_and_trigger() argument
190 ret = devm_iio_triggered_buffer_setup(&adis->spi->dev, indio_dev, in devm_adis_setup_buffer_and_trigger()
196 if (adis->spi->irq) { in devm_adis_setup_buffer_and_trigger()
197 ret = devm_adis_probe_trigger(adis, indio_dev); in devm_adis_setup_buffer_and_trigger()
202 return devm_add_action_or_reset(&adis->spi->dev, adis_buffer_cleanup, in devm_adis_setup_buffer_and_trigger()
203 adis); in devm_adis_setup_buffer_and_trigger()