1a60b3046SAndriy Gapon.\" 2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause 3a60b3046SAndriy Gapon.\" 4a60b3046SAndriy Gapon.\" Copyright (c) 2020 Andriy Gapon <avg@FreeBSD.org> 5a60b3046SAndriy Gapon.\" 6a60b3046SAndriy Gapon.\" Redistribution and use in source and binary forms, with or without 7a60b3046SAndriy Gapon.\" modification, are permitted provided that the following conditions 8a60b3046SAndriy Gapon.\" are met: 9a60b3046SAndriy Gapon.\" 1. Redistributions of source code must retain the above copyright 10a60b3046SAndriy Gapon.\" notice, this list of conditions and the following disclaimer. 11a60b3046SAndriy Gapon.\" 2. Redistributions in binary form must reproduce the above copyright 12a60b3046SAndriy Gapon.\" notice, this list of conditions and the following disclaimer in the 13a60b3046SAndriy Gapon.\" documentation and/or other materials provided with the distribution. 14a60b3046SAndriy Gapon.\" 15a60b3046SAndriy Gapon.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16a60b3046SAndriy Gapon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17a60b3046SAndriy Gapon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18a60b3046SAndriy Gapon.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19a60b3046SAndriy Gapon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20a60b3046SAndriy Gapon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21a60b3046SAndriy Gapon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22a60b3046SAndriy Gapon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23a60b3046SAndriy Gapon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24a60b3046SAndriy Gapon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25a60b3046SAndriy Gapon.\" SUCH DAMAGE. 26a60b3046SAndriy Gapon.\" 27a60b3046SAndriy Gapon.Dd November 6, 2021 28a60b3046SAndriy Gapon.Dt PCF8591 4 29a60b3046SAndriy Gapon.Os 30a60b3046SAndriy Gapon.Sh NAME 31a60b3046SAndriy Gapon.Nm pcf8591 32a60b3046SAndriy Gapon.Nd driver for the PCF8591 8-bit A/D and D/A converter 33a60b3046SAndriy Gapon.Sh SYNOPSIS 34a60b3046SAndriy GaponTo compile this driver into the kernel, 35a60b3046SAndriy Gaponplace the following lines in your 36a60b3046SAndriy Gaponkernel configuration file: 37a60b3046SAndriy Gapon.Bd -ragged -offset indent 38a60b3046SAndriy Gapon.Cd "device pcf8591" 39a60b3046SAndriy Gapon.Cd "device iicbus" 40a60b3046SAndriy Gapon.Ed 41a60b3046SAndriy Gapon.Pp 42a60b3046SAndriy GaponAlternatively, to load the driver as a 43a60b3046SAndriy Gaponmodule at boot time, place the following line in 44a60b3046SAndriy Gapon.Xr loader.conf 5 : 45a60b3046SAndriy Gapon.Bd -literal -offset indent 46a60b3046SAndriy Gaponpcf8591_load="YES" 47a60b3046SAndriy Gapon.Ed 48a60b3046SAndriy Gapon.Sh DESCRIPTION 49a60b3046SAndriy GaponThe 50a60b3046SAndriy Gapon.Nm 51a60b3046SAndriy Gapondriver supports reading four inputs and setting one output over I2C. 52a60b3046SAndriy GaponThe hardware supports configuring the input lines as: 53a60b3046SAndriy Gapon.Bl -bullet 54a60b3046SAndriy Gapon.It 55a60b3046SAndriy Gaponfour single-ended inputs 56a60b3046SAndriy Gapon.It 57a60b3046SAndriy Gaponthree differential inputs (one input line is shared between all three inputs) 58a60b3046SAndriy Gapon.It 59a60b3046SAndriy Gapontwo single-ended inputs and one differential input 60a60b3046SAndriy Gapon.It 61a60b3046SAndriy Gapontwo differential inputs. 62a60b3046SAndriy Gapon.El 63a60b3046SAndriy Gapon.Pp 64a60b3046SAndriy GaponThe 65a60b3046SAndriy Gapon.Nm 66a60b3046SAndriy Gapondriver reports data via 67a60b3046SAndriy Gapon.Xr sysctl 8 68a60b3046SAndriy Gaponentries in the device's node in the 69a60b3046SAndriy Gapon.Xr sysctl 8 70a60b3046SAndriy Gapontree: 71a60b3046SAndriy Gapon.Bl -tag -width inputs.%d 72a60b3046SAndriy Gapon.It Va inputs.%d 73a60b3046SAndriy GaponThe input level of the corresponding input in steps between 0 and 255. 74a60b3046SAndriy GaponAbsolute voltage depends on an actual reference voltage. 75a60b3046SAndriy Gapon.El 76a60b3046SAndriy Gapon.Pp 77a60b3046SAndriy GaponOn an 78a60b3046SAndriy Gapon.Xr FDT 4 79a60b3046SAndriy Gaponbased system the following properties must be set: 80a60b3046SAndriy Gapon.Bl -tag -width "compatible" 81a60b3046SAndriy Gapon.It Va compatible 82a60b3046SAndriy GaponMust be set to "nxp,pcf8591". 83a60b3046SAndriy Gapon.It Va reg 84a60b3046SAndriy GaponThe I2C address of 85a60b3046SAndriy Gapon.Nm . 86a60b3046SAndriy GaponIt should be in the range from 0x40 to 0x4f (7-bit). 87a60b3046SAndriy Gapon.El 88a60b3046SAndriy Gapon.Pp 89a60b3046SAndriy GaponThe DTS part for a 90a60b3046SAndriy Gapon.Nm 91a60b3046SAndriy Gapondevice usually looks like: 92a60b3046SAndriy Gapon.Bd -literal 93a60b3046SAndriy Gapon/ { 94a60b3046SAndriy Gapon 95a60b3046SAndriy Gapon ... 96a60b3046SAndriy Gapon pcf8591adc { 97a60b3046SAndriy Gapon compatible = "nxp,pcf8591"; 98a60b3046SAndriy Gapon reg = <0x48>; 99a60b3046SAndriy Gapon }; 100a60b3046SAndriy Gapon}; 101a60b3046SAndriy Gapon.Ed 102a60b3046SAndriy Gapon.Sh SEE ALSO 103a60b3046SAndriy Gapon.Xr fdt 4 , 104a60b3046SAndriy Gapon.Xr iicbus 4 , 105a60b3046SAndriy Gapon.Xr sysctl 8 106a60b3046SAndriy Gapon.Sh HISTORY 107a60b3046SAndriy GaponThe 108a60b3046SAndriy Gapon.Nm 109a60b3046SAndriy Gapondriver and this manual page was written by 110a60b3046SAndriy Gapon.An Andriy Gapon Aq Mt avg@FreeBSD.org . 111a60b3046SAndriy Gapon.Sh BUGS 112a60b3046SAndriy GaponThe 113a60b3046SAndriy Gapon.Nm 114a60b3046SAndriy Gapondriver does not support changing the input configuration. 115a60b3046SAndriy GaponAll input lines are configured as single-ended inputs. 116a60b3046SAndriy Gapon.Pp 117a60b3046SAndriy GaponThe 118a60b3046SAndriy Gapon.Nm 119a60b3046SAndriy Gapondriver does not support setting the output. 120a60b3046SAndriy GaponIt is always disabled (tri-state). 121