diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2019-03-22 22:44:39 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-04-04 20:20:24 +0100 |
commit | 5075e0720d93a84e059759c5d8c6a78613d0face (patch) | |
tree | ecdea898d086f2bcf97cab74966cb5cb6b26c6c5 /include | |
parent | 74878d4fa816443716bd8adf4f9f6986f5c6f256 (diff) |
iio: imu: adis: generalize burst mode support
Some variants in the ADIS16400 family support burst mode. This mechanism is
implemented in the `adis16400_buffer.c` file.
Some variants in ADIS16480 are also adding burst mode, which is
functionally similar to ADIS16400, but with different parameters. To get
there, a `adis_burst` struct is added to parametrize certain bits of the
SPI communication to setup: the register that triggers burst-mode, and the
extra-data-length that needs be accounted for when building the bust-length
buffer.
The trigger handler cannot be made generic, since it's very specific to
each ADIS164XX family.
A future enhancement of this `adis_burst` mode will be the possibility to
enable/disable burst-mode. For the ADIS16400 family it's hard-coded to on
by default. But for ADIS16480 there will be a need to disable this.
When that will be implemented, both ADIS16400 & ADIS16480 will have the
burst-mode enable-able/disable-able.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/iio/imu/adis.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 360da7d18a3d..469a493f7ae0 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -21,6 +21,7 @@ #define ADIS_REG_PAGE_ID 0x00 struct adis; +struct adis_burst; /** * struct adis_data - ADIS chip variant specific data @@ -57,6 +58,7 @@ struct adis { struct iio_trigger *trig; const struct adis_data *data; + struct adis_burst *burst; struct mutex txrx_lock; struct spi_message msg; @@ -232,6 +234,18 @@ int adis_single_conversion(struct iio_dev *indio_dev, #ifdef CONFIG_IIO_ADIS_LIB_BUFFER +/** + * struct adis_burst - ADIS data for burst transfers + * @en burst mode enabled + * @reg_cmd register command that triggers burst + * @extra_len extra length to account in the SPI RX buffer + */ +struct adis_burst { + bool en; + unsigned int reg_cmd; + unsigned int extra_len; +}; + int adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *)); void adis_cleanup_buffer_and_trigger(struct adis *adis, |