xref: /linux/Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml (revision 5f0b06da5cde3f0a613308b89f0afea678559fdf)
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
265a471662SJishnu Prakash      - items:
275a471662SJishnu Prakash          - enum:
285a471662SJishnu Prakash              - qcom,spmi-vadc
295a471662SJishnu Prakash              - qcom,spmi-adc5
305a471662SJishnu Prakash              - qcom,spmi-adc-rev2
31d1492bbdSJishnu Prakash              - qcom,spmi-adc7
325a471662SJishnu Prakash
335a471662SJishnu Prakash  reg:
345a471662SJishnu Prakash    description: VADC base address in the SPMI PMIC register map
355a471662SJishnu Prakash    maxItems: 1
365a471662SJishnu Prakash
375a471662SJishnu Prakash  '#address-cells':
385a471662SJishnu Prakash    const: 1
395a471662SJishnu Prakash
405a471662SJishnu Prakash  '#size-cells':
415a471662SJishnu Prakash    const: 0
425a471662SJishnu Prakash
435a471662SJishnu Prakash  '#io-channel-cells':
445a471662SJishnu Prakash    const: 1
455a471662SJishnu Prakash
465a471662SJishnu Prakash  interrupts:
475a471662SJishnu Prakash    maxItems: 1
485a471662SJishnu Prakash    description:
495a471662SJishnu Prakash      End of conversion interrupt.
505a471662SJishnu Prakash
515a471662SJishnu Prakashrequired:
525a471662SJishnu Prakash  - compatible
535a471662SJishnu Prakash  - reg
545a471662SJishnu Prakash  - '#address-cells'
555a471662SJishnu Prakash  - '#size-cells'
565a471662SJishnu Prakash  - '#io-channel-cells'
575a471662SJishnu Prakash
585a471662SJishnu PrakashpatternProperties:
595a471662SJishnu Prakash  "^.*@[0-9a-f]+$":
605a471662SJishnu Prakash    type: object
615a471662SJishnu Prakash    description: |
625a471662SJishnu Prakash      Represents the external channels which are connected to the ADC.
635a471662SJishnu Prakash      For compatible property "qcom,spmi-vadc" following channels, also known as
645a471662SJishnu Prakash      reference point channels, are used for result calibration and their channel
655a471662SJishnu Prakash      configuration nodes should be defined:
665a471662SJishnu Prakash      VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
675a471662SJishnu Prakash      VADC_GND_REF and VADC_VDD_VADC.
685a471662SJishnu Prakash
695a471662SJishnu Prakash    properties:
705a471662SJishnu Prakash      reg:
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        $ref: /schemas/types.yaml#/definitions/string
795a471662SJishnu Prakash        description: |
805a471662SJishnu Prakash            ADC input of the platform as seen in the schematics.
815a471662SJishnu Prakash            For thermistor inputs connected to generic AMUX or GPIO inputs
825a471662SJishnu Prakash            these can vary across platform for the same pins. Hence select
835a471662SJishnu Prakash            the platform schematics name for this channel.
845a471662SJishnu Prakash
855a471662SJishnu Prakash      qcom,decimation:
865a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
875a471662SJishnu Prakash        description: |
885a471662SJishnu Prakash            This parameter is used to decrease ADC sampling rate.
895a471662SJishnu Prakash            Quicker measurements can be made by reducing decimation ratio.
905a471662SJishnu Prakash
915a471662SJishnu Prakash      qcom,pre-scaling:
925a471662SJishnu Prakash        description: |
935a471662SJishnu Prakash            Used for scaling the channel input signal before the signal is
945a471662SJishnu Prakash            fed to VADC. The configuration for this node is to know the
955a471662SJishnu Prakash            pre-determined ratio and use it for post scaling. It is a pair of
965a471662SJishnu Prakash            integers, denoting the numerator and denominator of the fraction by which
975a471662SJishnu Prakash            input signal is multiplied. For example, <1 3> indicates the signal is scaled
985a471662SJishnu Prakash            down to 1/3 of its value before ADC measurement.
995a471662SJishnu Prakash            If property is not found default value depending on chip will be used.
100*5f0b06daSRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
1015a471662SJishnu Prakash        oneOf:
1025a471662SJishnu Prakash          - items:
1035a471662SJishnu Prakash              - const: 1
1045a471662SJishnu Prakash              - enum: [ 1, 3, 4, 6, 20, 8, 10 ]
1055a471662SJishnu Prakash          - items:
1065a471662SJishnu Prakash              - const: 10
1075a471662SJishnu Prakash              - const: 81
1085a471662SJishnu Prakash
1095a471662SJishnu Prakash      qcom,ratiometric:
1105a471662SJishnu Prakash        description: |
1115a471662SJishnu Prakash            Channel calibration type.
1125a471662SJishnu Prakash            - For compatible property "qcom,spmi-vadc", if this property is
1135a471662SJishnu Prakash              specified VADC will use the VDD reference (1.8V) and GND for
1145a471662SJishnu Prakash              channel calibration. If property is not found, channel will be
1155a471662SJishnu Prakash              calibrated with 0.625V and 1.25V reference channels, also
1165a471662SJishnu Prakash              known as absolute calibration.
117d1492bbdSJishnu Prakash            - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
118d1492bbdSJishnu Prakash              "qcom,spmi-adc-rev2", if this property is specified VADC will use
119d1492bbdSJishnu Prakash              the VDD reference (1.875V) and GND for channel calibration. If
120d1492bbdSJishnu Prakash              property is not found, channel will be calibrated with 0V and 1.25V
121d1492bbdSJishnu Prakash              reference channels, also known as absolute calibration.
1225a471662SJishnu Prakash        type: boolean
1235a471662SJishnu Prakash
1245a471662SJishnu Prakash      qcom,hw-settle-time:
1255a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
1265a471662SJishnu Prakash        description: |
1275a471662SJishnu Prakash            Time between AMUX getting configured and the ADC starting
1285a471662SJishnu Prakash            conversion. The 'hw_settle_time' is an index used from valid values
1295a471662SJishnu Prakash            and programmed in hardware to achieve the hardware settling delay.
1305a471662SJishnu Prakash
1315a471662SJishnu Prakash      qcom,avg-samples:
1325a471662SJishnu Prakash        $ref: /schemas/types.yaml#/definitions/uint32
1335a471662SJishnu Prakash        description: |
1345a471662SJishnu Prakash            Number of samples to be used for measurement.
1355a471662SJishnu Prakash            Averaging provides the option to obtain a single measurement
1365a471662SJishnu Prakash            from the ADC that is an average of multiple samples. The value
1375a471662SJishnu Prakash            selected is 2^(value).
1385a471662SJishnu Prakash
1395a471662SJishnu Prakash    required:
1405a471662SJishnu Prakash      - reg
1415a471662SJishnu Prakash
1425a471662SJishnu PrakashallOf:
1435a471662SJishnu Prakash  - if:
1445a471662SJishnu Prakash      properties:
1455a471662SJishnu Prakash        compatible:
1465a471662SJishnu Prakash          contains:
1475a471662SJishnu Prakash            const: qcom,spmi-vadc
1485a471662SJishnu Prakash
1495a471662SJishnu Prakash    then:
1505a471662SJishnu Prakash      patternProperties:
1515a471662SJishnu Prakash        "^.*@[0-9a-f]+$":
1525a471662SJishnu Prakash          properties:
1535a471662SJishnu Prakash            qcom,decimation:
1545a471662SJishnu Prakash              enum: [ 512, 1024, 2048, 4096 ]
1555a471662SJishnu Prakash              default: 512
1565a471662SJishnu Prakash
1575a471662SJishnu Prakash            qcom,hw-settle-time:
1585a471662SJishnu Prakash              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
1595a471662SJishnu Prakash                      4, 6, 8, 10 ]
1605a471662SJishnu Prakash              default: 0
1615a471662SJishnu Prakash
1625a471662SJishnu Prakash            qcom,avg-samples:
1635a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
1645a471662SJishnu Prakash              default: 1
1655a471662SJishnu Prakash
1665a471662SJishnu Prakash  - if:
1675a471662SJishnu Prakash      properties:
1685a471662SJishnu Prakash        compatible:
1695a471662SJishnu Prakash          contains:
1705a471662SJishnu Prakash            const: qcom,spmi-adc-rev2
1715a471662SJishnu Prakash
1725a471662SJishnu Prakash    then:
1735a471662SJishnu Prakash      patternProperties:
1745a471662SJishnu Prakash        "^.*@[0-9a-f]+$":
1755a471662SJishnu Prakash          properties:
1765a471662SJishnu Prakash            qcom,decimation:
1775a471662SJishnu Prakash              enum: [ 256, 512, 1024 ]
1785a471662SJishnu Prakash              default: 1024
1795a471662SJishnu Prakash
1805a471662SJishnu Prakash            qcom,hw-settle-time:
1815a471662SJishnu Prakash              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
1825a471662SJishnu Prakash                      4, 6, 8, 10 ]
1835a471662SJishnu Prakash              default: 0
1845a471662SJishnu Prakash
1855a471662SJishnu Prakash            qcom,avg-samples:
1865a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
1875a471662SJishnu Prakash              default: 1
1885a471662SJishnu Prakash
1895a471662SJishnu Prakash  - if:
1905a471662SJishnu Prakash      properties:
1915a471662SJishnu Prakash        compatible:
1925a471662SJishnu Prakash          contains:
1935a471662SJishnu Prakash            const: qcom,spmi-adc5
1945a471662SJishnu Prakash
1955a471662SJishnu Prakash    then:
1965a471662SJishnu Prakash      patternProperties:
1975a471662SJishnu Prakash        "^.*@[0-9a-f]+$":
1985a471662SJishnu Prakash          properties:
1995a471662SJishnu Prakash            qcom,decimation:
2005a471662SJishnu Prakash              enum: [ 250, 420, 840 ]
2015a471662SJishnu Prakash              default: 840
2025a471662SJishnu Prakash
2035a471662SJishnu Prakash            qcom,hw-settle-time:
2045a471662SJishnu Prakash              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
2055a471662SJishnu Prakash                      4, 6, 8, 10, 16, 32, 64, 128 ]
2065a471662SJishnu Prakash              default: 15
2075a471662SJishnu Prakash
2085a471662SJishnu Prakash            qcom,avg-samples:
2095a471662SJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
2105a471662SJishnu Prakash              default: 1
2115a471662SJishnu Prakash
212d1492bbdSJishnu Prakash  - if:
213d1492bbdSJishnu Prakash      properties:
214d1492bbdSJishnu Prakash        compatible:
215d1492bbdSJishnu Prakash          contains:
216d1492bbdSJishnu Prakash            const: qcom,spmi-adc7
217d1492bbdSJishnu Prakash
218d1492bbdSJishnu Prakash    then:
219d1492bbdSJishnu Prakash      patternProperties:
220d1492bbdSJishnu Prakash        "^.*@[0-9a-f]+$":
221d1492bbdSJishnu Prakash          properties:
222d1492bbdSJishnu Prakash            qcom,decimation:
223d1492bbdSJishnu Prakash              enum: [ 85, 340, 1360 ]
224d1492bbdSJishnu Prakash              default: 1360
225d1492bbdSJishnu Prakash
226d1492bbdSJishnu Prakash            qcom,hw-settle-time:
227d1492bbdSJishnu Prakash              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
228d1492bbdSJishnu Prakash                      8000, 16000, 32000, 64000, 128000 ]
229d1492bbdSJishnu Prakash              default: 15
230d1492bbdSJishnu Prakash
231d1492bbdSJishnu Prakash            qcom,avg-samples:
232d1492bbdSJishnu Prakash              enum: [ 1, 2, 4, 8, 16 ]
233d1492bbdSJishnu Prakash              default: 1
234d1492bbdSJishnu Prakash
2355a471662SJishnu Prakashexamples:
2365a471662SJishnu Prakash  - |
2375a471662SJishnu Prakash    spmi_bus {
2385a471662SJishnu Prakash      #address-cells = <1>;
2395a471662SJishnu Prakash      #size-cells = <0>;
2405a471662SJishnu Prakash      /* VADC node */
2415a471662SJishnu Prakash      pmic_vadc: adc@3100 {
2425a471662SJishnu Prakash        compatible = "qcom,spmi-vadc";
2435a471662SJishnu Prakash        reg = <0x3100>;
2445a471662SJishnu Prakash        interrupts = <0x0 0x31 0x0 0x1>;
2455a471662SJishnu Prakash        #address-cells = <1>;
2465a471662SJishnu Prakash        #size-cells = <0>;
2475a471662SJishnu Prakash        #io-channel-cells = <1>;
2485a471662SJishnu Prakash        io-channel-ranges;
2495a471662SJishnu Prakash
2505a471662SJishnu Prakash        /* Channel node */
2515a471662SJishnu Prakash        adc-chan@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
2605a471662SJishnu Prakash        adc-chan@9 {
2615a471662SJishnu Prakash          reg = <0x9>;
2625a471662SJishnu Prakash        };
2635a471662SJishnu Prakash
2645a471662SJishnu Prakash        adc-chan@a {
2655a471662SJishnu Prakash          reg = <0xa>;
2665a471662SJishnu Prakash        };
2675a471662SJishnu Prakash
2685a471662SJishnu Prakash        adc-chan@e {
2695a471662SJishnu Prakash          reg = <0xe>;
2705a471662SJishnu Prakash        };
2715a471662SJishnu Prakash
2725a471662SJishnu Prakash        adc-chan@f {
2735a471662SJishnu Prakash          reg = <0xf>;
2745a471662SJishnu Prakash        };
2755a471662SJishnu Prakash      };
2765a471662SJishnu Prakash    };
277