]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/ads111x.4
bsddialog: import version 1.0
[FreeBSD/FreeBSD.git] / share / man / man4 / ads111x.4
1 .\"
2 .\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\"
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .Dd September 2, 2019
26 .Dt ADS111x 4
27 .Os
28 .Sh NAME
29 .Nm ads111x
30 .Nd driver for ADS101x and ADS111x i2c analog to digital converters
31 .Sh SYNOPSIS
32 To compile this driver into the kernel,
33 place the following line in your
34 kernel configuration file:
35 .Bd -ragged -offset indent
36 .Cd "device ads111x"
37 .Ed
38 .Pp
39 Alternatively, to load the driver as a
40 module at boot time, place the following line in
41 .Xr loader.conf 5 :
42 .Bd -literal -offset indent
43 ads111x_load="YES"
44 .Ed
45 .Sh DESCRIPTION
46 The
47 .Nm
48 driver provides support for the ADS101x/ADS111x family of analog
49 to digital converter (ADC) devices.
50 The supported devices are all similar to each other, varying in
51 features such as resolution and number of input channels.
52 The devices offer a number of configuration options which can be
53 set via hints, FDT data, and
54 .Xr sysctl 8 .
55 .Pp
56 The
57 .Xr sysctl 8
58 utility provides access to the voltage measurements made by the device.
59 Each time the
60 .Va dev.ads111x.<unit>.<channel>.voltage
61 variable is accessed for a given channel, the driver switches the
62 chip's internal mux to choose the right input pins for that channel,
63 directs it to make a single measurement, and returns the measured value
64 in microvolts.
65 The amount of time required to make the measurement is a function
66 of the sampling rate configured for the device.
67 While device is directed to make a single measurement, it still averages
68 the input values for the same amount of time as it would to emit one
69 sample if it were in continuous mode.
70 For example, if the sample rate were configured as 125 samples per
71 second, a single measurement would require 8 milliseconds.
72 .Pp
73 For devices that support multiple input pins, the device datasheet
74 describes mux settings to control how those pins are interpeted when
75 making either single-ended or differential measurements.
76 There are eight possible ways to combine the inputs from the four pins.
77 The
78 .Nm
79 driver models that by creating a separate output channel for each of
80 the eight combinations.
81 To make a measurement on a given pin or pair of pins, you simply access
82 the voltage variable for the channel number that corresponds the mux
83 setting number (0 through 7) shown in the datasheet.
84 When the driver is configured with hints or FDT data, it creates
85 sysctl variables for just the channels specified in the config data.
86 When there is no channel config data, it creates all eight possible
87 channels so that you can access whichever one(s) you need.
88 .Pp
89 For devices that include an
90 .Va alert
91 output pin, the
92 .Nm
93 driver does not directly support the pin in terms of sensing or
94 acting on changes in the pin state.
95 However, you may connect the pin to a gpio input or fan controller
96 or other external device, and use the driver's sysctl variables to
97 configure behavior and threshold values for the pin.
98 The driver avoids perturbing your settings as it does other
99 manipulations to the config register.
100 .Sh SYSCTL VARIABLES
101 Sysctl variables are used to access the voltage measurements, and to
102 change the configuration of the channels.
103 All writeable variables may also be set as
104 .Xr loader 8
105 tunables.
106 Channel numbers in these sysctl variables range from 0 through 7.
107 .Bl -tag -width indent
108 .It Va dev.ads111x.<unit>.config
109 Provides access to the configuration register bits that control the
110 alert pin configuration.
111 Other bits which are controlled by the driver are masked out, and
112 cannot be viewed or changed using this variable.
113 .It Va dev.ads111x.<unit>.lo_thresh
114 Sets the low threshold for activating the alert pin.
115 .It Va dev.ads111x.<unit>.hi_thresh
116 Sets the high threshold for activating the alert pin.
117 .It Va dev.ads111x.<unit>.<channel>.rate_index
118 Sets the sample rate for the channel.
119 The device datasheet documents eight available sample rates, chosen
120 by setting a value of 0 through 7 into the corresponding control
121 register bits.
122 This variable sets the value used for those bits when making a
123 measurement on the given channel.
124 .Pp
125 Because measurements are always made in single-shot mode, think of
126 this variable as controlling the averaging time for a single sample;
127 the time to make a measurement is 1 / samplerate.
128 .It Va dev.ads111x.<unit>.<channel>.gain_index
129 Sets the programmable gain amplifier for the channel on devices
130 which have an internal amplifier.
131 The device datasheet documents eight available gain values, chosen
132 by setting a value of 0 through 7 into the corresponding control
133 register bits.
134 This variable sets the value used for those bits when making a
135 measurement on the given channel.
136 .It Va dev.ads111x.<unit>.<channel>.voltage
137 Reading this variable causes the device to make a measurement on
138 the corresponding input pin(s) and return the voltage in microvolts.
139 .Pp
140 Note that this variable does not appear when you list multiple
141 sysctl variables -- you must access it specifically by name, because
142 accessing it triggers device I/O.
143 .El
144 .Sh HARDWARE
145 The
146 .Nm
147 driver provides support for the following devices:
148 .Pp
149 .Bl -column -compact -offset indent "XXXXXXXX" "XXXXXXXX"
150 .It ADS1013 Ta ADS1113
151 .It ADS1014 Ta ADS1114
152 .It ADS1015 Ta ADS1115
153 .El
154 .Sh FDT CONFIGURATION
155 On an
156 .Xr fdt 4
157 based system, the
158 .Nm
159 device is defined as a slave device subnode
160 of the i2c bus controller node.
161 All properties documented in the
162 .Va ads1015.txt
163 bindings document can be used with the
164 .Nm
165 device.
166 .Pp
167 The following properties are required in the
168 .Nm
169 device subnode:
170 .Bl -tag -width indent
171 .It Va compatible
172 One of the following:
173 .Bl -column -compact -offset indent ".Dq ti,ads1013" ".Dq ti,ads1113"
174 .It Dq ti,ads1013 Ta Dq ti,ads1113
175 .It Dq ti,ads1014 Ta Dq ti,ads1114
176 .It Dq ti,ads1015 Ta Dq ti,ads1115
177 .El
178 .It Va reg
179 I2c slave address of device.
180 .El
181 .Pp
182 Specific channels can be configured by adding child nodes to the
183 .Nm
184 node, as described in the standard ads1015.txt bindings document.
185 If no channels are configured, sysctl variables will be created
186 for all possible channels supported by the device type, otherwise
187 only the specified channels are created.
188 .Ss Example including channel configuration
189 .Bd -unfilled -offset indent
190 adc@48 {
191     compatible = "ti,ads1115";
192     reg = <0x48>;
193     status = "okay";
194     #address-cells = <1>;
195     #size-cells = <0>;
196
197     channel@6 {
198         reg = <6>;
199         ti,gain = <3>;
200         ti,datarate = <4>;
201     };
202     channel@7 {
203         reg = <7>;
204         ti,gain = <1>;
205         ti,datarate = <7>;
206     };
207 };
208 .Ed
209 .Sh HINTS CONFIGURATION
210 On a
211 .Xr device.hints 5
212 based system, such as
213 .Li MIPS ,
214 these values are configurable for
215 .Nm :
216 .Bl -tag -width indent
217 .It Va hint.ads111x.<unit>.at
218 The iicbus instance the
219 .Nm
220 instance is attached to.
221 .It Va hint.ads111x.<unit>.<channel>.gain_index
222 The amplifier gain, as described above for the sysctl variable
223 .Va dev.ads111x.<unit>.<channel>.gain_index .
224 .It Va hint.ads111x.<unit>.<channel>.rate_index
225 The sample rate, as described above for the sysctl variable
226 .Va dev.ads111x.<unit>.<channel>.rate_index .
227 .El
228 .Pp
229 If no channels are configured, sysctl variables will be created
230 for all possible channels supported by the device type, otherwise
231 only the specified channels are created.
232 .Sh SEE ALSO
233 .Xr fdt 4 ,
234 .Xr sysctl 8
235 .Sh HISTORY
236 The
237 .Nm
238 driver first appeared in
239 .Fx 13.0 .