Merge tag 'm68k-for-v4.20-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / Documentation / devicetree / bindings / iio / adc / qcom,spmi-vadc.txt
1 Qualcomm's SPMI PMIC ADC
2
3 - SPMI PMIC voltage ADC (VADC) provides interface to clients to read
4   voltage. The VADC is a 15-bit sigma-delta ADC.
5 - SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read
6   voltage. The VADC is a 16-bit sigma-delta ADC.
7
8 VADC node:
9
10 - compatible:
11     Usage: required
12     Value type: <string>
13     Definition: Should contain "qcom,spmi-vadc".
14                 Should contain "qcom,spmi-adc5" for PMIC5 ADC driver.
15                 Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver.
16
17 - reg:
18     Usage: required
19     Value type: <prop-encoded-array>
20     Definition: VADC base address in the SPMI PMIC register map.
21
22 - #address-cells:
23     Usage: required
24     Value type: <u32>
25     Definition: Must be one. Child node 'reg' property should define ADC
26             channel number.
27
28 - #size-cells:
29     Usage: required
30     Value type: <u32>
31     Definition: Must be zero.
32
33 - #io-channel-cells:
34     Usage: required
35     Value type: <u32>
36     Definition: Must be one. For details about IIO bindings see:
37             Documentation/devicetree/bindings/iio/iio-bindings.txt
38
39 - interrupts:
40     Usage: optional
41     Value type: <prop-encoded-array>
42     Definition: End of conversion interrupt.
43
44 Channel node properties:
45
46 - reg:
47     Usage: required
48     Value type: <u32>
49     Definition: ADC channel number.
50             See include/dt-bindings/iio/qcom,spmi-vadc.h
51
52 - label:
53     Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2"
54     Value type: <empty>
55     Definition: ADC input of the platform as seen in the schematics.
56             For thermistor inputs connected to generic AMUX or GPIO inputs
57             these can vary across platform for the same pins. Hence select
58             the platform schematics name for this channel.
59
60 - qcom,decimation:
61     Usage: optional
62     Value type: <u32>
63     Definition: This parameter is used to decrease ADC sampling rate.
64             Quicker measurements can be made by reducing decimation ratio.
65             - For compatible property "qcom,spmi-vadc", valid values are
66               512, 1024, 2048, 4096. If property is not found, default value
67               of 512 will be used.
68             - For compatible property "qcom,spmi-adc5", valid values are 250, 420
69               and 840. If property is not found, default value of 840 is used.
70             - For compatible property "qcom,spmi-adc-rev2", valid values are 256,
71               512 and 1024. If property is not present, default value is 1024.
72
73 - qcom,pre-scaling:
74     Usage: optional
75     Value type: <u32 array>
76     Definition: Used for scaling the channel input signal before the signal is
77             fed to VADC. The configuration for this node is to know the
78             pre-determined ratio and use it for post scaling. Select one from
79             the following options.
80             <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10>
81             If property is not found default value depending on chip will be used.
82
83 - qcom,ratiometric:
84     Usage: optional
85     Value type: <empty>
86     Definition: Channel calibration type.
87             - For compatible property "qcom,spmi-vadc", if this property is
88               specified VADC will use the VDD reference (1.8V) and GND for
89               channel calibration. If property is not found, channel will be
90               calibrated with 0.625V and 1.25V reference channels, also
91               known as absolute calibration.
92             - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
93               if this property is specified VADC will use the VDD reference
94               (1.875V) and GND for channel calibration. If property is not found,
95               channel will be calibrated with 0V and 1.25V reference channels,
96               also known as absolute calibration.
97
98 - qcom,hw-settle-time:
99     Usage: optional
100     Value type: <u32>
101     Definition: Time between AMUX getting configured and the ADC starting
102             conversion. The 'hw_settle_time' is an index used from valid values
103             and programmed in hardware to achieve the hardware settling delay.
104             - For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2",
105               Delay = 100us * (hw_settle_time) for hw_settle_time < 11,
106               and 2ms * (hw_settle_time - 10) otherwise.
107               Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800,
108               900 us and 1, 2, 4, 6, 8, 10 ms.
109               If property is not found, channel will use 0us.
110             - For compatible property "qcom,spmi-adc5", delay = 15us for
111               value 0, 100us * (value) for values < 11,
112               and 2ms * (value - 10) otherwise.
113               Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800,
114               900 us and 1, 2, 4, 6, 8, 10 ms
115               Certain controller digital versions have valid values of
116               15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms
117               If property is not found, channel will use 15us.
118
119 - qcom,avg-samples:
120     Usage: optional
121     Value type: <u32>
122     Definition: Number of samples to be used for measurement.
123             Averaging provides the option to obtain a single measurement
124             from the ADC that is an average of multiple samples. The value
125             selected is 2^(value).
126             - For compatible property "qcom,spmi-vadc", valid values
127               are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512
128               If property is not found, 1 sample will be used.
129             - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2",
130               valid values are: 1, 2, 4, 8, 16
131               If property is not found, 1 sample will be used.
132
133 NOTE:
134
135 For compatible property "qcom,spmi-vadc" following channels, also known as
136 reference point channels, are used for result calibration and their channel
137 configuration nodes should be defined:
138 VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
139 VADC_GND_REF and VADC_VDD_VADC.
140
141 Example:
142
143         /* VADC node */
144         pmic_vadc: vadc@3100 {
145                 compatible = "qcom,spmi-vadc";
146                 reg = <0x3100>;
147                 interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
148                 #address-cells = <1>;
149                 #size-cells = <0>;
150                 #io-channel-cells = <1>;
151                 io-channel-ranges;
152
153                 /* Channel node */
154                 usb_id_nopull {
155                         reg = <VADC_LR_MUX10_USB_ID>;
156                         qcom,decimation = <512>;
157                         qcom,ratiometric;
158                         qcom,hw-settle-time = <200>;
159                         qcom,avg-samples = <1>;
160                         qcom,pre-scaling = <1 3>;
161                 };
162         };
163
164         /* IIO client node */
165         usb {
166                 io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>;
167                 io-channel-names = "vadc";
168         };