xref: /linux/Documentation/devicetree/bindings/iio/adc/qcom,pm8018-adc.yaml (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1*8d966b58SJonathan Cameron# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2*8d966b58SJonathan Cameron%YAML 1.2
3*8d966b58SJonathan Cameron---
4*8d966b58SJonathan Cameron$id: http://devicetree.org/schemas/iio/adc/qcom,pm8018-adc.yaml#
5*8d966b58SJonathan Cameron$schema: http://devicetree.org/meta-schemas/core.yaml#
6*8d966b58SJonathan Cameron
7*8d966b58SJonathan Camerontitle: Qualcomm's PM8xxx voltage XOADC
8*8d966b58SJonathan Cameron
9*8d966b58SJonathan Cameronmaintainers:
10*8d966b58SJonathan Cameron  - Linus Walleij <linus.walleij@linaro.org>
11*8d966b58SJonathan Cameron
12*8d966b58SJonathan Camerondescription: |
13*8d966b58SJonathan Cameron  The Qualcomm PM8xxx PMICs contain a HK/XO ADC (Housekeeping/Crystal
14*8d966b58SJonathan Cameron  oscillator ADC) encompassing PM8018, PM8038, PM8058 and PM8921.
15*8d966b58SJonathan Cameron
16*8d966b58SJonathan Cameronproperties:
17*8d966b58SJonathan Cameron  compatible:
18*8d966b58SJonathan Cameron    enum:
19*8d966b58SJonathan Cameron      - qcom,pm8018-adc
20*8d966b58SJonathan Cameron      - qcom,pm8038-adc
21*8d966b58SJonathan Cameron      - qcom,pm8058-adc
22*8d966b58SJonathan Cameron      - qcom,pm8921-adc
23*8d966b58SJonathan Cameron
24*8d966b58SJonathan Cameron  reg:
25*8d966b58SJonathan Cameron    maxItems: 1
26*8d966b58SJonathan Cameron    description:
27*8d966b58SJonathan Cameron      ADC base address in the PMIC, typically 0x197.
28*8d966b58SJonathan Cameron
29*8d966b58SJonathan Cameron  xoadc-ref-supply:
30*8d966b58SJonathan Cameron    description:
31*8d966b58SJonathan Cameron      The reference voltage may vary with PMIC variant but is typically
32*8d966b58SJonathan Cameron      something like 2.2 or 1.8V.
33*8d966b58SJonathan Cameron
34*8d966b58SJonathan Cameron  interrupts:
35*8d966b58SJonathan Cameron    maxItems: 1
36*8d966b58SJonathan Cameron
37*8d966b58SJonathan Cameron  "#address-cells":
38*8d966b58SJonathan Cameron    const: 2
39*8d966b58SJonathan Cameron    description:
40*8d966b58SJonathan Cameron      The first cell is the prescaler (on PM8058) or premux (on PM8921)
41*8d966b58SJonathan Cameron      with two valid bits  so legal values are 0x00, 0x01 or 0x02.
42*8d966b58SJonathan Cameron      The second cell is the main analog mux setting (0x00..0x0f).
43*8d966b58SJonathan Cameron      The combination of prescaler/premux and analog mux uniquely addresses
44*8d966b58SJonathan Cameron      a hardware channel on all systems.
45*8d966b58SJonathan Cameron
46*8d966b58SJonathan Cameron  "#size-cells":
47*8d966b58SJonathan Cameron    const: 0
48*8d966b58SJonathan Cameron
49*8d966b58SJonathan Cameron  "#io-channel-cells":
50*8d966b58SJonathan Cameron    const: 2
51*8d966b58SJonathan Cameron    description:
52*8d966b58SJonathan Cameron      The cells are precaler or premux followed by the analog muxing line.
53*8d966b58SJonathan Cameron
54*8d966b58SJonathan CameronadditionalProperties: false
55*8d966b58SJonathan Cameron
56*8d966b58SJonathan Cameronrequired:
57*8d966b58SJonathan Cameron  - compatible
58*8d966b58SJonathan Cameron  - reg
59*8d966b58SJonathan Cameron  - "#io-channel-cells"
60*8d966b58SJonathan Cameron  - "#address-cells"
61*8d966b58SJonathan Cameron  - "#size-cells"
62*8d966b58SJonathan Cameron  - adc-channel@c
63*8d966b58SJonathan Cameron  - adc-channel@d
64*8d966b58SJonathan Cameron  - adc-channel@f
65*8d966b58SJonathan Cameron
66*8d966b58SJonathan CameronpatternProperties:
67*8d966b58SJonathan Cameron  "^(adc-channel@)[0-9a-f]$":
68*8d966b58SJonathan Cameron    type: object
69*8d966b58SJonathan Cameron    description: |
70*8d966b58SJonathan Cameron      ADC channel specific configuration.
71*8d966b58SJonathan Cameron      Note that channels c, d and f must be present for calibration.
72*8d966b58SJonathan Cameron      These three nodes are used for absolute and ratiometric calibration
73*8d966b58SJonathan Cameron      and only need to have these reg values: they are by hardware definition
74*8d966b58SJonathan Cameron      1:1 ratio converters that sample 625, 1250 and 0 milliV and create
75*8d966b58SJonathan Cameron      an interpolation calibration for all other ADCs.
76*8d966b58SJonathan Cameron
77*8d966b58SJonathan Cameron    properties:
78*8d966b58SJonathan Cameron      reg:
79*8d966b58SJonathan Cameron        maxItems: 1
80*8d966b58SJonathan Cameron
81*8d966b58SJonathan Cameron      qcom,decimation:
82*8d966b58SJonathan Cameron        $ref: /schemas/types.yaml#/definitions/uint32
83*8d966b58SJonathan Cameron        description: |
84*8d966b58SJonathan Cameron          This parameter is used to decrease the ADC sampling rate.
85*8d966b58SJonathan Cameron          Quicker measurements can be made by reducing the decimation ratio.
86*8d966b58SJonathan Cameron          Valid values are 512, 1024, 2048, 4096.
87*8d966b58SJonathan Cameron          If the property is not found, a default value of 512 will be used.
88*8d966b58SJonathan Cameron
89*8d966b58SJonathan Cameron      qcom,ratiometric:
90*8d966b58SJonathan Cameron        $ref: /schemas/types.yaml#/definitions/uint32
91*8d966b58SJonathan Cameron        description: |
92*8d966b58SJonathan Cameron          Channel calibration type. If this property is specified
93*8d966b58SJonathan Cameron          VADC will use a special voltage references for channel
94*8d966b58SJonathan Cameron          calibration. The available references are specified in the
95*8d966b58SJonathan Cameron          as a u32 value setting (see below) and it is compulsory
96*8d966b58SJonathan Cameron          to also specify this reference if ratiometric calibration
97*8d966b58SJonathan Cameron          is selected.
98*8d966b58SJonathan Cameron
99*8d966b58SJonathan Cameron          If the property is not found, the channel will be
100*8d966b58SJonathan Cameron          calibrated with the 0.625V and 1.25V reference channels, also
101*8d966b58SJonathan Cameron          known as an absolute calibration.
102*8d966b58SJonathan Cameron
103*8d966b58SJonathan Cameron          The reference voltage pairs when using ratiometric calibration:
104*8d966b58SJonathan Cameron          0 = XO_IN/XOADC_GND
105*8d966b58SJonathan Cameron          1 = PMIC_IN/XOADC_GND
106*8d966b58SJonathan Cameron          2 = PMIC_IN/BMS_CSP
107*8d966b58SJonathan Cameron          3 (invalid)
108*8d966b58SJonathan Cameron          4 = XOADC_GND/XOADC_GND
109*8d966b58SJonathan Cameron          5 = XOADC_VREF/XOADC_GND
110*8d966b58SJonathan Cameron
111*8d966b58SJonathan Cameron    additionalProperties: false
112*8d966b58SJonathan Cameron
113*8d966b58SJonathan Cameron    required:
114*8d966b58SJonathan Cameron      - reg
115*8d966b58SJonathan Cameron
116*8d966b58SJonathan Cameronexamples:
117*8d966b58SJonathan Cameron  - |
118*8d966b58SJonathan Cameron    #include <dt-bindings/interrupt-controller/irq.h>
119*8d966b58SJonathan Cameron    pmic {
120*8d966b58SJonathan Cameron        #address-cells = <1>;
121*8d966b58SJonathan Cameron        #size-cells = <0>;
122*8d966b58SJonathan Cameron
123*8d966b58SJonathan Cameron        adc@197 {
124*8d966b58SJonathan Cameron            compatible = "qcom,pm8058-adc";
125*8d966b58SJonathan Cameron            reg = <0x197>;
126*8d966b58SJonathan Cameron            interrupts-extended = <&pm8058 76 IRQ_TYPE_EDGE_RISING>;
127*8d966b58SJonathan Cameron            #address-cells = <2>;
128*8d966b58SJonathan Cameron            #size-cells = <0>;
129*8d966b58SJonathan Cameron            #io-channel-cells = <2>;
130*8d966b58SJonathan Cameron
131*8d966b58SJonathan Cameron            vcoin: adc-channel@0 {
132*8d966b58SJonathan Cameron                reg = <0x00 0x00>;
133*8d966b58SJonathan Cameron            };
134*8d966b58SJonathan Cameron            vbat: adc-channel@1 {
135*8d966b58SJonathan Cameron                reg = <0x00 0x01>;
136*8d966b58SJonathan Cameron            };
137*8d966b58SJonathan Cameron            dcin: adc-channel@2 {
138*8d966b58SJonathan Cameron                reg = <0x00 0x02>;
139*8d966b58SJonathan Cameron            };
140*8d966b58SJonathan Cameron            ichg: adc-channel@3 {
141*8d966b58SJonathan Cameron                reg = <0x00 0x03>;
142*8d966b58SJonathan Cameron            };
143*8d966b58SJonathan Cameron            vph_pwr: adc-channel@4 {
144*8d966b58SJonathan Cameron                reg = <0x00 0x04>;
145*8d966b58SJonathan Cameron            };
146*8d966b58SJonathan Cameron            usb_vbus: adc-channel@a {
147*8d966b58SJonathan Cameron                reg = <0x00 0x0a>;
148*8d966b58SJonathan Cameron            };
149*8d966b58SJonathan Cameron            die_temp: adc-channel@b {
150*8d966b58SJonathan Cameron                reg = <0x00 0x0b>;
151*8d966b58SJonathan Cameron            };
152*8d966b58SJonathan Cameron            ref_625mv: adc-channel@c {
153*8d966b58SJonathan Cameron                reg = <0x00 0x0c>;
154*8d966b58SJonathan Cameron            };
155*8d966b58SJonathan Cameron            ref_1250mv: adc-channel@d {
156*8d966b58SJonathan Cameron                reg = <0x00 0x0d>;
157*8d966b58SJonathan Cameron            };
158*8d966b58SJonathan Cameron            ref_325mv: adc-channel@e {
159*8d966b58SJonathan Cameron                reg = <0x00 0x0e>;
160*8d966b58SJonathan Cameron            };
161*8d966b58SJonathan Cameron            ref_muxoff: adc-channel@f {
162*8d966b58SJonathan Cameron                reg = <0x00 0x0f>;
163*8d966b58SJonathan Cameron            };
164*8d966b58SJonathan Cameron        };
165*8d966b58SJonathan Cameron    };
166*8d966b58SJonathan Cameron...
167