diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-11-20 13:36:00 +0000 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-11-20 21:26:37 +0000 |
commit | 484a0bf091c93c379e6524a17bb037c33c898e01 (patch) | |
tree | b84cf4f38c21825bcfdcba02a23f5216680c69fb /include/linux/iio | |
parent | 9caed0d9d6db12cb6d81ba68d5bc98432d6b4711 (diff) |
iio:imu:adis: Add paging support
Some of the newer generation devices from the ADIS16XXX series have more
registers than what can be supported with the current register addressing
scheme. These devices implement register paging to support a larger register
range. Each page is 128 registers large and the currently active page can be
selected via register 0x00 in each page. This patch implements transparent
paging inside the common adis library. The register read/write interface stays
the same and when a register is accessed the library automatically switches to
the correct page if it is not already selected. The page number is encoded in
the upper bits of the register number, e.g. register 0x5 of page 1 is 0x85.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio')
-rw-r--r-- | include/linux/iio/imu/adis.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 6402a08c0e6..e82cd0827e9 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -14,8 +14,11 @@ #include <linux/interrupt.h> #include <linux/iio/types.h> -#define ADIS_WRITE_REG(reg) (0x80 | (reg)) -#define ADIS_READ_REG(reg) (reg) +#define ADIS_WRITE_REG(reg) ((0x80 | (reg))) +#define ADIS_READ_REG(reg) ((reg) & 0x7f) + +#define ADIS_PAGE_SIZE 0x80 +#define ADIS_REG_PAGE_ID 0x00 /** * struct adis_data - ADIS chip variant specific data @@ -40,6 +43,8 @@ struct adis_data { const char * const *status_error_msgs; unsigned int status_error_mask; + + bool has_paging; }; struct adis { @@ -51,6 +56,7 @@ struct adis { struct mutex txrx_lock; struct spi_message msg; struct spi_transfer *xfer; + unsigned int current_page; void *buffer; uint8_t tx[10] ____cacheline_aligned; |