* [PATCH 0/3] iio: imu: adis: Use spi cs inactive delay
@ 2023-10-23 12:35 Ramona Gradinariu
2023-10-23 12:35 ` [PATCH 1/3] " Ramona Gradinariu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Ramona Gradinariu @ 2023-10-23 12:35 UTC (permalink / raw)
To: jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt,
linux-iio, linux-kernel, devicetree
Cc: Ramona Gradinariu
A delay is needed each time the chip selected becomes inactive,
even after burst data readings are performed.
Currently, there is no delay added after a burst reading
and in case a new SPI transfer is performed before
the needed delay, the adis device becomes unresponsive until
reset.
First patch adds the spi cs inactive delay in case it is not set and removes
the additional chip select change delay present in adis APIs (to avoid a
double delay).
Second and third patch updates dt-bindings for the drivers which are affected
by the first patch.
Ramona Gradinariu (3):
iio: imu: adis: Use spi cs inactive delay
dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property
dt-bindings: adis16460: Add 'spi-cs-inactive-delay-ns' property
.../bindings/iio/imu/adi,adis16460.yaml | 5 +++++
.../bindings/iio/imu/adi,adis16475.yaml | 5 +++++
drivers/iio/imu/adis.c | 18 ++++++------------
3 files changed, 16 insertions(+), 12 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/3] iio: imu: adis: Use spi cs inactive delay 2023-10-23 12:35 [PATCH 0/3] iio: imu: adis: Use spi cs inactive delay Ramona Gradinariu @ 2023-10-23 12:35 ` Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 3/3] dt-bindings: adis16460: " Ramona Gradinariu 2 siblings, 0 replies; 8+ messages in thread From: Ramona Gradinariu @ 2023-10-23 12:35 UTC (permalink / raw) To: jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree Cc: Ramona Gradinariu A delay is needed each time the chip selected becomes inactive, even after burst data readings are performed. Currently, there is no delay added after a burst reading and in case a new SPI transfer is performed before the needed delay, the adis device becomes unresponsive until reset. This commit is adding the needed delay directly to the spi driver, using the cs_inactive parameter, in case it is not set and is removing the additional chip select change delay present in adis APIs to remove the double delay. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> --- drivers/iio/imu/adis.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index bc40240b29e2..495caf4ce87a 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -44,8 +44,6 @@ int __adis_write_reg(struct adis *adis, unsigned int reg, unsigned int value, .cs_change = 1, .delay.value = adis->data->write_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, @@ -53,8 +51,6 @@ int __adis_write_reg(struct adis *adis, unsigned int reg, unsigned int value, .cs_change = 1, .delay.value = adis->data->write_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 4, .bits_per_word = 8, @@ -62,8 +58,6 @@ int __adis_write_reg(struct adis *adis, unsigned int reg, unsigned int value, .cs_change = 1, .delay.value = adis->data->write_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 6, .bits_per_word = 8, @@ -144,8 +138,6 @@ int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, .cs_change = 1, .delay.value = adis->data->write_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, @@ -153,8 +145,6 @@ int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, .cs_change = 1, .delay.value = adis->data->read_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 4, .rx_buf = adis->rx, @@ -163,8 +153,6 @@ int __adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, .cs_change = 1, .delay.value = adis->data->read_delay, .delay.unit = SPI_DELAY_UNIT_USECS, - .cs_change_delay.value = adis->data->cs_change_delay, - .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .rx_buf = adis->rx + 2, .bits_per_word = 8, @@ -524,6 +512,12 @@ int adis_init(struct adis *adis, struct iio_dev *indio_dev, } mutex_init(&adis->state_lock); + + if (!spi->cs_inactive.value) { + spi->cs_inactive.value = data->cs_change_delay; + spi->cs_inactive.unit = SPI_DELAY_UNIT_USECS; + } + adis->spi = spi; adis->data = data; iio_device_set_drvdata(indio_dev, adis); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property 2023-10-23 12:35 [PATCH 0/3] iio: imu: adis: Use spi cs inactive delay Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 1/3] " Ramona Gradinariu @ 2023-10-23 12:35 ` Ramona Gradinariu 2023-10-23 13:21 ` Krzysztof Kozlowski 2023-10-23 12:35 ` [PATCH 3/3] dt-bindings: adis16460: " Ramona Gradinariu 2 siblings, 1 reply; 8+ messages in thread From: Ramona Gradinariu @ 2023-10-23 12:35 UTC (permalink / raw) To: jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree Cc: Ramona Gradinariu Add 'spi-cs-inactive-delay-ns' property. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> --- Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml index c73533c54588..f01bf0ada0e8 100644 --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml @@ -47,6 +47,11 @@ properties: spi-max-frequency: maximum: 2000000 + spi-cs-inactive-delay-ns: + minimum: 16000 + description: + If not explicitly set in the device tree, the driver will set it to 16us. + interrupts: maxItems: 1 -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property 2023-10-23 12:35 ` [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property Ramona Gradinariu @ 2023-10-23 13:21 ` Krzysztof Kozlowski 0 siblings, 0 replies; 8+ messages in thread From: Krzysztof Kozlowski @ 2023-10-23 13:21 UTC (permalink / raw) To: Ramona Gradinariu, jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree On 23/10/2023 14:35, Ramona Gradinariu wrote: > Add 'spi-cs-inactive-delay-ns' property. > > Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> > --- > Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > index c73533c54588..f01bf0ada0e8 100644 > --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > @@ -47,6 +47,11 @@ properties: > spi-max-frequency: > maximum: 2000000 > > + spi-cs-inactive-delay-ns: > + minimum: 16000 > + description: > + If not explicitly set in the device tree, the driver will set it to 16us. Drop description, it's redundant/useless. Instead: default: 16000 Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] dt-bindings: adis16460: Add 'spi-cs-inactive-delay-ns' property 2023-10-23 12:35 [PATCH 0/3] iio: imu: adis: Use spi cs inactive delay Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 1/3] " Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property Ramona Gradinariu @ 2023-10-23 12:35 ` Ramona Gradinariu 2023-10-23 13:22 ` Krzysztof Kozlowski 2 siblings, 1 reply; 8+ messages in thread From: Ramona Gradinariu @ 2023-10-23 12:35 UTC (permalink / raw) To: jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree Cc: Ramona Gradinariu Add 'spi-cs-inactive-delay-ns' property. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> --- Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml index 4e43c80e5119..3691c0be4f9d 100644 --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml @@ -25,6 +25,11 @@ properties: spi-cpol: true + spi-cs-inactive-delay-ns: + minimum: 16000 + description: + If not explicitly set in the device tree, the driver will set it to 16us. + interrupts: maxItems: 1 -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: adis16460: Add 'spi-cs-inactive-delay-ns' property 2023-10-23 12:35 ` [PATCH 3/3] dt-bindings: adis16460: " Ramona Gradinariu @ 2023-10-23 13:22 ` Krzysztof Kozlowski 2023-10-24 12:27 ` Jonathan Cameron 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2023-10-23 13:22 UTC (permalink / raw) To: Ramona Gradinariu, jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree On 23/10/2023 14:35, Ramona Gradinariu wrote: > Add 'spi-cs-inactive-delay-ns' property. This we see from the diff. Commit should explain: Why? > > Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> > --- > Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > index 4e43c80e5119..3691c0be4f9d 100644 > --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > @@ -25,6 +25,11 @@ properties: > > spi-cpol: true > > + spi-cs-inactive-delay-ns: > + minimum: 16000 > + description: > + If not explicitly set in the device tree, the driver will set it to 16us. Why do you even need it here? Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: adis16460: Add 'spi-cs-inactive-delay-ns' property 2023-10-23 13:22 ` Krzysztof Kozlowski @ 2023-10-24 12:27 ` Jonathan Cameron 2023-10-27 13:57 ` Jonathan Cameron 0 siblings, 1 reply; 8+ messages in thread From: Jonathan Cameron @ 2023-10-24 12:27 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Ramona Gradinariu, jic23, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree On Mon, 23 Oct 2023 15:22:30 +0200 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > On 23/10/2023 14:35, Ramona Gradinariu wrote: > > Add 'spi-cs-inactive-delay-ns' property. > > This we see from the diff. Commit should explain: Why? > > > > > Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> > > --- > > Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > index 4e43c80e5119..3691c0be4f9d 100644 > > --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > @@ -25,6 +25,11 @@ properties: > > > > spi-cpol: true > > > > + spi-cs-inactive-delay-ns: > > + minimum: 16000 > > + description: > > + If not explicitly set in the device tree, the driver will set it to 16us. > > Why do you even need it here? Along side that, if you have a default default: xxxx rather than in the description. > > Best regards, > Krzysztof > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: adis16460: Add 'spi-cs-inactive-delay-ns' property 2023-10-24 12:27 ` Jonathan Cameron @ 2023-10-27 13:57 ` Jonathan Cameron 0 siblings, 0 replies; 8+ messages in thread From: Jonathan Cameron @ 2023-10-27 13:57 UTC (permalink / raw) To: Jonathan Cameron Cc: Krzysztof Kozlowski, Ramona Gradinariu, nuno.sa, robh+dt, krzysztof.kozlowski+dt, conor+dt, linux-iio, linux-kernel, devicetree On Tue, 24 Oct 2023 13:27:05 +0100 Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote: > On Mon, 23 Oct 2023 15:22:30 +0200 > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > > On 23/10/2023 14:35, Ramona Gradinariu wrote: > > > Add 'spi-cs-inactive-delay-ns' property. > > > > This we see from the diff. Commit should explain: Why? > > > > > > > > Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com> > > > --- > > > Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > > index 4e43c80e5119..3691c0be4f9d 100644 > > > --- a/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16460.yaml > > > @@ -25,6 +25,11 @@ properties: > > > > > > spi-cpol: true > > > > > > + spi-cs-inactive-delay-ns: > > > + minimum: 16000 > > > + description: > > > + If not explicitly set in the device tree, the driver will set it to 16us. > > > > Why do you even need it here? > > Along side that, if you have a default > default: xxxx > rather than in the description. ah. I didn't get Krzysztof's reply to patch 1 for some reason where he already said this... Anyhow, I've nothing to add to comments on v2. Will aim to pick up v3. > > > > > > Best regards, > > Krzysztof > > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-27 13:58 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-23 12:35 [PATCH 0/3] iio: imu: adis: Use spi cs inactive delay Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 1/3] " Ramona Gradinariu 2023-10-23 12:35 ` [PATCH 2/3] dt-bindings: adis16475: Add 'spi-cs-inactive-delay-ns' property Ramona Gradinariu 2023-10-23 13:21 ` Krzysztof Kozlowski 2023-10-23 12:35 ` [PATCH 3/3] dt-bindings: adis16460: " Ramona Gradinariu 2023-10-23 13:22 ` Krzysztof Kozlowski 2023-10-24 12:27 ` Jonathan Cameron 2023-10-27 13:57 ` Jonathan Cameron
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).