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