]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: adc: ad7192: fix channel select
authorMarkus Burri <markus.burri@mt.com>
Fri, 24 Jan 2025 15:07:03 +0000 (16:07 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 3 Feb 2025 19:30:11 +0000 (19:30 +0000)
Channel configuration doesn't work as expected.
For FIELD_PREP the bit mask is needed and not the bit number.

Fixes: 874bbd1219c7 ("iio: adc: ad7192: Use bitfield access macros")
Signed-off-by: Markus Burri <markus.burri@mt.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250124150703.97848-1-markus.burri@mt.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7192.c

index e96a5ae92375d8c46510bec8299162b147522ea7..cfaf8f7e0a07dab3ee43a7b547965724f7d7c766 100644 (file)
@@ -1084,7 +1084,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)