mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad7192: fix channel select
@ 2025-01-24 11:37 Markus Burri
  2025-01-24 12:32 ` Nuno Sá
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Burri @ 2025-01-24 11:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Markus Burri, Lars-Peter Clausen, Michael Hennerich,
	Alisa-Dariana Roman, Jonathan Cameron, linux-iio

Channel configuration doesn't work as expected.
For FIELD_PREP the bit mask is needed and not the bit number.

Signed-off-by: Markus Burri <markus.burri@mt.com>
---
 drivers/iio/adc/ad7192.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 1c87db0e0460..c4effe8429c8 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -1082,7 +1082,7 @@ static int ad7192_update_scan_mode(struct iio_dev *indio_dev, const unsigned lon
 
 	conf &= ~AD7192_CONF_CHAN_MASK;
 	for_each_set_bit(i, scan_mask, 8)
-		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i);
+		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i));
 
 	ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf);
 	if (ret < 0)

base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
-- 
2.39.5


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

* Re: [PATCH] iio: adc: ad7192: fix channel select
  2025-01-24 11:37 [PATCH] iio: adc: ad7192: fix channel select Markus Burri
@ 2025-01-24 12:32 ` Nuno Sá
  0 siblings, 0 replies; 2+ messages in thread
From: Nuno Sá @ 2025-01-24 12:32 UTC (permalink / raw)
  To: Markus Burri, linux-kernel
  Cc: Lars-Peter Clausen, Michael Hennerich, Alisa-Dariana Roman,
	Jonathan Cameron, linux-iio

On Fri, 2025-01-24 at 12:37 +0100, Markus Burri wrote:
> Channel configuration doesn't work as expected.
> For FIELD_PREP the bit mask is needed and not the bit number.
> 
> Signed-off-by: Markus Burri <markus.burri@mt.com>
> ---

LGTM. Just missing a fixes tag. With that:

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

>  drivers/iio/adc/ad7192.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 1c87db0e0460..c4effe8429c8 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -1082,7 +1082,7 @@ static int ad7192_update_scan_mode(struct iio_dev
> *indio_dev, const unsigned lon
>  
>  	conf &= ~AD7192_CONF_CHAN_MASK;
>  	for_each_set_bit(i, scan_mask, 8)
> -		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i);
> +		conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i));
>  
>  	ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf);
>  	if (ret < 0)
> 
> base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04


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

end of thread, other threads:[~2025-01-24 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-24 11:37 [PATCH] iio: adc: ad7192: fix channel select Markus Burri
2025-01-24 12:32 ` Nuno Sá

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

all inboxes | Powered by JetHome®