From: Dag B <dag@bakke.com>
To: lm-sensors@vger.kernel.org
Subject: Re: dht11 vs iio-hwmon
Date: Fri, 27 May 2022 10:31:04 +0000 [thread overview]
Message-ID: <3a1e7298-3dfb-4622-2d59-be68792d427b@bakke.com> (raw)
In-Reply-To: <e437eea6-9027-fa9e-22ba-5710672530b6@bakke.com>
On 25.05.2022 18:18, Dag B wrote:
>
> Hi.
>
> I have managed to make use of the dht11 driver and can get data from
> my sensor quite reliably.
>
> I wanted to be able to read this sensor via lm-sensors, and was hoping
> to employ the iio-hwmon bridge for this purpose. Sadly, I do not get
> any nodes in the /sys/class/hwmon/ directory for the dht11 sensor.
>
> Do iio-drivers (like dht11) have to be written with this bridge in
> mind, in order to get the hwmon entries? Or am I just missing a touch
> of magic somewhere?
>
> root@rpi2:/boot# lsmod | egrep 'iio|hw|dht'
> dht11 16384 0
> iio_hwmon 16384 0
> raspberrypi_hwmon 16384 0
> industrialio 81920 2 iio_hwmon,dht11
> root@rpi2:/boot# cat /sys/bus/iio/devices/iio\:device0/in_temp_input
> 19400
> root@rpi2:/boot# ls -l /sys/class/hwmon/
> total 0
> lrwxrwxrwx 1 root root 0 May 25 08:59 hwmon0 -> ../../devices/virtual/thermal/thermal_zone0/hwmon0
> lrwxrwxrwx 1 root root 0 May 25 08:59 hwmon1 -> ../../devices/platform/soc/soc:firmware/raspberrypi-hwmon/hwmon/hwmon1
So, I have employed my "monkey see, monkey do"-mode. I realize that
other iio-drivers got something like this in the device tree specification:
iio-hwmon {
compatible = "iio-hwmon";
io-channels = <&something N>, <&something N+1>;
};
Where 'something' most often is 'adc' and N is an integer. 'something'
may also be 'tlaNNNN' or 'gpadc'.
'something' is either defined in the .dts file or an included .dtsi
file. I have not yet managed to deduce to what extent these definitions
are tied to the device-driver. If someone would be so kind to offer
distilled insights, I would really appreciated it. My C-foo is weak, but
the itch is real.
The dht11 driver provides for temperature and humidity through a single
GPIO pin.
drivers/iio/humidity/dht11.c
The .dts file is at:
./arch/arm/boot/dts/overlays/dht11-overlay.dts
And one more thing. This file:
https://www.kernel.org/doc/Documentation/devicetree/bindings/iio/iio-bindings.txt
.... does not exist in the git kernel tree. Is that expected?
Thanks,
Dag B
next prev parent reply other threads:[~2022-05-27 10:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 16:36 dht11 vs iio-hwmon Dag B
2022-05-27 10:31 ` Dag B [this message]
2022-05-30 12:07 ` Dag B
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a1e7298-3dfb-4622-2d59-be68792d427b@bakke.com \
--to=dag@bakke.com \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).