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