2 .\" SPDX-License-Identifier: BSD-2-Clause
4 .\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd driver for DHTxx and AM320x temperature and humidity sensors
36 To compile this driver into the kernel,
37 place the following line in your
38 kernel configuration file:
39 .Bd -ragged -offset indent
43 Alternatively, to load the driver as a
44 module at boot time, place the following line in
46 .Bd -literal -offset indent
52 driver supports the DHTxx and AM320x family of
53 temperature and humidity sensors.
54 The driver automatically reads the values from the sensor
55 once every 5 seconds, and makes the results available via
61 driver provides support for the following devices:
63 .Bl -column -compact -offset indent "XXXXXXXX" "XXXXXXXX"
69 The supported devices are all similar to each other, varying
70 primarily in accuracy and resolution.
71 The devices require a single wire for data communications, using a
72 custom protocol which is not compatible with Maxim's 1-wire(tm).
73 The AM320x devices also support connection to an i2c bus,
74 but this driver supports only the single-wire connection option.
76 Sysctl variables are used to access the most recent temperature and
77 humidity measurements.
78 .Bl -tag -width indent
79 .It Va dev.gpioths.<unit>.temperature
80 The current temperature in integer deciKelvins.
83 will convert those units to display in decimal degrees Celsius.
84 .It Va dev.gpioths.<unit>.humidity
85 The current relative humidity, as an integer percentage.
86 .It Va dev.gpioths.<unit>.fails
87 The number of failed attempts to communicate with the sensor since
89 Cleared whenever a set of measurements is successfully retrieved.
96 device node is typically defined directly under the root node, or under
97 a simplebus node that represents a collection of devices on a board.
99 The following properties are required in the
102 .Bl -tag -width indent
106 A reference to the gpio device and pin for data communications.
108 .Ss Example of adding a sensor with an overlay
109 .Bd -unfilled -offset indent
112 #include <dt-bindings/gpio/gpio.h>
115 compatible = "wand,imx6q-wandboard";
120 compatible = "dht11";
121 gpios = <&gpio5 15 GPIO_ACTIVE_HIGH>;
125 .Sh HINTS CONFIGURATION
128 based system, such as
130 these values are configurable for
132 .Bl -tag -width indent
133 .It Va hint.gpioths.<unit>.at
138 instance is attached to.
139 .It Va hint.gpioths.pins
140 A bitmask with a single bit set to indicate which gpio pin on the
142 to use for data communications.
151 driver first appeared in