xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun%YAML 1.2
3*4882a593Smuzhiyun---
4*4882a593Smuzhiyun$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#
5*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml#
6*4882a593Smuzhiyun
7*4882a593Smuzhiyuntitle: Qualcomm's SPMI PMIC ADC
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunmaintainers:
10*4882a593Smuzhiyun  - Andy Gross <agross@kernel.org>
11*4882a593Smuzhiyun  - Bjorn Andersson <bjorn.andersson@linaro.org>
12*4882a593Smuzhiyun
13*4882a593Smuzhiyundescription: |
14*4882a593Smuzhiyun  SPMI PMIC voltage ADC (VADC) provides interface to clients to read
15*4882a593Smuzhiyun  voltage. The VADC is a 15-bit sigma-delta ADC.
16*4882a593Smuzhiyun  SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read
17*4882a593Smuzhiyun  voltage. The VADC is a 16-bit sigma-delta ADC.
18*4882a593Smuzhiyun
19*4882a593Smuzhiyunproperties:
20*4882a593Smuzhiyun  compatible:
21*4882a593Smuzhiyun    oneOf:
22*4882a593Smuzhiyun      - items:
23*4882a593Smuzhiyun          - const: qcom,pms405-adc
24*4882a593Smuzhiyun          - const: qcom,spmi-adc-rev2
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun      - items:
27*4882a593Smuzhiyun          - enum:
28*4882a593Smuzhiyun              - qcom,spmi-vadc
29*4882a593Smuzhiyun              - qcom,spmi-adc5
30*4882a593Smuzhiyun              - qcom,spmi-adc-rev2
31*4882a593Smuzhiyun              - qcom,spmi-adc7
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun  reg:
34*4882a593Smuzhiyun    description: VADC base address in the SPMI PMIC register map
35*4882a593Smuzhiyun    maxItems: 1
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun  '#address-cells':
38*4882a593Smuzhiyun    const: 1
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun  '#size-cells':
41*4882a593Smuzhiyun    const: 0
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun  '#io-channel-cells':
44*4882a593Smuzhiyun    const: 1
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  interrupts:
47*4882a593Smuzhiyun    maxItems: 1
48*4882a593Smuzhiyun    description:
49*4882a593Smuzhiyun      End of conversion interrupt.
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun  io-channel-ranges: true
52*4882a593Smuzhiyun
53*4882a593Smuzhiyunrequired:
54*4882a593Smuzhiyun  - compatible
55*4882a593Smuzhiyun  - reg
56*4882a593Smuzhiyun  - '#address-cells'
57*4882a593Smuzhiyun  - '#size-cells'
58*4882a593Smuzhiyun  - '#io-channel-cells'
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunpatternProperties:
61*4882a593Smuzhiyun  "^.*@[0-9a-f]+$":
62*4882a593Smuzhiyun    type: object
63*4882a593Smuzhiyun    description: |
64*4882a593Smuzhiyun      Represents the external channels which are connected to the ADC.
65*4882a593Smuzhiyun      For compatible property "qcom,spmi-vadc" following channels, also known as
66*4882a593Smuzhiyun      reference point channels, are used for result calibration and their channel
67*4882a593Smuzhiyun      configuration nodes should be defined:
68*4882a593Smuzhiyun      VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
69*4882a593Smuzhiyun      VADC_GND_REF and VADC_VDD_VADC.
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun    properties:
72*4882a593Smuzhiyun      reg:
73*4882a593Smuzhiyun        description: |
74*4882a593Smuzhiyun          ADC channel number.
75*4882a593Smuzhiyun          See include/dt-bindings/iio/qcom,spmi-vadc.h
76*4882a593Smuzhiyun          For PMIC7 ADC, the channel numbers are specified separately per PMIC
77*4882a593Smuzhiyun          in the PMIC-specific files in include/dt-bindings/iio/.
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun      label:
80*4882a593Smuzhiyun        $ref: /schemas/types.yaml#/definitions/string
81*4882a593Smuzhiyun        description: |
82*4882a593Smuzhiyun            ADC input of the platform as seen in the schematics.
83*4882a593Smuzhiyun            For thermistor inputs connected to generic AMUX or GPIO inputs
84*4882a593Smuzhiyun            these can vary across platform for the same pins. Hence select
85*4882a593Smuzhiyun            the platform schematics name for this channel.
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun      qcom,decimation:
88*4882a593Smuzhiyun        $ref: /schemas/types.yaml#/definitions/uint32
89*4882a593Smuzhiyun        description: |
90*4882a593Smuzhiyun            This parameter is used to decrease ADC sampling rate.
91*4882a593Smuzhiyun            Quicker measurements can be made by reducing decimation ratio.
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun      qcom,pre-scaling:
94*4882a593Smuzhiyun        description: |
95*4882a593Smuzhiyun            Used for scaling the channel input signal before the signal is
96*4882a593Smuzhiyun            fed to VADC. The configuration for this node is to know the
97*4882a593Smuzhiyun            pre-determined ratio and use it for post scaling. It is a pair of
98*4882a593Smuzhiyun            integers, denoting the numerator and denominator of the fraction by which
99*4882a593Smuzhiyun            input signal is multiplied. For example, <1 3> indicates the signal is scaled
100*4882a593Smuzhiyun            down to 1/3 of its value before ADC measurement.
101*4882a593Smuzhiyun            If property is not found default value depending on chip will be used.
102*4882a593Smuzhiyun        $ref: /schemas/types.yaml#/definitions/uint32-array
103*4882a593Smuzhiyun        oneOf:
104*4882a593Smuzhiyun          - items:
105*4882a593Smuzhiyun              - const: 1
106*4882a593Smuzhiyun              - enum: [ 1, 3, 4, 6, 20, 8, 10 ]
107*4882a593Smuzhiyun          - items:
108*4882a593Smuzhiyun              - const: 10
109*4882a593Smuzhiyun              - const: 81
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun      qcom,ratiometric:
112*4882a593Smuzhiyun        description: |
113*4882a593Smuzhiyun            Channel calibration type.
114*4882a593Smuzhiyun            - For compatible property "qcom,spmi-vadc", if this property is
115*4882a593Smuzhiyun              specified VADC will use the VDD reference (1.8V) and GND for
116*4882a593Smuzhiyun              channel calibration. If property is not found, channel will be
117*4882a593Smuzhiyun              calibrated with 0.625V and 1.25V reference channels, also
118*4882a593Smuzhiyun              known as absolute calibration.
119*4882a593Smuzhiyun            - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
120*4882a593Smuzhiyun              "qcom,spmi-adc-rev2", if this property is specified VADC will use
121*4882a593Smuzhiyun              the VDD reference (1.875V) and GND for channel calibration. If
122*4882a593Smuzhiyun              property is not found, channel will be calibrated with 0V and 1.25V
123*4882a593Smuzhiyun              reference channels, also known as absolute calibration.
124*4882a593Smuzhiyun        type: boolean
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun      qcom,hw-settle-time:
127*4882a593Smuzhiyun        $ref: /schemas/types.yaml#/definitions/uint32
128*4882a593Smuzhiyun        description: |
129*4882a593Smuzhiyun            Time between AMUX getting configured and the ADC starting
130*4882a593Smuzhiyun            conversion. The 'hw_settle_time' is an index used from valid values
131*4882a593Smuzhiyun            and programmed in hardware to achieve the hardware settling delay.
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun      qcom,avg-samples:
134*4882a593Smuzhiyun        $ref: /schemas/types.yaml#/definitions/uint32
135*4882a593Smuzhiyun        description: |
136*4882a593Smuzhiyun            Number of samples to be used for measurement.
137*4882a593Smuzhiyun            Averaging provides the option to obtain a single measurement
138*4882a593Smuzhiyun            from the ADC that is an average of multiple samples. The value
139*4882a593Smuzhiyun            selected is 2^(value).
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun    required:
142*4882a593Smuzhiyun      - reg
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunallOf:
145*4882a593Smuzhiyun  - if:
146*4882a593Smuzhiyun      properties:
147*4882a593Smuzhiyun        compatible:
148*4882a593Smuzhiyun          contains:
149*4882a593Smuzhiyun            const: qcom,spmi-vadc
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun    then:
152*4882a593Smuzhiyun      patternProperties:
153*4882a593Smuzhiyun        "^.*@[0-9a-f]+$":
154*4882a593Smuzhiyun          properties:
155*4882a593Smuzhiyun            qcom,decimation:
156*4882a593Smuzhiyun              enum: [ 512, 1024, 2048, 4096 ]
157*4882a593Smuzhiyun              default: 512
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun            qcom,hw-settle-time:
160*4882a593Smuzhiyun              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
161*4882a593Smuzhiyun                      4, 6, 8, 10 ]
162*4882a593Smuzhiyun              default: 0
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun            qcom,avg-samples:
165*4882a593Smuzhiyun              enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
166*4882a593Smuzhiyun              default: 1
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun  - if:
169*4882a593Smuzhiyun      properties:
170*4882a593Smuzhiyun        compatible:
171*4882a593Smuzhiyun          contains:
172*4882a593Smuzhiyun            const: qcom,spmi-adc-rev2
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun    then:
175*4882a593Smuzhiyun      patternProperties:
176*4882a593Smuzhiyun        "^.*@[0-9a-f]+$":
177*4882a593Smuzhiyun          properties:
178*4882a593Smuzhiyun            qcom,decimation:
179*4882a593Smuzhiyun              enum: [ 256, 512, 1024 ]
180*4882a593Smuzhiyun              default: 1024
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun            qcom,hw-settle-time:
183*4882a593Smuzhiyun              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
184*4882a593Smuzhiyun                      4, 6, 8, 10 ]
185*4882a593Smuzhiyun              default: 0
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun            qcom,avg-samples:
188*4882a593Smuzhiyun              enum: [ 1, 2, 4, 8, 16 ]
189*4882a593Smuzhiyun              default: 1
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun  - if:
192*4882a593Smuzhiyun      properties:
193*4882a593Smuzhiyun        compatible:
194*4882a593Smuzhiyun          contains:
195*4882a593Smuzhiyun            const: qcom,spmi-adc5
196*4882a593Smuzhiyun
197*4882a593Smuzhiyun    then:
198*4882a593Smuzhiyun      patternProperties:
199*4882a593Smuzhiyun        "^.*@[0-9a-f]+$":
200*4882a593Smuzhiyun          properties:
201*4882a593Smuzhiyun            qcom,decimation:
202*4882a593Smuzhiyun              enum: [ 250, 420, 840 ]
203*4882a593Smuzhiyun              default: 840
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun            qcom,hw-settle-time:
206*4882a593Smuzhiyun              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
207*4882a593Smuzhiyun                      4, 6, 8, 10, 16, 32, 64, 128 ]
208*4882a593Smuzhiyun              default: 15
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun            qcom,avg-samples:
211*4882a593Smuzhiyun              enum: [ 1, 2, 4, 8, 16 ]
212*4882a593Smuzhiyun              default: 1
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun  - if:
215*4882a593Smuzhiyun      properties:
216*4882a593Smuzhiyun        compatible:
217*4882a593Smuzhiyun          contains:
218*4882a593Smuzhiyun            const: qcom,spmi-adc7
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun    then:
221*4882a593Smuzhiyun      patternProperties:
222*4882a593Smuzhiyun        "^.*@[0-9a-f]+$":
223*4882a593Smuzhiyun          properties:
224*4882a593Smuzhiyun            qcom,decimation:
225*4882a593Smuzhiyun              enum: [ 85, 340, 1360 ]
226*4882a593Smuzhiyun              default: 1360
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun            qcom,hw-settle-time:
229*4882a593Smuzhiyun              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
230*4882a593Smuzhiyun                      8000, 16000, 32000, 64000, 128000 ]
231*4882a593Smuzhiyun              default: 15
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun            qcom,avg-samples:
234*4882a593Smuzhiyun              enum: [ 1, 2, 4, 8, 16 ]
235*4882a593Smuzhiyun              default: 1
236*4882a593Smuzhiyun
237*4882a593SmuzhiyunadditionalProperties: false
238*4882a593Smuzhiyun
239*4882a593Smuzhiyunexamples:
240*4882a593Smuzhiyun  - |
241*4882a593Smuzhiyun    spmi_bus {
242*4882a593Smuzhiyun      #address-cells = <1>;
243*4882a593Smuzhiyun      #size-cells = <0>;
244*4882a593Smuzhiyun      /* VADC node */
245*4882a593Smuzhiyun      pmic_vadc: adc@3100 {
246*4882a593Smuzhiyun        compatible = "qcom,spmi-vadc";
247*4882a593Smuzhiyun        reg = <0x3100>;
248*4882a593Smuzhiyun        interrupts = <0x0 0x31 0x0 0x1>;
249*4882a593Smuzhiyun        #address-cells = <1>;
250*4882a593Smuzhiyun        #size-cells = <0>;
251*4882a593Smuzhiyun        #io-channel-cells = <1>;
252*4882a593Smuzhiyun        io-channel-ranges;
253*4882a593Smuzhiyun
254*4882a593Smuzhiyun        /* Channel node */
255*4882a593Smuzhiyun        adc-chan@39 {
256*4882a593Smuzhiyun          reg = <0x39>;
257*4882a593Smuzhiyun          qcom,decimation = <512>;
258*4882a593Smuzhiyun          qcom,ratiometric;
259*4882a593Smuzhiyun          qcom,hw-settle-time = <200>;
260*4882a593Smuzhiyun          qcom,avg-samples = <1>;
261*4882a593Smuzhiyun          qcom,pre-scaling = <1 3>;
262*4882a593Smuzhiyun        };
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun        adc-chan@9 {
265*4882a593Smuzhiyun          reg = <0x9>;
266*4882a593Smuzhiyun        };
267*4882a593Smuzhiyun
268*4882a593Smuzhiyun        adc-chan@a {
269*4882a593Smuzhiyun          reg = <0xa>;
270*4882a593Smuzhiyun        };
271*4882a593Smuzhiyun
272*4882a593Smuzhiyun        adc-chan@e {
273*4882a593Smuzhiyun          reg = <0xe>;
274*4882a593Smuzhiyun        };
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun        adc-chan@f {
277*4882a593Smuzhiyun          reg = <0xf>;
278*4882a593Smuzhiyun        };
279*4882a593Smuzhiyun      };
280*4882a593Smuzhiyun    };
281