diff mbox series

[RFC,v1,1/2] hwmon: (iio_hwmon) optionally force iio channel type

Message ID 20210516044315.116290-2-liambeguin@gmail.com (mailing list archive)
State New, archived
Headers show
Series hwmon: (iio_hwmon) optionally force iio channel type | expand

Commit Message

Liam Beguin May 16, 2021, 4:43 a.m. UTC
Add a devicetree binding to optionally force a different IIO channel

This is useful in cases where ADC channels are connected to a circuit
that represent another unit such as a temperature or a current.

`channel-types` was chosen instead of `io-channel-types` as this is not
part of the iio consumer bindings.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
 drivers/hwmon/iio_hwmon.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
index 580a7d125b88..365ea2359b22 100644
--- a/drivers/hwmon/iio_hwmon.c
+++ b/drivers/hwmon/iio_hwmon.c
@@ -109,6 +109,8 @@  static int iio_hwmon_probe(struct platform_device *pdev)
 		if (ret < 0)
 			return ret;
+		of_property_read_u32_index(dev->of_node, "channel-types",
+					   i, &type);
 		switch (type) {
 		case IIO_VOLTAGE:
 			n = in_i++;