Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7944: drop bits_per_word hack
@ 2025-03-31 19:29 David Lechner
  2025-04-01  9:11 ` Nuno Sá
  0 siblings, 1 reply; 3+ messages in thread
From: David Lechner @ 2025-03-31 19:29 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Michael Hennerich, Nuno Sá, linux-kernel, David Lechner

Remove setting bits_per_word in SPI xfers without data. The shortcoming
that this was working around was fixed in the SPI controller driver, so
it is no longer necessary. And we don't need this to be cargo-culted to
new drivers.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7944.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/iio/adc/ad7944.c b/drivers/iio/adc/ad7944.c
index 2f949fe5587318957f2e423029294ced0a6f803d..70f313545af2393a625ae2ec3c2cff2e29153ffb 100644
--- a/drivers/iio/adc/ad7944.c
+++ b/drivers/iio/adc/ad7944.c
@@ -189,11 +189,6 @@ static int ad7944_3wire_cs_mode_init_msg(struct device *dev, struct ad7944_adc *
 						   : adc->timing_spec->conv_ns;
 	struct spi_transfer *xfers = adc->xfers;
 
-	/*
-	 * NB: can get better performance from some SPI controllers if we use
-	 * the same bits_per_word in every transfer.
-	 */
-	xfers[0].bits_per_word = chan->scan_type.realbits;
 	/*
 	 * CS is tied to CNV and we need a low to high transition to start the
 	 * conversion, so place CNV low for t_QUIET to prepare for this.
@@ -208,7 +203,6 @@ static int ad7944_3wire_cs_mode_init_msg(struct device *dev, struct ad7944_adc *
 	xfers[1].cs_off = 1;
 	xfers[1].delay.value = t_conv_ns;
 	xfers[1].delay.unit = SPI_DELAY_UNIT_NSECS;
-	xfers[1].bits_per_word = chan->scan_type.realbits;
 
 	/* Then we can read the data during the acquisition phase */
 	xfers[2].rx_buf = &adc->sample.raw;
@@ -227,11 +221,6 @@ static int ad7944_4wire_mode_init_msg(struct device *dev, struct ad7944_adc *adc
 						   : adc->timing_spec->conv_ns;
 	struct spi_transfer *xfers = adc->xfers;
 
-	/*
-	 * NB: can get better performance from some SPI controllers if we use
-	 * the same bits_per_word in every transfer.
-	 */
-	xfers[0].bits_per_word = chan->scan_type.realbits;
 	/*
 	 * CS has to be high for full conversion time to avoid triggering the
 	 * busy indication.

---
base-commit: f8ffc92ae9052e6615896052f0c5b808bfc17520
change-id: 20250331-iio-adc-ad7944-drop-bits_per_word-hack-a71b2d51fa3f

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ad7944: drop bits_per_word hack
  2025-03-31 19:29 [PATCH] iio: adc: ad7944: drop bits_per_word hack David Lechner
@ 2025-04-01  9:11 ` Nuno Sá
  2025-04-05 17:39   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Nuno Sá @ 2025-04-01  9:11 UTC (permalink / raw)
  To: David Lechner, Jonathan Cameron, linux-iio
  Cc: Michael Hennerich, Nuno Sá, linux-kernel

On Mon, 2025-03-31 at 14:29 -0500, David Lechner wrote:
> Remove setting bits_per_word in SPI xfers without data. The shortcoming
> that this was working around was fixed in the SPI controller driver, so
> it is no longer necessary. And we don't need this to be cargo-culted to
> new drivers.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7944.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7944.c b/drivers/iio/adc/ad7944.c
> index
> 2f949fe5587318957f2e423029294ced0a6f803d..70f313545af2393a625ae2ec3c2cff2e2915
> 3ffb 100644
> --- a/drivers/iio/adc/ad7944.c
> +++ b/drivers/iio/adc/ad7944.c
> @@ -189,11 +189,6 @@ static int ad7944_3wire_cs_mode_init_msg(struct device
> *dev, struct ad7944_adc *
>  						   : adc->timing_spec-
> >conv_ns;
>  	struct spi_transfer *xfers = adc->xfers;
>  
> -	/*
> -	 * NB: can get better performance from some SPI controllers if we use
> -	 * the same bits_per_word in every transfer.
> -	 */
> -	xfers[0].bits_per_word = chan->scan_type.realbits;
>  	/*
>  	 * CS is tied to CNV and we need a low to high transition to start
> the
>  	 * conversion, so place CNV low for t_QUIET to prepare for this.
> @@ -208,7 +203,6 @@ static int ad7944_3wire_cs_mode_init_msg(struct device
> *dev, struct ad7944_adc *
>  	xfers[1].cs_off = 1;
>  	xfers[1].delay.value = t_conv_ns;
>  	xfers[1].delay.unit = SPI_DELAY_UNIT_NSECS;
> -	xfers[1].bits_per_word = chan->scan_type.realbits;
>  
>  	/* Then we can read the data during the acquisition phase */
>  	xfers[2].rx_buf = &adc->sample.raw;
> @@ -227,11 +221,6 @@ static int ad7944_4wire_mode_init_msg(struct device *dev,
> struct ad7944_adc *adc
>  						   : adc->timing_spec-
> >conv_ns;
>  	struct spi_transfer *xfers = adc->xfers;
>  
> -	/*
> -	 * NB: can get better performance from some SPI controllers if we use
> -	 * the same bits_per_word in every transfer.
> -	 */
> -	xfers[0].bits_per_word = chan->scan_type.realbits;
>  	/*
>  	 * CS has to be high for full conversion time to avoid triggering the
>  	 * busy indication.
> 
> ---
> base-commit: f8ffc92ae9052e6615896052f0c5b808bfc17520
> change-id: 20250331-iio-adc-ad7944-drop-bits_per_word-hack-a71b2d51fa3f
> 
> Best regards,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: ad7944: drop bits_per_word hack
  2025-04-01  9:11 ` Nuno Sá
@ 2025-04-05 17:39   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-04-05 17:39 UTC (permalink / raw)
  To: Nuno Sá
  Cc: David Lechner, linux-iio, Michael Hennerich, Nuno Sá,
	linux-kernel

On Tue, 01 Apr 2025 10:11:40 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Mon, 2025-03-31 at 14:29 -0500, David Lechner wrote:
> > Remove setting bits_per_word in SPI xfers without data. The shortcoming
> > that this was working around was fixed in the SPI controller driver, so
> > it is no longer necessary. And we don't need this to be cargo-culted to
> > new drivers.
> > 
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-05 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 19:29 [PATCH] iio: adc: ad7944: drop bits_per_word hack David Lechner
2025-04-01  9:11 ` Nuno Sá
2025-04-05 17:39   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox