overlays: dht11: make sensor readable via hwmon
authorDag Bakke <dag@bakke.com>
Mon, 30 May 2022 09:57:06 +0000 (11:57 +0200)
committerPhil Elwell <phil@raspberrypi.com>
Fri, 3 Jun 2022 21:11:55 +0000 (22:11 +0100)
Add a patch to make the sensor readable via the IIO/hwmon bridge.

Signed-off-by: Dag Bakke <dag@bakke.com>
arch/arm/boot/dts/overlays/dht11-overlay.dts

index 6feeeb4..8b0fc6b 100644 (file)
        fragment@0 {
                target-path = "/";
                __overlay__ {
-
-                       dht11: dht11@0 {
+                       dht11: dht11@4 {
                                compatible = "dht11";
                                pinctrl-names = "default";
                                pinctrl-0 = <&dht11_pins>;
                                gpios = <&gpio 4 0>;
                                status = "okay";
+                               #io-channel-cells = <1>;
+                       };
+
+                       iio: iio-hwmon@4 {
+                               compatible = "iio-hwmon";
+                               status = "okay";
+                               io-channels = <&dht11 0>, <&dht11 1>;
                        };
                };
        };
@@ -24,7 +30,7 @@
        fragment@1 {
                target = <&gpio>;
                __overlay__ {
-                       dht11_pins: dht11_pins@0 {
+                       dht11_pins: dht11_pins@4 {
                                brcm,pins = <4>;
                                brcm,function = <0>; // in
                                brcm,pull = <0>; // off
@@ -36,6 +42,7 @@
                gpiopin = <&dht11_pins>,"brcm,pins:0",
                        <&dht11_pins>, "reg:0",
                        <&dht11>,"gpios:4",
-                       <&dht11>,"reg:0";
+                       <&dht11>,"reg:0",
+                       <&iio>,"reg:0";
        };
 };