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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a devicetree binding to optionally force a different IIO channel
type.

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@xxxxxxxxx>
---
 drivers/hwmon/iio_hwmon.c | 2 ++
 1 file changed, 2 insertions(+)

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++;
-- 
2.30.1.489.g328c10930387




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux