brintos

brintos / linux-shallow public Read only

0
0
Text · 8.9 KiB · c28db0d Raw
310 lines · yaml
1# SPDX-License-Identifier: GPL-2.0-only2%YAML 1.23---4$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#5$schema: http://devicetree.org/meta-schemas/core.yaml#6 7title: Qualcomm's SPMI PMIC ADC8 9maintainers:10  - Andy Gross <agross@kernel.org>11  - Bjorn Andersson <bjorn.andersson@linaro.org>12 13description: |14  SPMI PMIC voltage ADC (VADC) provides interface to clients to read15  voltage. The VADC is a 15-bit sigma-delta ADC.16  SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read17  voltage. The VADC is a 16-bit sigma-delta ADC.18 19properties:20  compatible:21    oneOf:22      - items:23          - const: qcom,pms405-adc24          - const: qcom,spmi-adc-rev225      - enum:26          - qcom,spmi-vadc27          - qcom,spmi-adc528          - qcom,spmi-adc-rev229          - qcom,spmi-adc730 31  reg:32    description: VADC base address in the SPMI PMIC register map33    maxItems: 134 35  '#address-cells':36    const: 137 38  '#size-cells':39    const: 040 41  '#io-channel-cells':42    const: 143 44  interrupts:45    maxItems: 146    description:47      End of conversion interrupt.48 49required:50  - compatible51  - reg52  - '#address-cells'53  - '#size-cells'54  - '#io-channel-cells'55 56patternProperties:57  "^channel@[0-9a-f]+$":58    type: object59    additionalProperties: false60    description: |61      Represents the external channels which are connected to the ADC.62      For compatible property "qcom,spmi-vadc" following channels, also known as63      reference point channels, are used for result calibration and their channel64      configuration nodes should be defined:65      VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,66      VADC_GND_REF and VADC_VDD_VADC.67 68    properties:69      reg:70        maxItems: 171        description: |72          ADC channel number.73          See include/dt-bindings/iio/qcom,spmi-vadc.h74          For PMIC7 ADC, the channel numbers are specified separately per PMIC75          in the PMIC-specific files in include/dt-bindings/iio/.76 77      label:78        description: |79            ADC input of the platform as seen in the schematics.80            For thermistor inputs connected to generic AMUX or GPIO inputs81            these can vary across platform for the same pins. Hence select82            the platform schematics name for this channel.83 84      qcom,decimation:85        $ref: /schemas/types.yaml#/definitions/uint3286        description: |87            This parameter is used to decrease ADC sampling rate.88            Quicker measurements can be made by reducing decimation ratio.89 90      qcom,pre-scaling:91        description: |92            Used for scaling the channel input signal before the signal is93            fed to VADC. The configuration for this node is to know the94            pre-determined ratio and use it for post scaling. It is a pair of95            integers, denoting the numerator and denominator of the fraction by which96            input signal is multiplied. For example, <1 3> indicates the signal is scaled97            down to 1/3 of its value before ADC measurement.98            If property is not found default value depending on chip will be used.99        $ref: /schemas/types.yaml#/definitions/uint32-array100        oneOf:101          - items:102              - const: 1103              - enum: [ 1, 3, 4, 6, 20, 8, 10, 16 ]104          - items:105              - const: 10106              - const: 81107 108      qcom,ratiometric:109        description: |110            Channel calibration type.111            - For compatible property "qcom,spmi-vadc", if this property is112              specified VADC will use the VDD reference (1.8V) and GND for113              channel calibration. If property is not found, channel will be114              calibrated with 0.625V and 1.25V reference channels, also115              known as absolute calibration.116            - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and117              "qcom,spmi-adc-rev2", if this property is specified VADC will use118              the VDD reference (1.875V) and GND for channel calibration. If119              property is not found, channel will be calibrated with 0V and 1.25V120              reference channels, also known as absolute calibration.121        type: boolean122 123      qcom,hw-settle-time:124        $ref: /schemas/types.yaml#/definitions/uint32125        description: |126            Time between AMUX getting configured and the ADC starting127            conversion. The 'hw_settle_time' is an index used from valid values128            and programmed in hardware to achieve the hardware settling delay.129 130      qcom,avg-samples:131        $ref: /schemas/types.yaml#/definitions/uint32132        description: |133            Number of samples to be used for measurement.134            Averaging provides the option to obtain a single measurement135            from the ADC that is an average of multiple samples. The value136            selected is 2^(value).137 138    required:139      - reg140 141allOf:142  - if:143      properties:144        compatible:145          contains:146            const: qcom,spmi-vadc147 148    then:149      patternProperties:150        "^channel@[0-9a-f]+$":151          properties:152            qcom,decimation:153              enum: [ 512, 1024, 2048, 4096 ]154              default: 512155 156            qcom,hw-settle-time:157              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,158                      4, 6, 8, 10 ]159              default: 0160 161            qcom,avg-samples:162              enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]163              default: 1164 165  - if:166      properties:167        compatible:168          contains:169            const: qcom,spmi-adc-rev2170 171    then:172      patternProperties:173        "^channel@[0-9a-f]+$":174          properties:175            qcom,decimation:176              enum: [ 256, 512, 1024 ]177              default: 1024178 179            qcom,hw-settle-time:180              enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,181                      4, 6, 8, 10 ]182              default: 0183 184            qcom,avg-samples:185              enum: [ 1, 2, 4, 8, 16 ]186              default: 1187 188  - if:189      properties:190        compatible:191          contains:192            const: qcom,spmi-adc5193 194    then:195      patternProperties:196        "^channel@[0-9a-f]+$":197          properties:198            qcom,decimation:199              enum: [ 250, 420, 840 ]200              default: 840201 202            qcom,hw-settle-time:203              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,204                      4, 6, 8, 10, 16, 32, 64, 128 ]205              default: 15206 207            qcom,avg-samples:208              enum: [ 1, 2, 4, 8, 16 ]209              default: 1210 211  - if:212      properties:213        compatible:214          contains:215            const: qcom,spmi-adc7216 217    then:218      patternProperties:219        "^channel@[0-9a-f]+$":220          properties:221            qcom,decimation:222              enum: [ 85, 340, 1360 ]223              default: 1360224 225            qcom,hw-settle-time:226              enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,227                      8000, 16000, 32000, 64000, 128000 ]228              default: 15229 230            qcom,avg-samples:231              enum: [ 1, 2, 4, 8, 16 ]232              default: 1233 234additionalProperties: false235 236examples:237  - |238    pmic {239        #address-cells = <1>;240        #size-cells = <0>;241 242        adc@3100 {243            compatible = "qcom,spmi-vadc";244            reg = <0x3100>;245            interrupts = <0x0 0x31 0x0 0x1>;246            #address-cells = <1>;247            #size-cells = <0>;248            #io-channel-cells = <1>;249 250            /* Channel node */251            channel@39 {252                reg = <0x39>;253                qcom,decimation = <512>;254                qcom,ratiometric;255                qcom,hw-settle-time = <200>;256                qcom,avg-samples = <1>;257                qcom,pre-scaling = <1 3>;258            };259 260            channel@9 {261                reg = <0x9>;262            };263 264            channel@a {265                reg = <0xa>;266            };267 268            channel@e {269                reg = <0xe>;270            };271 272            channel@f {273                reg = <0xf>;274            };275        };276    };277 278  - |279    #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>280    #include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>281    #include <dt-bindings/interrupt-controller/irq.h>282 283    pmic {284        #address-cells = <1>;285        #size-cells = <0>;286 287        adc@3100 {288            reg = <0x3100>;289            compatible = "qcom,spmi-adc7";290            #address-cells = <1>;291            #size-cells = <0>;292            #io-channel-cells = <1>;293 294            /* Other properties are omitted */295            channel@44 {296                reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;297                qcom,ratiometric;298                qcom,hw-settle-time = <200>;299                label = "xo_therm";300            };301 302            channel@47 {303                reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>;304                qcom,ratiometric;305                qcom,hw-settle-time = <200>;306                label = "conn_therm";307            };308        };309    };310