diff mbox series

[2/2] iio:adc:ti-ads124s08: Fix packet read from the ADC

Message ID 20210121191431.12057-2-dmurphy@ti.com (mailing list archive)
State New, archived
Headers show
Series [1/2] iio:adc:ti-ads124s08: Fix start stop conversion command | expand

Commit Message

Dan Murphy Jan. 21, 2021, 7:14 p.m. UTC
Fix the spi_transfer array in the reading of the data from the ADC.

Fixes: ("e717f8c6dfec iio: adc: Add the TI ads124s08 ADC code")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/iio/adc/ti-ads124s08.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jonathan Cameron Jan. 24, 2021, 3:12 p.m. UTC | #1
On Thu, 21 Jan 2021 13:14:31 -0600
Dan Murphy <dmurphy@ti.com> wrote:

> Fix the spi_transfer array in the reading of the data from the ADC.
> 
> Fixes: ("e717f8c6dfec iio: adc: Add the TI ads124s08 ADC code")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

I'm not really following the changes below..

> ---
>  drivers/iio/adc/ti-ads124s08.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
> index f05d4e0e1c9d..023d81c7e8da 100644
> --- a/drivers/iio/adc/ti-ads124s08.c
> +++ b/drivers/iio/adc/ti-ads124s08.c
> @@ -201,12 +201,10 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
>  	struct spi_transfer t[] = {
>  		{
>  			.tx_buf = &priv->data[0],
> -			.len = 4,
> -			.cs_change = 1,

We should still need to provide a length for this transfer.

>  		}, {
> -			.tx_buf = &priv->data[1],
>  			.rx_buf = &priv->data[1],
>  			.len = 4,
> +			.cs_change = 1,

That's unusual... cs_change being set on the last transfer means
the opposite of what it does for earlier transfers.

https://elixir.bootlin.com/linux/latest/source/include/linux/spi/spi.h#L905

Or is the intent here to provide a performance hint that the device doesn't
care if the cs line goes inactive before stating a new set of transfers?
If so add a comment to say that perhaps.

>  		},
>  	};
>
Dan Murphy Jan. 28, 2021, 2:07 p.m. UTC | #2
Jonathan

On 1/24/21 9:12 AM, Jonathan Cameron wrote:
> On Thu, 21 Jan 2021 13:14:31 -0600
> Dan Murphy <dmurphy@ti.com> wrote:
>
>> Fix the spi_transfer array in the reading of the data from the ADC.
>>
>> Fixes: ("e717f8c6dfec iio: adc: Add the TI ads124s08 ADC code")
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> I'm not really following the changes below..

I will have to dig into it deeper our HW team reported this.

Patch 1/2 is relevant and is not dependent on this patch

Dan
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index f05d4e0e1c9d..023d81c7e8da 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -201,12 +201,10 @@  static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
 	struct spi_transfer t[] = {
 		{
 			.tx_buf = &priv->data[0],
-			.len = 4,
-			.cs_change = 1,
 		}, {
-			.tx_buf = &priv->data[1],
 			.rx_buf = &priv->data[1],
 			.len = 4,
+			.cs_change = 1,
 		},
 	};