1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only 2c66ec88fSEmmanuel Vadot%YAML 1.2 3c66ec88fSEmmanuel Vadot--- 4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-vadc.yaml# 5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6c66ec88fSEmmanuel Vadot 7c66ec88fSEmmanuel Vadottitle: Qualcomm's SPMI PMIC ADC 8c66ec88fSEmmanuel Vadot 9c66ec88fSEmmanuel Vadotmaintainers: 10c66ec88fSEmmanuel Vadot - Andy Gross <agross@kernel.org> 11c66ec88fSEmmanuel Vadot - Bjorn Andersson <bjorn.andersson@linaro.org> 12c66ec88fSEmmanuel Vadot 13c66ec88fSEmmanuel Vadotdescription: | 14c66ec88fSEmmanuel Vadot SPMI PMIC voltage ADC (VADC) provides interface to clients to read 15c66ec88fSEmmanuel Vadot voltage. The VADC is a 15-bit sigma-delta ADC. 16c66ec88fSEmmanuel Vadot SPMI PMIC5/PMIC7 voltage ADC (ADC) provides interface to clients to read 17c66ec88fSEmmanuel Vadot voltage. The VADC is a 16-bit sigma-delta ADC. 18c66ec88fSEmmanuel Vadot 19c66ec88fSEmmanuel Vadotproperties: 20c66ec88fSEmmanuel Vadot compatible: 21c66ec88fSEmmanuel Vadot oneOf: 22c66ec88fSEmmanuel Vadot - items: 23c66ec88fSEmmanuel Vadot - const: qcom,pms405-adc 24c66ec88fSEmmanuel Vadot - const: qcom,spmi-adc-rev2 25c66ec88fSEmmanuel Vadot - enum: 26c66ec88fSEmmanuel Vadot - qcom,spmi-vadc 27c66ec88fSEmmanuel Vadot - qcom,spmi-adc5 28c66ec88fSEmmanuel Vadot - qcom,spmi-adc-rev2 29c66ec88fSEmmanuel Vadot - qcom,spmi-adc7 30c66ec88fSEmmanuel Vadot 31c66ec88fSEmmanuel Vadot reg: 32c66ec88fSEmmanuel Vadot description: VADC base address in the SPMI PMIC register map 33c66ec88fSEmmanuel Vadot maxItems: 1 34c66ec88fSEmmanuel Vadot 35c66ec88fSEmmanuel Vadot '#address-cells': 36c66ec88fSEmmanuel Vadot const: 1 37c66ec88fSEmmanuel Vadot 38c66ec88fSEmmanuel Vadot '#size-cells': 39c66ec88fSEmmanuel Vadot const: 0 40c66ec88fSEmmanuel Vadot 41c66ec88fSEmmanuel Vadot '#io-channel-cells': 42c66ec88fSEmmanuel Vadot const: 1 43c66ec88fSEmmanuel Vadot 44c66ec88fSEmmanuel Vadot interrupts: 45c66ec88fSEmmanuel Vadot maxItems: 1 46c66ec88fSEmmanuel Vadot description: 47c66ec88fSEmmanuel Vadot End of conversion interrupt. 48c66ec88fSEmmanuel Vadot 49c66ec88fSEmmanuel Vadotrequired: 50c66ec88fSEmmanuel Vadot - compatible 51c66ec88fSEmmanuel Vadot - reg 52c66ec88fSEmmanuel Vadot - '#address-cells' 53c66ec88fSEmmanuel Vadot - '#size-cells' 54c66ec88fSEmmanuel Vadot - '#io-channel-cells' 55c66ec88fSEmmanuel Vadot 56c66ec88fSEmmanuel VadotpatternProperties: 57f126890aSEmmanuel Vadot "^channel@[0-9a-f]+$": 58c66ec88fSEmmanuel Vadot type: object 597ef62cebSEmmanuel Vadot additionalProperties: false 60c66ec88fSEmmanuel Vadot description: | 61c66ec88fSEmmanuel Vadot Represents the external channels which are connected to the ADC. 62c66ec88fSEmmanuel Vadot For compatible property "qcom,spmi-vadc" following channels, also known as 63c66ec88fSEmmanuel Vadot reference point channels, are used for result calibration and their channel 64c66ec88fSEmmanuel Vadot configuration nodes should be defined: 65c66ec88fSEmmanuel Vadot VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV, 66c66ec88fSEmmanuel Vadot VADC_GND_REF and VADC_VDD_VADC. 67c66ec88fSEmmanuel Vadot 68c66ec88fSEmmanuel Vadot properties: 69c66ec88fSEmmanuel Vadot reg: 705def4c47SEmmanuel Vadot maxItems: 1 71c66ec88fSEmmanuel Vadot description: | 72c66ec88fSEmmanuel Vadot ADC channel number. 73c66ec88fSEmmanuel Vadot See include/dt-bindings/iio/qcom,spmi-vadc.h 74c66ec88fSEmmanuel Vadot For PMIC7 ADC, the channel numbers are specified separately per PMIC 75c66ec88fSEmmanuel Vadot in the PMIC-specific files in include/dt-bindings/iio/. 76c66ec88fSEmmanuel Vadot 77c66ec88fSEmmanuel Vadot label: 78c66ec88fSEmmanuel Vadot description: | 79c66ec88fSEmmanuel Vadot ADC input of the platform as seen in the schematics. 80c66ec88fSEmmanuel Vadot For thermistor inputs connected to generic AMUX or GPIO inputs 81c66ec88fSEmmanuel Vadot these can vary across platform for the same pins. Hence select 82c66ec88fSEmmanuel Vadot the platform schematics name for this channel. 83c66ec88fSEmmanuel Vadot 84c66ec88fSEmmanuel Vadot qcom,decimation: 85c66ec88fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 86c66ec88fSEmmanuel Vadot description: | 87c66ec88fSEmmanuel Vadot This parameter is used to decrease ADC sampling rate. 88c66ec88fSEmmanuel Vadot Quicker measurements can be made by reducing decimation ratio. 89c66ec88fSEmmanuel Vadot 90c66ec88fSEmmanuel Vadot qcom,pre-scaling: 91c66ec88fSEmmanuel Vadot description: | 92c66ec88fSEmmanuel Vadot Used for scaling the channel input signal before the signal is 93c66ec88fSEmmanuel Vadot fed to VADC. The configuration for this node is to know the 94c66ec88fSEmmanuel Vadot pre-determined ratio and use it for post scaling. It is a pair of 95c66ec88fSEmmanuel Vadot integers, denoting the numerator and denominator of the fraction by which 96c66ec88fSEmmanuel Vadot input signal is multiplied. For example, <1 3> indicates the signal is scaled 97c66ec88fSEmmanuel Vadot down to 1/3 of its value before ADC measurement. 98c66ec88fSEmmanuel Vadot If property is not found default value depending on chip will be used. 99c66ec88fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32-array 100c66ec88fSEmmanuel Vadot oneOf: 101c66ec88fSEmmanuel Vadot - items: 102c66ec88fSEmmanuel Vadot - const: 1 103f126890aSEmmanuel Vadot - enum: [ 1, 3, 4, 6, 20, 8, 10, 16 ] 104c66ec88fSEmmanuel Vadot - items: 105c66ec88fSEmmanuel Vadot - const: 10 106c66ec88fSEmmanuel Vadot - const: 81 107c66ec88fSEmmanuel Vadot 108c66ec88fSEmmanuel Vadot qcom,ratiometric: 109c66ec88fSEmmanuel Vadot description: | 110c66ec88fSEmmanuel Vadot Channel calibration type. 111c66ec88fSEmmanuel Vadot - For compatible property "qcom,spmi-vadc", if this property is 112c66ec88fSEmmanuel Vadot specified VADC will use the VDD reference (1.8V) and GND for 113c66ec88fSEmmanuel Vadot channel calibration. If property is not found, channel will be 114c66ec88fSEmmanuel Vadot calibrated with 0.625V and 1.25V reference channels, also 115c66ec88fSEmmanuel Vadot known as absolute calibration. 116c66ec88fSEmmanuel Vadot - For compatible property "qcom,spmi-adc5", "qcom,spmi-adc7" and 117c66ec88fSEmmanuel Vadot "qcom,spmi-adc-rev2", if this property is specified VADC will use 118c66ec88fSEmmanuel Vadot the VDD reference (1.875V) and GND for channel calibration. If 119c66ec88fSEmmanuel Vadot property is not found, channel will be calibrated with 0V and 1.25V 120c66ec88fSEmmanuel Vadot reference channels, also known as absolute calibration. 121c66ec88fSEmmanuel Vadot type: boolean 122c66ec88fSEmmanuel Vadot 123c66ec88fSEmmanuel Vadot qcom,hw-settle-time: 124c66ec88fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 125c66ec88fSEmmanuel Vadot description: | 126c66ec88fSEmmanuel Vadot Time between AMUX getting configured and the ADC starting 127c66ec88fSEmmanuel Vadot conversion. The 'hw_settle_time' is an index used from valid values 128c66ec88fSEmmanuel Vadot and programmed in hardware to achieve the hardware settling delay. 129c66ec88fSEmmanuel Vadot 130c66ec88fSEmmanuel Vadot qcom,avg-samples: 131c66ec88fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint32 132c66ec88fSEmmanuel Vadot description: | 133c66ec88fSEmmanuel Vadot Number of samples to be used for measurement. 134c66ec88fSEmmanuel Vadot Averaging provides the option to obtain a single measurement 135c66ec88fSEmmanuel Vadot from the ADC that is an average of multiple samples. The value 136c66ec88fSEmmanuel Vadot selected is 2^(value). 137c66ec88fSEmmanuel Vadot 138c66ec88fSEmmanuel Vadot required: 139c66ec88fSEmmanuel Vadot - reg 140c66ec88fSEmmanuel Vadot 141c66ec88fSEmmanuel VadotallOf: 142c66ec88fSEmmanuel Vadot - if: 143c66ec88fSEmmanuel Vadot properties: 144c66ec88fSEmmanuel Vadot compatible: 145c66ec88fSEmmanuel Vadot contains: 146c66ec88fSEmmanuel Vadot const: qcom,spmi-vadc 147c66ec88fSEmmanuel Vadot 148c66ec88fSEmmanuel Vadot then: 149c66ec88fSEmmanuel Vadot patternProperties: 150f126890aSEmmanuel Vadot "^channel@[0-9a-f]+$": 151c66ec88fSEmmanuel Vadot properties: 152c66ec88fSEmmanuel Vadot qcom,decimation: 153c66ec88fSEmmanuel Vadot enum: [ 512, 1024, 2048, 4096 ] 154c66ec88fSEmmanuel Vadot default: 512 155c66ec88fSEmmanuel Vadot 156c66ec88fSEmmanuel Vadot qcom,hw-settle-time: 157c66ec88fSEmmanuel Vadot enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2, 158c66ec88fSEmmanuel Vadot 4, 6, 8, 10 ] 159c66ec88fSEmmanuel Vadot default: 0 160c66ec88fSEmmanuel Vadot 161c66ec88fSEmmanuel Vadot qcom,avg-samples: 162c66ec88fSEmmanuel Vadot enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ] 163c66ec88fSEmmanuel Vadot default: 1 164c66ec88fSEmmanuel Vadot 165c66ec88fSEmmanuel Vadot - if: 166c66ec88fSEmmanuel Vadot properties: 167c66ec88fSEmmanuel Vadot compatible: 168c66ec88fSEmmanuel Vadot contains: 169c66ec88fSEmmanuel Vadot const: qcom,spmi-adc-rev2 170c66ec88fSEmmanuel Vadot 171c66ec88fSEmmanuel Vadot then: 172c66ec88fSEmmanuel Vadot patternProperties: 173f126890aSEmmanuel Vadot "^channel@[0-9a-f]+$": 174c66ec88fSEmmanuel Vadot properties: 175c66ec88fSEmmanuel Vadot qcom,decimation: 176c66ec88fSEmmanuel Vadot enum: [ 256, 512, 1024 ] 177c66ec88fSEmmanuel Vadot default: 1024 178c66ec88fSEmmanuel Vadot 179c66ec88fSEmmanuel Vadot qcom,hw-settle-time: 180c66ec88fSEmmanuel Vadot enum: [ 0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2, 181c66ec88fSEmmanuel Vadot 4, 6, 8, 10 ] 182c66ec88fSEmmanuel Vadot default: 0 183c66ec88fSEmmanuel Vadot 184c66ec88fSEmmanuel Vadot qcom,avg-samples: 185c66ec88fSEmmanuel Vadot enum: [ 1, 2, 4, 8, 16 ] 186c66ec88fSEmmanuel Vadot default: 1 187c66ec88fSEmmanuel Vadot 188c66ec88fSEmmanuel Vadot - if: 189c66ec88fSEmmanuel Vadot properties: 190c66ec88fSEmmanuel Vadot compatible: 191c66ec88fSEmmanuel Vadot contains: 192c66ec88fSEmmanuel Vadot const: qcom,spmi-adc5 193c66ec88fSEmmanuel Vadot 194c66ec88fSEmmanuel Vadot then: 195c66ec88fSEmmanuel Vadot patternProperties: 196f126890aSEmmanuel Vadot "^channel@[0-9a-f]+$": 197c66ec88fSEmmanuel Vadot properties: 198c66ec88fSEmmanuel Vadot qcom,decimation: 199c66ec88fSEmmanuel Vadot enum: [ 250, 420, 840 ] 200c66ec88fSEmmanuel Vadot default: 840 201c66ec88fSEmmanuel Vadot 202c66ec88fSEmmanuel Vadot qcom,hw-settle-time: 203c66ec88fSEmmanuel Vadot enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1, 2, 204c66ec88fSEmmanuel Vadot 4, 6, 8, 10, 16, 32, 64, 128 ] 205c66ec88fSEmmanuel Vadot default: 15 206c66ec88fSEmmanuel Vadot 207c66ec88fSEmmanuel Vadot qcom,avg-samples: 208c66ec88fSEmmanuel Vadot enum: [ 1, 2, 4, 8, 16 ] 209c66ec88fSEmmanuel Vadot default: 1 210c66ec88fSEmmanuel Vadot 211c66ec88fSEmmanuel Vadot - if: 212c66ec88fSEmmanuel Vadot properties: 213c66ec88fSEmmanuel Vadot compatible: 214c66ec88fSEmmanuel Vadot contains: 215c66ec88fSEmmanuel Vadot const: qcom,spmi-adc7 216c66ec88fSEmmanuel Vadot 217c66ec88fSEmmanuel Vadot then: 218c66ec88fSEmmanuel Vadot patternProperties: 219f126890aSEmmanuel Vadot "^channel@[0-9a-f]+$": 220c66ec88fSEmmanuel Vadot properties: 221c66ec88fSEmmanuel Vadot qcom,decimation: 222c66ec88fSEmmanuel Vadot enum: [ 85, 340, 1360 ] 223c66ec88fSEmmanuel Vadot default: 1360 224c66ec88fSEmmanuel Vadot 225c66ec88fSEmmanuel Vadot qcom,hw-settle-time: 226c66ec88fSEmmanuel Vadot enum: [ 15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 227c66ec88fSEmmanuel Vadot 8000, 16000, 32000, 64000, 128000 ] 228c66ec88fSEmmanuel Vadot default: 15 229c66ec88fSEmmanuel Vadot 230c66ec88fSEmmanuel Vadot qcom,avg-samples: 231c66ec88fSEmmanuel Vadot enum: [ 1, 2, 4, 8, 16 ] 232c66ec88fSEmmanuel Vadot default: 1 233c66ec88fSEmmanuel Vadot 2346be33864SEmmanuel VadotadditionalProperties: false 2356be33864SEmmanuel Vadot 236c66ec88fSEmmanuel Vadotexamples: 237c66ec88fSEmmanuel Vadot - | 238*8d13bc63SEmmanuel Vadot pmic { 239c66ec88fSEmmanuel Vadot #address-cells = <1>; 240c66ec88fSEmmanuel Vadot #size-cells = <0>; 241*8d13bc63SEmmanuel Vadot 242*8d13bc63SEmmanuel Vadot adc@3100 { 243c66ec88fSEmmanuel Vadot compatible = "qcom,spmi-vadc"; 244c66ec88fSEmmanuel Vadot reg = <0x3100>; 245c66ec88fSEmmanuel Vadot interrupts = <0x0 0x31 0x0 0x1>; 246c66ec88fSEmmanuel Vadot #address-cells = <1>; 247c66ec88fSEmmanuel Vadot #size-cells = <0>; 248c66ec88fSEmmanuel Vadot #io-channel-cells = <1>; 249c66ec88fSEmmanuel Vadot 250c66ec88fSEmmanuel Vadot /* Channel node */ 251f126890aSEmmanuel Vadot channel@39 { 252c66ec88fSEmmanuel Vadot reg = <0x39>; 253c66ec88fSEmmanuel Vadot qcom,decimation = <512>; 254c66ec88fSEmmanuel Vadot qcom,ratiometric; 255c66ec88fSEmmanuel Vadot qcom,hw-settle-time = <200>; 256c66ec88fSEmmanuel Vadot qcom,avg-samples = <1>; 257c66ec88fSEmmanuel Vadot qcom,pre-scaling = <1 3>; 258c66ec88fSEmmanuel Vadot }; 259c66ec88fSEmmanuel Vadot 260f126890aSEmmanuel Vadot channel@9 { 261c66ec88fSEmmanuel Vadot reg = <0x9>; 262c66ec88fSEmmanuel Vadot }; 263c66ec88fSEmmanuel Vadot 264f126890aSEmmanuel Vadot channel@a { 265c66ec88fSEmmanuel Vadot reg = <0xa>; 266c66ec88fSEmmanuel Vadot }; 267c66ec88fSEmmanuel Vadot 268f126890aSEmmanuel Vadot channel@e { 269c66ec88fSEmmanuel Vadot reg = <0xe>; 270c66ec88fSEmmanuel Vadot }; 271c66ec88fSEmmanuel Vadot 272f126890aSEmmanuel Vadot channel@f { 273c66ec88fSEmmanuel Vadot reg = <0xf>; 274c66ec88fSEmmanuel Vadot }; 275c66ec88fSEmmanuel Vadot }; 276c66ec88fSEmmanuel Vadot }; 2778bab661aSEmmanuel Vadot 2788bab661aSEmmanuel Vadot - | 2798bab661aSEmmanuel Vadot #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> 2808bab661aSEmmanuel Vadot #include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h> 2818bab661aSEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 2828bab661aSEmmanuel Vadot 283*8d13bc63SEmmanuel Vadot pmic { 2848bab661aSEmmanuel Vadot #address-cells = <1>; 2858bab661aSEmmanuel Vadot #size-cells = <0>; 286*8d13bc63SEmmanuel Vadot 2878bab661aSEmmanuel Vadot adc@3100 { 2888bab661aSEmmanuel Vadot reg = <0x3100>; 2898bab661aSEmmanuel Vadot compatible = "qcom,spmi-adc7"; 2908bab661aSEmmanuel Vadot #address-cells = <1>; 2918bab661aSEmmanuel Vadot #size-cells = <0>; 2928bab661aSEmmanuel Vadot #io-channel-cells = <1>; 2938bab661aSEmmanuel Vadot 2948bab661aSEmmanuel Vadot /* Other properties are omitted */ 295f126890aSEmmanuel Vadot channel@44 { 2968bab661aSEmmanuel Vadot reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>; 2978bab661aSEmmanuel Vadot qcom,ratiometric; 2988bab661aSEmmanuel Vadot qcom,hw-settle-time = <200>; 299f126890aSEmmanuel Vadot label = "xo_therm"; 3008bab661aSEmmanuel Vadot }; 3018bab661aSEmmanuel Vadot 302f126890aSEmmanuel Vadot channel@47 { 3038bab661aSEmmanuel Vadot reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>; 3048bab661aSEmmanuel Vadot qcom,ratiometric; 3058bab661aSEmmanuel Vadot qcom,hw-settle-time = <200>; 306f126890aSEmmanuel Vadot label = "conn_therm"; 3078bab661aSEmmanuel Vadot }; 3088bab661aSEmmanuel Vadot }; 3098bab661aSEmmanuel Vadot }; 310