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