Commit dca39af8 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: imu: adis: Add support for SPI transfer cs_change_delay

The ADIS16460 requires a higher delay before the next transfer. Since the
SPI framework supports configuring the delay before the next transfer, this
driver will become the first user of it.

The support for this functionality in ADIS16460 requires an addition to the
ADIS lib to support the `cs_change_delay` functionality from the SPI
subsystem.
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6e4707ed
...@@ -39,18 +39,24 @@ int adis_write_reg(struct adis *adis, unsigned int reg, ...@@ -39,18 +39,24 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->write_delay, .delay_usecs = adis->data->write_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.tx_buf = adis->tx + 2, .tx_buf = adis->tx + 2,
.bits_per_word = 8, .bits_per_word = 8,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->write_delay, .delay_usecs = adis->data->write_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.tx_buf = adis->tx + 4, .tx_buf = adis->tx + 4,
.bits_per_word = 8, .bits_per_word = 8,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->write_delay, .delay_usecs = adis->data->write_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.tx_buf = adis->tx + 6, .tx_buf = adis->tx + 6,
.bits_per_word = 8, .bits_per_word = 8,
...@@ -133,12 +139,16 @@ int adis_read_reg(struct adis *adis, unsigned int reg, ...@@ -133,12 +139,16 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->write_delay, .delay_usecs = adis->data->write_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.tx_buf = adis->tx + 2, .tx_buf = adis->tx + 2,
.bits_per_word = 8, .bits_per_word = 8,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->read_delay, .delay_usecs = adis->data->read_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.tx_buf = adis->tx + 4, .tx_buf = adis->tx + 4,
.rx_buf = adis->rx, .rx_buf = adis->rx,
...@@ -146,6 +156,8 @@ int adis_read_reg(struct adis *adis, unsigned int reg, ...@@ -146,6 +156,8 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
.len = 2, .len = 2,
.cs_change = 1, .cs_change = 1,
.delay_usecs = adis->data->read_delay, .delay_usecs = adis->data->read_delay,
.cs_change_delay = adis->data->cs_change_delay,
.cs_change_delay_unit = SPI_DELAY_UNIT_USECS,
}, { }, {
.rx_buf = adis->rx + 2, .rx_buf = adis->rx + 2,
.bits_per_word = 8, .bits_per_word = 8,
......
...@@ -26,6 +26,7 @@ struct adis_burst; ...@@ -26,6 +26,7 @@ struct adis_burst;
* struct adis_data - ADIS chip variant specific data * struct adis_data - ADIS chip variant specific data
* @read_delay: SPI delay for read operations in us * @read_delay: SPI delay for read operations in us
* @write_delay: SPI delay for write operations in us * @write_delay: SPI delay for write operations in us
* @cs_change_delay: SPI delay between CS changes in us
* @glob_cmd_reg: Register address of the GLOB_CMD register * @glob_cmd_reg: Register address of the GLOB_CMD register
* @msc_ctrl_reg: Register address of the MSC_CTRL register * @msc_ctrl_reg: Register address of the MSC_CTRL register
* @diag_stat_reg: Register address of the DIAG_STAT register * @diag_stat_reg: Register address of the DIAG_STAT register
...@@ -35,6 +36,7 @@ struct adis_burst; ...@@ -35,6 +36,7 @@ struct adis_burst;
struct adis_data { struct adis_data {
unsigned int read_delay; unsigned int read_delay;
unsigned int write_delay; unsigned int write_delay;
unsigned int cs_change_delay;
unsigned int glob_cmd_reg; unsigned int glob_cmd_reg;
unsigned int msc_ctrl_reg; unsigned int msc_ctrl_reg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment