xref: /freebsd/share/man/man4/pcf8591.4 (revision 2008043f386721d58158e37e0d7e50df8095942d)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2020 Andriy Gapon <avg@FreeBSD.org>
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
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.
14.\"
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
25.\" SUCH DAMAGE.
26.\"
27.Dd November 6, 2021
28.Dt PCF8591 4
29.Os
30.Sh NAME
31.Nm pcf8591
32.Nd driver for the PCF8591 8-bit A/D and D/A converter
33.Sh SYNOPSIS
34To compile this driver into the kernel,
35place the following lines in your
36kernel configuration file:
37.Bd -ragged -offset indent
38.Cd "device pcf8591"
39.Cd "device iicbus"
40.Ed
41.Pp
42Alternatively, to load the driver as a
43module at boot time, place the following line in
44.Xr loader.conf 5 :
45.Bd -literal -offset indent
46pcf8591_load="YES"
47.Ed
48.Sh DESCRIPTION
49The
50.Nm
51driver supports reading four inputs and setting one output over I2C.
52The hardware supports configuring the input lines as:
53.Bl -bullet
54.It
55four single-ended inputs
56.It
57three differential inputs (one input line is shared between all three inputs)
58.It
59two single-ended inputs and one differential input
60.It
61two differential inputs.
62.El
63.Pp
64The
65.Nm
66driver reports data via
67.Xr sysctl 8
68entries in the device's node in the
69.Xr sysctl 8
70tree:
71.Bl -tag -width inputs.%d
72.It Va inputs.%d
73The input level of the corresponding input in steps between 0 and 255.
74Absolute voltage depends on an actual reference voltage.
75.El
76.Pp
77On an
78.Xr FDT 4
79based system the following properties must be set:
80.Bl -tag -width "compatible"
81.It Va compatible
82Must be set to "nxp,pcf8591".
83.It Va reg
84The I2C address of
85.Nm .
86It should be in the range from 0x40 to 0x4f (7-bit).
87.El
88.Pp
89The DTS part for a
90.Nm
91device usually looks like:
92.Bd -literal
93/ {
94
95	...
96	pcf8591adc {
97		compatible = "nxp,pcf8591";
98		reg = <0x48>;
99	};
100};
101.Ed
102.Sh SEE ALSO
103.Xr fdt 4 ,
104.Xr iicbus 4 ,
105.Xr sysctl 8
106.Sh HISTORY
107The
108.Nm
109driver and this manual page was written by
110.An Andriy Gapon Aq Mt avg@FreeBSD.org .
111.Sh BUGS
112The
113.Nm
114driver does not support changing the input configuration.
115All input lines are configured as single-ended inputs.
116.Pp
117The
118.Nm
119driver does not support setting the output.
120It is always disabled (tri-state).
121