xref: /freebsd/share/man/man4/man4.arm/ti_adc.4 (revision cbb3ec25236ba72f91cbdf23f8b78b9d1af0cedf)
1.\"
2.\" Copyright (c) 2014 Luiz Otavio O Souza <loos@freebsd.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
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 June 1, 2014
26.Dt TI_ADC 4
27.Os
28.Sh NAME
29.Nm ti_adc
30.Nd TI AM3XXX analog to digital converter driver
31.Sh SYNOPSIS
32.Cd "device ti_adc"
33.Sh DESCRIPTION
34The
35.Nm
36driver provides access to the AIN (analog inputs) on am3xxx SoCs.
37.Pp
38It provides raw readings of the converted values for each analog inputs.
39.Pp
40The access to
41.Nm
42data is made via the
43.Xr sysctl 8
44interface:
45.Bd -literal
46dev.ti_adc.0.%desc: TI ADC controller
47dev.ti_adc.0.%driver: ti_adc
48dev.ti_adc.0.%pnpinfo: name=adc@44E0D000 compat=ti,adc
49dev.ti_adc.0.%parent: simplebus0
50dev.ti_adc.0.clockdiv: 2400
51dev.ti_adc.0.ain.0.enable: 0
52dev.ti_adc.0.ain.0.open_delay: 0
53dev.ti_adc.0.ain.0.samples_avg: 0
54dev.ti_adc.0.ain.0.input: 0
55dev.ti_adc.0.ain.1.enable: 0
56dev.ti_adc.0.ain.1.open_delay: 0
57dev.ti_adc.0.ain.1.samples_avg: 0
58dev.ti_adc.0.ain.1.input: 0
59dev.ti_adc.0.ain.2.enable: 0
60dev.ti_adc.0.ain.2.open_delay: 0
61dev.ti_adc.0.ain.2.samples_avg: 0
62dev.ti_adc.0.ain.2.input: 0
63dev.ti_adc.0.ain.3.enable: 0
64dev.ti_adc.0.ain.3.open_delay: 0
65dev.ti_adc.0.ain.3.samples_avg: 0
66dev.ti_adc.0.ain.3.input: 0
67dev.ti_adc.0.ain.4.enable: 0
68dev.ti_adc.0.ain.4.open_delay: 0
69dev.ti_adc.0.ain.4.samples_avg: 0
70dev.ti_adc.0.ain.4.input: 0
71dev.ti_adc.0.ain.5.enable: 0
72dev.ti_adc.0.ain.5.open_delay: 0
73dev.ti_adc.0.ain.5.samples_avg: 0
74dev.ti_adc.0.ain.5.input: 0
75dev.ti_adc.0.ain.6.enable: 1
76dev.ti_adc.0.ain.6.open_delay: 0
77dev.ti_adc.0.ain.6.samples_avg: 4
78dev.ti_adc.0.ain.6.input: 2308
79dev.ti_adc.0.ain.7.enable: 1
80dev.ti_adc.0.ain.7.open_delay: 0
81dev.ti_adc.0.ain.7.samples_avg: 0
82dev.ti_adc.0.ain.7.input: 3812
83.Ed
84.Pp
85On Beaglebone-black the analog input 7 is connected to the 3V3B rail through
86a voltage divisor (2:1).
87The 3V3B voltage rail comes from the TL5209 LDO regulator which is limited
88to 500mA maximum.
89.Pp
90Global settings:
91.Bl -tag -width ".Va dev.ti_adc.0.clockdiv"
92.It Va dev.ti_adc.0.clockdiv
93Sets the ADC clock prescaler.
94The minimum value is 10 and the maximum is 65535.
95The ADC clock is based on CLK_M_OSC (24Mhz) / clockdiv.
96This gives a maximum of ~2.4Mhz for the ADC clock and ~10Khz for the default
97setting (clockdiv = 2400).
98.El
99.Pp
100Settings per input:
101.Bl -tag -width ".Va dev.ti_adc.0.ain.%d.samples_avg"
102.It Va dev.ti_adc.0.ain.%d.enable
103Enable the conversion for the input.
104Each input should be individually enabled before it can be used.
105When all the inputs are disabled, the ADC is turned off.
106.It Va dev.ti_adc.0.ain.%d.open_delay
107Sets the number of ADC clock cycles to wait after applying the input
108configuration and before start the ADC conversion.
109.It Va dev.ti_adc.0.ain.%d.samples_avg
110Sets the number of samples average used on each input, it can be set to 0
111(no samples average), 2, 4, 8, or 16.
112.It Va dev.ti_adc.0.ain.%d.input
113Is the converted raw value of the voltage applied on the analog input.
114It is made of a 12 bit value (0 ~ 4095).
115.El
116.Sh SEE ALSO
117.Xr sysctl 8
118.Sh HISTORY
119The
120.Nm
121driver first appeared in
122.Fx 10.1 .
123.Sh AUTHORS
124.An -nosplit
125The driver and this manual page was written by
126.An Luiz Otavio O Souza Aq Mt loos@FreeBSD.org .
127