]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: adc: sun20i-gpadc: support non-contiguous channel lookups
authorMichal Piekos <michal.piekos@mmpsystems.pl>
Sat, 16 May 2026 05:48:37 +0000 (07:48 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:41 +0000 (10:59 +0100)
commit44f38b46298dc2b0e007e88381d46fb92172a81d
tree3c46140a4dda935550b871b2fd7eaa618277f4c8
parent8114f4420360260576cbd6d0633b28a607321f0b
iio: adc: sun20i-gpadc: support non-contiguous channel lookups

Using consumer driver like iio-hwmon which resolve channels through
io-channels phandles will fail for sparse channels because IIO core by
default treats phandle argument as index into channel array.
        eg. <&gpadc 1> will fail if there is only channel@1 specified

Add .fwnode_xlate() which maps DT phandle to the registered channel
whose chan->channel matches the hardware channel number. It allows
sparse channel maps to be consumed by drivers like iio-hwmon.

Tested on Radxa Cubie A5E.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/sun20i-gpadc-iio.c