summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/iio/imu/adis_buffer.c12
-rw-r--r--include/linux/iio/imu/adis.h9
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
index df6144285470..ac354321f63a 100644
--- a/drivers/iio/imu/adis_buffer.c
+++ b/drivers/iio/imu/adis_buffer.c
@@ -26,12 +26,10 @@ static int adis_update_scan_mode_burst(struct iio_dev *indio_dev,
unsigned int burst_length, burst_max_length;
u8 *tx;
- /* All but the timestamp channel */
- burst_length = (indio_dev->num_channels - 1) * sizeof(u16);
- burst_length += adis->burst->extra_len + adis->burst_extra_len;
+ burst_length = adis->data->burst_len + adis->burst_extra_len;
- if (adis->burst->burst_max_len)
- burst_max_length = adis->burst->burst_max_len;
+ if (adis->data->burst_max_len)
+ burst_max_length = adis->data->burst_max_len;
else
burst_max_length = burst_length;
@@ -47,7 +45,7 @@ static int adis_update_scan_mode_burst(struct iio_dev *indio_dev,
}
tx = adis->buffer + burst_max_length;
- tx[0] = ADIS_READ_REG(adis->burst->reg_cmd);
+ tx[0] = ADIS_READ_REG(adis->data->burst_reg_cmd);
tx[1] = 0;
adis->xfer[0].tx_buf = tx;
@@ -76,7 +74,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
kfree(adis->xfer);
kfree(adis->buffer);
- if (adis->burst && adis->burst->en)
+ if (adis->data->burst_len)
return adis_update_scan_mode_burst(indio_dev, scan_mask);
scan_count = indio_dev->scan_bytes / 2;
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index 01ba691da2f3..c502ea3b9199 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -51,6 +51,11 @@ struct adis_timeout {
* @timeouts: Chip specific delays
* @enable_irq: Hook for ADIS devices that have a special IRQ enable/disable
* @has_paging: True if ADIS device has paged registers
+ * @burst_reg_cmd: Register command that triggers burst
+ * @burst_len: Burst size in the SPI RX buffer. If @burst_max_len is defined,
+ * this should be the minimum size supported by the device.
+ * @burst_max_len: Holds the maximum burst size when the device supports
+ * more than one burst mode with different sizes
*/
struct adis_data {
unsigned int read_delay;
@@ -75,6 +80,10 @@ struct adis_data {
int (*enable_irq)(struct adis *adis, bool enable);
bool has_paging;
+
+ unsigned int burst_reg_cmd;
+ unsigned int burst_len;
+ unsigned int burst_max_len;
};
/**