]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iio: adc: ad7606: fix oversampling gpio array
authorGuillaume Stols <gstols@baylibre.com>
Tue, 2 Jul 2024 17:34:10 +0000 (17:34 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 29 Jul 2024 19:31:12 +0000 (20:31 +0100)
commit8dc4594b54dbaaba40dc8884ad3d42083de39434
tree1fb62d3dc0255b3b8554439eef530e87a6a8694c
parent8d71a5d8685025a0a95a73d3b130a45c91eaf8a4
iio: adc: ad7606: fix oversampling gpio array

gpiod_set_array_value was misused here: the implementation relied on the
assumption that an unsigned long was required for each gpio, while the
function expects a bit array stored in "as much unsigned long as needed
for storing one bit per GPIO", i.e it is using a bit field.

This leaded to incorrect parameter passed to gpiod_set_array_value, that
would set 1 value instead of 3.
It also prevents to select the software mode correctly for the AD7606B.

Fixes: d2a415c86c6b ("iio: adc: ad7606: Add support for AD7606B ADC")
Fixes: 41f71e5e7daf ("staging: iio: adc: ad7606: Use find_closest() macro")
Signed-off-by: Guillaume Stols <gstols@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7606.c
drivers/iio/adc/ad7606_spi.c