xref: /linux/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
15a471662SJishnu Prakash# SPDX-License-Identifier: GPL-2.0-only
25a471662SJishnu Prakash%YAML 1.2
35a471662SJishnu Prakash---
45a471662SJishnu Prakash$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#
55a471662SJishnu Prakash$schema: http://devicetree.org/meta-schemas/core.yaml#
65a471662SJishnu Prakash
75a471662SJishnu Prakashtitle: Qualcomm's SPMI PMIC ADC
85a471662SJishnu Prakash
95a471662SJishnu Prakashmaintainers:
105a471662SJishnu Prakash  - Andy Gross <agross@kernel.org>
115a471662SJishnu Prakash  - Bjorn Andersson <bjorn.andersson@linaro.org>
125a471662SJishnu Prakash
135a471662SJishnu Prakashdescription: |
145a471662SJishnu Prakash  SPMI PMIC voltage ADC (VADC) provides interface to clients to read
155a471662SJishnu Prakash  voltage. The VADC is a 15-bit sigma-delta ADC.
16d1492bbdSJishnu Prakash  SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read
175a471662SJishnu Prakash  voltage. The VADC is a 16-bit sigma-delta ADC.
185a471662SJishnu Prakash
195a471662SJishnu Prakashproperties:
205a471662SJishnu Prakash  compatible:
215a471662SJishnu Prakash    oneOf:
225a471662SJishnu Prakash      - items:
235a471662SJishnu Prakash          - const: qcom,pms405-adc
245a471662SJishnu Prakash          - const: qcom,spmi-adc-rev2
255a471662SJishnu Prakash      - enum:
265a471662SJishnu Prakash          - qcom,spmi-vadc
275a471662SJishnu Prakash          - qcom,spmi-adc5
285a471662SJishnu Prakash          - qcom,spmi-adc-rev2
29d1492bbdSJishnu Prakash          - qcom,spmi-adc7
305a471662SJishnu Prakash
315a471662SJishnu Prakash  reg:
325a471662SJishnu Prakash    description: VADC base address in the SPMI PMIC register map
335a471662SJishnu Prakash    maxItems: 1
345a471662SJishnu Prakash
355a471662SJishnu Prakash  '#address-cells':
365a471662SJishnu Prakash    const: 1
375a471662SJishnu Prakash
385a471662SJishnu Prakash  '#size-cells':
395a471662SJishnu Prakash    const: 0
405a471662SJishnu Prakash
415a471662SJishnu Prakash  '#io-channel-cells':
425a471662SJishnu Prakash    const: 1
435a471662SJishnu Prakash
445a471662SJishnu Prakash  interrupts:
455a471662SJishnu Prakash    maxItems: 1
465a471662SJishnu Prakash    description:
475a471662SJishnu Prakash      End of conversion interrupt.
485a471662SJishnu Prakash
495a471662SJishnu Prakashrequired:
505a471662SJishnu Prakash  - compatible
515a471662SJishnu Prakash  - reg
525a471662SJishnu Prakash  - '#address-cells'
535a471662SJishnu Prakash  - '#size-cells'
545a471662SJishnu Prakash  - '#io-channel-cells'
555a471662SJishnu Prakash
565a471662SJishnu PrakashpatternProperties:
57e0b79724SMarijn Suijten  "^channel@[0-9a-f]+$":
585a471662SJishnu Prakash    type: object
59c682c963SRob Herring    additionalProperties: false
605a471662SJishnu Prakash    description: |
615a471662SJishnu Prakash      Represents the external channels which are connected to the ADC.
625a471662SJishnu Prakash      For compatible property "qcom,spmi-vadc" following channels, also known as
635a471662SJishnu Prakash      reference point channels, are used for result calibration and their channel
645a471662SJishnu Prakash      configuration nodes should be defined:
655a471662SJishnu Prakash      VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
665a471662SJishnu Prakash      VADC_GND_REF and VADC_VDD_VADC.
675a471662SJishnu Prakash
685a471662SJishnu Prakash    properties:
695a471662SJishnu Prakash      reg:
700499220dSRob Herring        maxItems: 1
715a471662SJishnu Prakash        description: |
725a471662SJishnu Prakash          ADC channel number.
735a471662SJishnu Prakash          See include/dt-bindings/iio/qcom,spmi-vadc.h
74d1492bbdSJishnu Prakash          For PMIC7 ADC, the channel numbers are specified separately per PMIC
75d1492bbdSJishnu Prakash          in the PMIC-specific files in include/dt-bindings/iio/.
765a471662SJishnu Prakash
775a471662SJishnu Prakash      label:
785a471662SJishnu Prakash        description: |
795a471662SJishnu Prakash            ADC input of the platform as seen in the schematics.
805a471662SJishnu Prakash            For thermistor inputs connected to generic AMUX or GPIO inputs
815a471662SJishnu Prakash            these can vary across platform for the same pins. Hence select
825a471662SJishnu Prakash            the platform schematics name for this channel.
835a471662SJishnu Prakash
845a471662SJishnu Prakash      qcom,decimation:
855a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
865a471662SJishnu Prakash        description: |
875a471662SJishnu Prakash            This parameter is used to decrease ADC sampling rate.
885a471662SJishnu Prakash            Quicker measurements can be made by reducing decimation ratio.
895a471662SJishnu Prakash
905a471662SJishnu Prakash      qcom,pre-scaling:
915a471662SJishnu Prakash        description: |
925a471662SJishnu Prakash            Used for scaling the channel input signal before the signal is
935a471662SJishnu Prakash            fed to VADC. The configuration for this node is to know the
945a471662SJishnu Prakash            pre-determined ratio and use it for post scaling. It is a pair of
955a471662SJishnu Prakash            integers, denoting the numerator and denominator of the fraction by which
965a471662SJishnu Prakash            input signal is multiplied. For example, <1 3> indicates the signal is scaled
975a471662SJishnu Prakash            down to 1/3 of its value before ADC measurement.
985a471662SJishnu Prakash            If property is not found default value depending on chip will be used.
995f0b06daSRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
1005a471662SJishnu Prakash        oneOf:
1015a471662SJishnu Prakash          - items:
1025a471662SJishnu Prakash              - const: 1
103ef513aa7SLuca Weiss              - enum: [ 1, 3, 4, 6, 20, 8, 10, 16 ]
1045a471662SJishnu Prakash          - items:
1055a471662SJishnu Prakash              - const: 10
1065a471662SJishnu Prakash              - const: 81
1075a471662SJishnu Prakash
1085a471662SJishnu Prakash      qcom,ratiometric:
1095a471662SJishnu Prakash        description: |
1105a471662SJishnu Prakash            Channel calibration type.
1115a471662SJishnu Prakash            - For compatible property "qcom,spmi-vadc", if this property is
1125a471662SJishnu Prakash              specified VADC will use the VDD reference (1.8V) and GND for
1135a471662SJishnu Prakash              channel calibration. If property is not found, channel will be
1145a471662SJishnu Prakash              calibrated with 0.625V and 1.25V reference channels, also
1155a471662SJishnu Prakash              known as absolute calibration.
116d1492bbdSJishnu Prakash            - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
117d1492bbdSJishnu Prakash              "qcom,spmi-adc-rev2", if this property is specified VADC will use
118d1492bbdSJishnu Prakash              the VDD reference (1.875V) and GND for channel calibration. If
119d1492bbdSJishnu Prakash              property is not found, channel will be calibrated with 0V and 1.25V
120d1492bbdSJishnu Prakash              reference channels, also known as absolute calibration.
1215a471662SJishnu Prakash        type: boolean
1225a471662SJishnu Prakash
1235a471662SJishnu Prakash      qcom,hw-settle-time:
1245a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
1255a471662SJishnu Prakash        description: |
1265a471662SJishnu Prakash            Time between AMUX getting configured and the ADC starting
1275a471662SJishnu Prakash            conversion. The 'hw_settle_time' is an index used from valid values
1285a471662SJishnu Prakash            and programmed in hardware to achieve the hardware settling delay.
1295a471662SJishnu Prakash
1305a471662SJishnu Prakash      qcom,avg-samples:
1315a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
1325a471662SJishnu Prakash        description: |
1335a471662SJishnu Prakash            Number of samples to be used for measurement.
1345a471662SJishnu Prakash            Averaging provides the option to obtain a single measurement
1355a471662SJishnu Prakash            from the ADC that is an average of multiple samples. The value
1365a471662SJishnu Prakash            selected is 2^(value).
1375a471662SJishnu Prakash
1385a471662SJishnu Prakash    required:
1395a471662SJishnu Prakash      - reg
1405a471662SJishnu Prakash
1415a471662SJishnu PrakashallOf:
1425a471662SJishnu Prakash  - if:
1435a471662SJishnu Prakash      properties:
1445a471662SJishnu Prakash        compatible:
1455a471662SJishnu Prakash          contains:
1465a471662SJishnu Prakash            const: qcom,spmi-vadc
1475a471662SJishnu Prakash
1485a471662SJishnu Prakash    then:
1495a471662SJishnu Prakash      patternProperties:
150e0b79724SMarijn Suijten        "^channel@[0-9a-f]+$":
1515a471662SJishnu Prakash          properties:
1525a471662SJishnu Prakash            qcom,decimation:
1535a471662SJishnu Prakash              enum: [ 512, 1024, 2048, 4096 ]
1545a471662SJishnu Prakash              default: 512
1555a471662SJishnu Prakash
1565a471662SJishnu Prakash            qcom,hw-settle-time:
1575a471662SJishnu Prakash              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
1585a471662SJishnu Prakash                      4, 6, 8, 10 ]
1595a471662SJishnu Prakash              default: 0
1605a471662SJishnu Prakash
1615a471662SJishnu Prakash            qcom,avg-samples:
1625a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
1635a471662SJishnu Prakash              default: 1
1645a471662SJishnu Prakash
1655a471662SJishnu Prakash  - if:
1665a471662SJishnu Prakash      properties:
1675a471662SJishnu Prakash        compatible:
1685a471662SJishnu Prakash          contains:
1695a471662SJishnu Prakash            const: qcom,spmi-adc-rev2
1705a471662SJishnu Prakash
1715a471662SJishnu Prakash    then:
1725a471662SJishnu Prakash      patternProperties:
173e0b79724SMarijn Suijten        "^channel@[0-9a-f]+$":
1745a471662SJishnu Prakash          properties:
1755a471662SJishnu Prakash            qcom,decimation:
1765a471662SJishnu Prakash              enum: [ 256, 512, 1024 ]
1775a471662SJishnu Prakash              default: 1024
1785a471662SJishnu Prakash
1795a471662SJishnu Prakash            qcom,hw-settle-time:
1805a471662SJishnu Prakash              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
1815a471662SJishnu Prakash                      4, 6, 8, 10 ]
1825a471662SJishnu Prakash              default: 0
1835a471662SJishnu Prakash
1845a471662SJishnu Prakash            qcom,avg-samples:
1855a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
1865a471662SJishnu Prakash              default: 1
1875a471662SJishnu Prakash
1885a471662SJishnu Prakash  - if:
1895a471662SJishnu Prakash      properties:
1905a471662SJishnu Prakash        compatible:
1915a471662SJishnu Prakash          contains:
1925a471662SJishnu Prakash            const: qcom,spmi-adc5
1935a471662SJishnu Prakash
1945a471662SJishnu Prakash    then:
1955a471662SJishnu Prakash      patternProperties:
196e0b79724SMarijn Suijten        "^channel@[0-9a-f]+$":
1975a471662SJishnu Prakash          properties:
1985a471662SJishnu Prakash            qcom,decimation:
1995a471662SJishnu Prakash              enum: [ 250, 420, 840 ]
2005a471662SJishnu Prakash              default: 840
2015a471662SJishnu Prakash
2025a471662SJishnu Prakash            qcom,hw-settle-time:
2035a471662SJishnu Prakash              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
2045a471662SJishnu Prakash                      4, 6, 8, 10, 16, 32, 64, 128 ]
2055a471662SJishnu Prakash              default: 15
2065a471662SJishnu Prakash
2075a471662SJishnu Prakash            qcom,avg-samples:
2085a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
2095a471662SJishnu Prakash              default: 1
2105a471662SJishnu Prakash
211d1492bbdSJishnu Prakash  - if:
212d1492bbdSJishnu Prakash      properties:
213d1492bbdSJishnu Prakash        compatible:
214d1492bbdSJishnu Prakash          contains:
215d1492bbdSJishnu Prakash            const: qcom,spmi-adc7
216d1492bbdSJishnu Prakash
217d1492bbdSJishnu Prakash    then:
218d1492bbdSJishnu Prakash      patternProperties:
219e0b79724SMarijn Suijten        "^channel@[0-9a-f]+$":
220d1492bbdSJishnu Prakash          properties:
221d1492bbdSJishnu Prakash            qcom,decimation:
222d1492bbdSJishnu Prakash              enum: [ 85, 340, 1360 ]
223d1492bbdSJishnu Prakash              default: 1360
224d1492bbdSJishnu Prakash
225d1492bbdSJishnu Prakash            qcom,hw-settle-time:
226d1492bbdSJishnu Prakash              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
227d1492bbdSJishnu Prakash                      8000, 16000, 32000, 64000, 128000 ]
228d1492bbdSJishnu Prakash              default: 15
229d1492bbdSJishnu Prakash
230d1492bbdSJishnu Prakash            qcom,avg-samples:
231d1492bbdSJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
232d1492bbdSJishnu Prakash              default: 1
233d1492bbdSJishnu Prakash
2345be478f9SRob HerringadditionalProperties: false
2355be478f9SRob Herring
2365a471662SJishnu Prakashexamples:
2375a471662SJishnu Prakash  - |
238482aa83eSJohan Hovold    pmic {
2395a471662SJishnu Prakash        #address-cells = <1>;
2405a471662SJishnu Prakash        #size-cells = <0>;
241*90ae7ed9SJohan Hovold
242*90ae7ed9SJohan Hovold        adc@3100 {
2435a471662SJishnu Prakash            compatible = "qcom,spmi-vadc";
2445a471662SJishnu Prakash            reg = <0x3100>;
2455a471662SJishnu Prakash            interrupts = <0x0 0x31 0x0 0x1>;
2465a471662SJishnu Prakash            #address-cells = <1>;
2475a471662SJishnu Prakash            #size-cells = <0>;
2485a471662SJishnu Prakash            #io-channel-cells = <1>;
2495a471662SJishnu Prakash
2505a471662SJishnu Prakash            /* Channel node */
251e0b79724SMarijn Suijten            channel@39 {
2525a471662SJishnu Prakash                reg = <0x39>;
2535a471662SJishnu Prakash                qcom,decimation = <512>;
2545a471662SJishnu Prakash                qcom,ratiometric;
2555a471662SJishnu Prakash                qcom,hw-settle-time = <200>;
2565a471662SJishnu Prakash                qcom,avg-samples = <1>;
2575a471662SJishnu Prakash                qcom,pre-scaling = <1 3>;
2585a471662SJishnu Prakash            };
2595a471662SJishnu Prakash
260e0b79724SMarijn Suijten            channel@9 {
2615a471662SJishnu Prakash                reg = <0x9>;
2625a471662SJishnu Prakash            };
2635a471662SJishnu Prakash
264e0b79724SMarijn Suijten            channel@a {
2655a471662SJishnu Prakash                reg = <0xa>;
2665a471662SJishnu Prakash            };
2675a471662SJishnu Prakash
268e0b79724SMarijn Suijten            channel@e {
2695a471662SJishnu Prakash                reg = <0xe>;
2705a471662SJishnu Prakash            };
2715a471662SJishnu Prakash
272e0b79724SMarijn Suijten            channel@f {
2735a471662SJishnu Prakash                reg = <0xf>;
2745a471662SJishnu Prakash            };
2755a471662SJishnu Prakash        };
2765a471662SJishnu Prakash    };
27774e90346SKrzysztof Kozlowski
27874e90346SKrzysztof Kozlowski  - |
27974e90346SKrzysztof Kozlowski    #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
28074e90346SKrzysztof Kozlowski    #include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
28174e90346SKrzysztof Kozlowski    #include <dt-bindings/interrupt-controller/irq.h>
28274e90346SKrzysztof Kozlowski
283482aa83eSJohan Hovold    pmic {
28474e90346SKrzysztof Kozlowski        #address-cells = <1>;
28574e90346SKrzysztof Kozlowski        #size-cells = <0>;
286*90ae7ed9SJohan Hovold
28774e90346SKrzysztof Kozlowski        adc@3100 {
28874e90346SKrzysztof Kozlowski            reg = <0x3100>;
28974e90346SKrzysztof Kozlowski            compatible = "qcom,spmi-adc7";
29074e90346SKrzysztof Kozlowski            #address-cells = <1>;
29174e90346SKrzysztof Kozlowski            #size-cells = <0>;
29274e90346SKrzysztof Kozlowski            #io-channel-cells = <1>;
29374e90346SKrzysztof Kozlowski
29474e90346SKrzysztof Kozlowski            /* Other properties are omitted */
295e0b79724SMarijn Suijten            channel@44 {
29674e90346SKrzysztof Kozlowski                reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
29774e90346SKrzysztof Kozlowski                qcom,ratiometric;
29874e90346SKrzysztof Kozlowski                qcom,hw-settle-time = <200>;
299e0b79724SMarijn Suijten                label = "xo_therm";
30074e90346SKrzysztof Kozlowski            };
30174e90346SKrzysztof Kozlowski
302e0b79724SMarijn Suijten            channel@47 {
30351f7be21SKrzysztof Kozlowski                reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
30474e90346SKrzysztof Kozlowski                qcom,ratiometric;
30574e90346SKrzysztof Kozlowski                qcom,hw-settle-time = <200>;
306e0b79724SMarijn Suijten                label = "conn_therm";
30774e90346SKrzysztof Kozlowski            };
30874e90346SKrzysztof Kozlowski        };
30974e90346SKrzysztof Kozlowski    };
310