Back to home page

OSCL-LXR

 
 

    


0001 # SPDX-License-Identifier: GPL-2.0-only
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006 
0007 title: Qualcomm's SPMI PMIC ADC
0008 
0009 maintainers:
0010   - Andy Gross <agross@kernel.org>
0011   - Bjorn Andersson <bjorn.andersson@linaro.org>
0012 
0013 description: |
0014   SPMI PMIC voltage ADC (VADC) provides interface to clients to read
0015   voltage. The VADC is a 15-bit sigma-delta ADC.
0016   SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read
0017   voltage. The VADC is a 16-bit sigma-delta ADC.
0018 
0019 properties:
0020   compatible:
0021     oneOf:
0022       - items:
0023           - const: qcom,pms405-adc
0024           - const: qcom,spmi-adc-rev2
0025 
0026       - items:
0027           - enum:
0028               - qcom,spmi-vadc
0029               - qcom,spmi-adc5
0030               - qcom,spmi-adc-rev2
0031               - qcom,spmi-adc7
0032 
0033   reg:
0034     description: VADC base address in the SPMI PMIC register map
0035     maxItems: 1
0036 
0037   '#address-cells':
0038     const: 1
0039 
0040   '#size-cells':
0041     const: 0
0042 
0043   '#io-channel-cells':
0044     const: 1
0045 
0046   interrupts:
0047     maxItems: 1
0048     description:
0049       End of conversion interrupt.
0050 
0051 required:
0052   - compatible
0053   - reg
0054   - '#address-cells'
0055   - '#size-cells'
0056   - '#io-channel-cells'
0057 
0058 patternProperties:
0059   "^.*@[0-9a-f]+$":
0060     type: object
0061     description: |
0062       Represents the external channels which are connected to the ADC.
0063       For compatible property "qcom,spmi-vadc" following channels, also known as
0064       reference point channels, are used for result calibration and their channel
0065       configuration nodes should be defined:
0066       VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV,
0067       VADC_GND_REF and VADC_VDD_VADC.
0068 
0069     properties:
0070       reg:
0071         maxItems: 1
0072         description: |
0073           ADC channel number.
0074           See include/dt-bindings/iio/qcom,spmi-vadc.h
0075           For PMIC7 ADC, the channel numbers are specified separately per PMIC
0076           in the PMIC-specific files in include/dt-bindings/iio/.
0077 
0078       label:
0079         $ref: /schemas/types.yaml#/definitions/string
0080         description: |
0081             ADC input of the platform as seen in the schematics.
0082             For thermistor inputs connected to generic AMUX or GPIO inputs
0083             these can vary across platform for the same pins. Hence select
0084             the platform schematics name for this channel.
0085 
0086       qcom,decimation:
0087         $ref: /schemas/types.yaml#/definitions/uint32
0088         description: |
0089             This parameter is used to decrease ADC sampling rate.
0090             Quicker measurements can be made by reducing decimation ratio.
0091 
0092       qcom,pre-scaling:
0093         description: |
0094             Used for scaling the channel input signal before the signal is
0095             fed to VADC. The configuration for this node is to know the
0096             pre-determined ratio and use it for post scaling. It is a pair of
0097             integers, denoting the numerator and denominator of the fraction by which
0098             input signal is multiplied. For example, <1 3> indicates the signal is scaled
0099             down to 1/3 of its value before ADC measurement.
0100             If property is not found default value depending on chip will be used.
0101         $ref: /schemas/types.yaml#/definitions/uint32-array
0102         oneOf:
0103           - items:
0104               - const: 1
0105               - enum: [ 1, 3, 4, 6, 20, 8, 10 ]
0106           - items:
0107               - const: 10
0108               - const: 81
0109 
0110       qcom,ratiometric:
0111         description: |
0112             Channel calibration type.
0113             - For compatible property "qcom,spmi-vadc", if this property is
0114               specified VADC will use the VDD reference (1.8V) and GND for
0115               channel calibration. If property is not found, channel will be
0116               calibrated with 0.625V and 1.25V reference channels, also
0117               known as absolute calibration.
0118             - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and
0119               "qcom,spmi-adc-rev2", if this property is specified VADC will use
0120               the VDD reference (1.875V) and GND for channel calibration. If
0121               property is not found, channel will be calibrated with 0V and 1.25V
0122               reference channels, also known as absolute calibration.
0123         type: boolean
0124 
0125       qcom,hw-settle-time:
0126         $ref: /schemas/types.yaml#/definitions/uint32
0127         description: |
0128             Time between AMUX getting configured and the ADC starting
0129             conversion. The 'hw_settle_time' is an index used from valid values
0130             and programmed in hardware to achieve the hardware settling delay.
0131 
0132       qcom,avg-samples:
0133         $ref: /schemas/types.yaml#/definitions/uint32
0134         description: |
0135             Number of samples to be used for measurement.
0136             Averaging provides the option to obtain a single measurement
0137             from the ADC that is an average of multiple samples. The value
0138             selected is 2^(value).
0139 
0140     required:
0141       - reg
0142 
0143 allOf:
0144   - if:
0145       properties:
0146         compatible:
0147           contains:
0148             const: qcom,spmi-vadc
0149 
0150     then:
0151       patternProperties:
0152         "^.*@[0-9a-f]+$":
0153           properties:
0154             qcom,decimation:
0155               enum: [ 512, 1024, 2048, 4096 ]
0156               default: 512
0157 
0158             qcom,hw-settle-time:
0159               enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
0160                       4, 6, 8, 10 ]
0161               default: 0
0162 
0163             qcom,avg-samples:
0164               enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ]
0165               default: 1
0166 
0167   - if:
0168       properties:
0169         compatible:
0170           contains:
0171             const: qcom,spmi-adc-rev2
0172 
0173     then:
0174       patternProperties:
0175         "^.*@[0-9a-f]+$":
0176           properties:
0177             qcom,decimation:
0178               enum: [ 256, 512, 1024 ]
0179               default: 1024
0180 
0181             qcom,hw-settle-time:
0182               enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
0183                       4, 6, 8, 10 ]
0184               default: 0
0185 
0186             qcom,avg-samples:
0187               enum: [ 1, 2, 4, 8, 16 ]
0188               default: 1
0189 
0190   - if:
0191       properties:
0192         compatible:
0193           contains:
0194             const: qcom,spmi-adc5
0195 
0196     then:
0197       patternProperties:
0198         "^.*@[0-9a-f]+$":
0199           properties:
0200             qcom,decimation:
0201               enum: [ 250, 420, 840 ]
0202               default: 840
0203 
0204             qcom,hw-settle-time:
0205               enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2,
0206                       4, 6, 8, 10, 16, 32, 64, 128 ]
0207               default: 15
0208 
0209             qcom,avg-samples:
0210               enum: [ 1, 2, 4, 8, 16 ]
0211               default: 1
0212 
0213   - if:
0214       properties:
0215         compatible:
0216           contains:
0217             const: qcom,spmi-adc7
0218 
0219     then:
0220       patternProperties:
0221         "^.*@[0-9a-f]+$":
0222           properties:
0223             qcom,decimation:
0224               enum: [ 85, 340, 1360 ]
0225               default: 1360
0226 
0227             qcom,hw-settle-time:
0228               enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000,
0229                       8000, 16000, 32000, 64000, 128000 ]
0230               default: 15
0231 
0232             qcom,avg-samples:
0233               enum: [ 1, 2, 4, 8, 16 ]
0234               default: 1
0235 
0236 additionalProperties: false
0237 
0238 examples:
0239   - |
0240     spmi_bus {
0241       #address-cells = <1>;
0242       #size-cells = <0>;
0243       /* VADC node */
0244       pmic_vadc: adc@3100 {
0245         compatible = "qcom,spmi-vadc";
0246         reg = <0x3100>;
0247         interrupts = <0x0 0x31 0x0 0x1>;
0248         #address-cells = <1>;
0249         #size-cells = <0>;
0250         #io-channel-cells = <1>;
0251 
0252         /* Channel node */
0253         adc-chan@39 {
0254           reg = <0x39>;
0255           qcom,decimation = <512>;
0256           qcom,ratiometric;
0257           qcom,hw-settle-time = <200>;
0258           qcom,avg-samples = <1>;
0259           qcom,pre-scaling = <1 3>;
0260         };
0261 
0262         adc-chan@9 {
0263           reg = <0x9>;
0264         };
0265 
0266         adc-chan@a {
0267           reg = <0xa>;
0268         };
0269 
0270         adc-chan@e {
0271           reg = <0xe>;
0272         };
0273 
0274         adc-chan@f {
0275           reg = <0xf>;
0276         };
0277       };
0278     };