Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: Convert the QCOM SPMI ADC bindings to .yaml format

Convert the adc bindings from .txt to .yaml format.

Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Jishnu Prakash and committed by
Jonathan Cameron
5a471662 9bea1064

+252 -173
-173
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.txt
··· 1 - Qualcomm's SPMI PMIC ADC 2 - 3 - - SPMI PMIC voltage ADC (VADC) provides interface to clients to read 4 - voltage. The VADC is a 15-bit sigma-delta ADC. 5 - - SPMI PMIC5 voltage ADC (ADC) provides interface to clients to read 6 - voltage. The VADC is a 16-bit sigma-delta ADC. 7 - 8 - VADC node: 9 - 10 - - compatible: 11 - Usage: required 12 - Value type: <string> 13 - Definition: Should contain "qcom,spmi-vadc". 14 - Should contain "qcom,spmi-adc5" for PMIC5 ADC driver. 15 - Should contain "qcom,spmi-adc-rev2" for PMIC rev2 ADC driver. 16 - Should contain "qcom,pms405-adc" for PMS405 PMIC 17 - 18 - - reg: 19 - Usage: required 20 - Value type: <prop-encoded-array> 21 - Definition: VADC base address in the SPMI PMIC register map. 22 - 23 - - #address-cells: 24 - Usage: required 25 - Value type: <u32> 26 - Definition: Must be one. Child node 'reg' property should define ADC 27 - channel number. 28 - 29 - - #size-cells: 30 - Usage: required 31 - Value type: <u32> 32 - Definition: Must be zero. 33 - 34 - - #io-channel-cells: 35 - Usage: required 36 - Value type: <u32> 37 - Definition: Must be one. For details about IIO bindings see: 38 - Documentation/devicetree/bindings/iio/iio-bindings.txt 39 - 40 - - interrupts: 41 - Usage: optional 42 - Value type: <prop-encoded-array> 43 - Definition: End of conversion interrupt. 44 - 45 - Channel node properties: 46 - 47 - - reg: 48 - Usage: required 49 - Value type: <u32> 50 - Definition: ADC channel number. 51 - See include/dt-bindings/iio/qcom,spmi-vadc.h 52 - 53 - - label: 54 - Usage: required for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2" 55 - Value type: <empty> 56 - Definition: ADC input of the platform as seen in the schematics. 57 - For thermistor inputs connected to generic AMUX or GPIO inputs 58 - these can vary across platform for the same pins. Hence select 59 - the platform schematics name for this channel. 60 - 61 - - qcom,decimation: 62 - Usage: optional 63 - Value type: <u32> 64 - Definition: This parameter is used to decrease ADC sampling rate. 65 - Quicker measurements can be made by reducing decimation ratio. 66 - - For compatible property "qcom,spmi-vadc", valid values are 67 - 512, 1024, 2048, 4096. If property is not found, default value 68 - of 512 will be used. 69 - - For compatible property "qcom,spmi-adc5", valid values are 250, 420 70 - and 840. If property is not found, default value of 840 is used. 71 - - For compatible property "qcom,spmi-adc-rev2", valid values are 256, 72 - 512 and 1024. If property is not present, default value is 1024. 73 - 74 - - qcom,pre-scaling: 75 - Usage: optional 76 - Value type: <u32 array> 77 - Definition: Used for scaling the channel input signal before the signal is 78 - fed to VADC. The configuration for this node is to know the 79 - pre-determined ratio and use it for post scaling. Select one from 80 - the following options. 81 - <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10> 82 - If property is not found default value depending on chip will be used. 83 - 84 - - qcom,ratiometric: 85 - Usage: optional 86 - Value type: <empty> 87 - Definition: Channel calibration type. 88 - - For compatible property "qcom,spmi-vadc", if this property is 89 - specified VADC will use the VDD reference (1.8V) and GND for 90 - channel calibration. If property is not found, channel will be 91 - calibrated with 0.625V and 1.25V reference channels, also 92 - known as absolute calibration. 93 - - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2", 94 - if this property is specified VADC will use the VDD reference 95 - (1.875V) and GND for channel calibration. If property is not found, 96 - channel will be calibrated with 0V and 1.25V reference channels, 97 - also known as absolute calibration. 98 - 99 - - qcom,hw-settle-time: 100 - Usage: optional 101 - Value type: <u32> 102 - Definition: Time between AMUX getting configured and the ADC starting 103 - conversion. The 'hw_settle_time' is an index used from valid values 104 - and programmed in hardware to achieve the hardware settling delay. 105 - - For compatible property "qcom,spmi-vadc" and "qcom,spmi-adc-rev2", 106 - Delay = 100us * (hw_settle_time) for hw_settle_time < 11, 107 - and 2ms * (hw_settle_time - 10) otherwise. 108 - Valid values are: 0, 100, 200, 300, 400, 500, 600, 700, 800, 109 - 900 us and 1, 2, 4, 6, 8, 10 ms. 110 - If property is not found, channel will use 0us. 111 - - For compatible property "qcom,spmi-adc5", delay = 15us for 112 - value 0, 100us * (value) for values < 11, 113 - and 2ms * (value - 10) otherwise. 114 - Valid values are: 15, 100, 200, 300, 400, 500, 600, 700, 800, 115 - 900 us and 1, 2, 4, 6, 8, 10 ms 116 - Certain controller digital versions have valid values of 117 - 15, 100, 200, 300, 400, 500, 600, 700, 1, 2, 4, 8, 16, 32, 64, 128 ms 118 - If property is not found, channel will use 15us. 119 - 120 - - qcom,avg-samples: 121 - Usage: optional 122 - Value type: <u32> 123 - Definition: Number of samples to be used for measurement. 124 - Averaging provides the option to obtain a single measurement 125 - from the ADC that is an average of multiple samples. The value 126 - selected is 2^(value). 127 - - For compatible property "qcom,spmi-vadc", valid values 128 - are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 129 - If property is not found, 1 sample will be used. 130 - - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2", 131 - valid values are: 1, 2, 4, 8, 16 132 - If property is not found, 1 sample will be used. 133 - 134 - NOTE: 135 - 136 - For compatible property "qcom,spmi-vadc" following channels, also known as 137 - reference point channels, are used for result calibration and their channel 138 - configuration nodes should be defined: 139 - VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV, 140 - VADC_GND_REF and VADC_VDD_VADC. 141 - 142 - Example: 143 - 144 - #include <dt-bindings/iio/qcom,spmi-vadc.h> 145 - #include <linux/irq.h> 146 - /* ... */ 147 - 148 - /* VADC node */ 149 - pmic_vadc: vadc@3100 { 150 - compatible = "qcom,spmi-vadc"; 151 - reg = <0x3100>; 152 - interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>; 153 - #address-cells = <1>; 154 - #size-cells = <0>; 155 - #io-channel-cells = <1>; 156 - io-channel-ranges; 157 - 158 - /* Channel node */ 159 - adc-chan@VADC_LR_MUX10_USB_ID { 160 - reg = <VADC_LR_MUX10_USB_ID>; 161 - qcom,decimation = <512>; 162 - qcom,ratiometric; 163 - qcom,hw-settle-time = <200>; 164 - qcom,avg-samples = <1>; 165 - qcom,pre-scaling = <1 3>; 166 - }; 167 - }; 168 - 169 - /* IIO client node */ 170 - usb { 171 - io-channels = <&pmic_vadc VADC_LR_MUX10_USB_ID>; 172 - io-channel-names = "vadc"; 173 - };
+252
Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc.yaml
··· 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 + 7 + title: Qualcomm's SPMI PMIC ADC 8 + 9 + maintainers: 10 + - Andy Gross <agross@kernel.org> 11 + - Bjorn Andersson <bjorn.andersson@linaro.org> 12 + 13 + description: | 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 voltage ADC (ADC) provides interface to clients to read 17 + voltage. The VADC is a 16-bit sigma-delta ADC. 18 + 19 + properties: 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 + 32 + reg: 33 + description: VADC base address in the SPMI PMIC register map 34 + maxItems: 1 35 + 36 + '#address-cells': 37 + const: 1 38 + 39 + '#size-cells': 40 + const: 0 41 + 42 + '#io-channel-cells': 43 + const: 1 44 + 45 + interrupts: 46 + maxItems: 1 47 + description: 48 + End of conversion interrupt. 49 + 50 + required: 51 + - compatible 52 + - reg 53 + - '#address-cells' 54 + - '#size-cells' 55 + - '#io-channel-cells' 56 + 57 + patternProperties: 58 + "^.*@[0-9a-f]+$": 59 + type: object 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 + description: | 71 + ADC channel number. 72 + See include/dt-bindings/iio/qcom,spmi-vadc.h 73 + 74 + label: 75 + $ref: /schemas/types.yaml#/definitions/string 76 + description: | 77 + ADC input of the platform as seen in the schematics. 78 + For thermistor inputs connected to generic AMUX or GPIO inputs 79 + these can vary across platform for the same pins. Hence select 80 + the platform schematics name for this channel. 81 + 82 + qcom,decimation: 83 + $ref: /schemas/types.yaml#/definitions/uint32 84 + description: | 85 + This parameter is used to decrease ADC sampling rate. 86 + Quicker measurements can be made by reducing decimation ratio. 87 + 88 + qcom,pre-scaling: 89 + description: | 90 + Used for scaling the channel input signal before the signal is 91 + fed to VADC. The configuration for this node is to know the 92 + pre-determined ratio and use it for post scaling. It is a pair of 93 + integers, denoting the numerator and denominator of the fraction by which 94 + input signal is multiplied. For example, <1 3> indicates the signal is scaled 95 + down to 1/3 of its value before ADC measurement. 96 + If property is not found default value depending on chip will be used. 97 + allOf: 98 + - $ref: /schemas/types.yaml#/definitions/uint32-array 99 + oneOf: 100 + - items: 101 + - const: 1 102 + - enum: [ 1, 3, 4, 6, 20, 8, 10 ] 103 + 104 + - items: 105 + - const: 10 106 + - const: 81 107 + 108 + qcom,ratiometric: 109 + description: | 110 + Channel calibration type. 111 + - For compatible property "qcom,spmi-vadc", if this property is 112 + specified VADC will use the VDD reference (1.8V) and GND for 113 + channel calibration. If property is not found, channel will be 114 + calibrated with 0.625V and 1.25V reference channels, also 115 + known as absolute calibration. 116 + - For compatible property "qcom,spmi-adc5" and "qcom,spmi-adc-rev2", 117 + if this property is specified VADC will use the VDD reference (1.875V) 118 + and GND for channel calibration. If property is not found, channel 119 + will be calibrated with 0V and 1.25V reference channels, also known 120 + as absolute calibration. 121 + type: boolean 122 + 123 + qcom,hw-settle-time: 124 + $ref: /schemas/types.yaml#/definitions/uint32 125 + description: | 126 + Time between AMUX getting configured and the ADC starting 127 + conversion. The 'hw_settle_time' is an index used from valid values 128 + and programmed in hardware to achieve the hardware settling delay. 129 + 130 + qcom,avg-samples: 131 + $ref: /schemas/types.yaml#/definitions/uint32 132 + description: | 133 + Number of samples to be used for measurement. 134 + Averaging provides the option to obtain a single measurement 135 + from the ADC that is an average of multiple samples. The value 136 + selected is 2^(value). 137 + 138 + required: 139 + - reg 140 + 141 + allOf: 142 + - if: 143 + properties: 144 + compatible: 145 + contains: 146 + const: qcom,spmi-vadc 147 + 148 + then: 149 + patternProperties: 150 + "^.*@[0-9a-f]+$": 151 + properties: 152 + qcom,decimation: 153 + enum: [ 512, 1024, 2048, 4096 ] 154 + default: 512 155 + 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: 0 160 + 161 + qcom,avg-samples: 162 + enum: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 ] 163 + default: 1 164 + 165 + - if: 166 + properties: 167 + compatible: 168 + contains: 169 + const: qcom,spmi-adc-rev2 170 + 171 + then: 172 + patternProperties: 173 + "^.*@[0-9a-f]+$": 174 + properties: 175 + qcom,decimation: 176 + enum: [ 256, 512, 1024 ] 177 + default: 1024 178 + 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: 0 183 + 184 + qcom,avg-samples: 185 + enum: [ 1, 2, 4, 8, 16 ] 186 + default: 1 187 + 188 + - if: 189 + properties: 190 + compatible: 191 + contains: 192 + const: qcom,spmi-adc5 193 + 194 + then: 195 + patternProperties: 196 + "^.*@[0-9a-f]+$": 197 + properties: 198 + qcom,decimation: 199 + enum: [ 250, 420, 840 ] 200 + default: 840 201 + 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: 15 206 + 207 + qcom,avg-samples: 208 + enum: [ 1, 2, 4, 8, 16 ] 209 + default: 1 210 + 211 + examples: 212 + - | 213 + spmi_bus { 214 + #address-cells = <1>; 215 + #size-cells = <0>; 216 + /* VADC node */ 217 + pmic_vadc: adc@3100 { 218 + compatible = "qcom,spmi-vadc"; 219 + reg = <0x3100>; 220 + interrupts = <0x0 0x31 0x0 0x1>; 221 + #address-cells = <1>; 222 + #size-cells = <0>; 223 + #io-channel-cells = <1>; 224 + io-channel-ranges; 225 + 226 + /* Channel node */ 227 + adc-chan@39 { 228 + reg = <0x39>; 229 + qcom,decimation = <512>; 230 + qcom,ratiometric; 231 + qcom,hw-settle-time = <200>; 232 + qcom,avg-samples = <1>; 233 + qcom,pre-scaling = <1 3>; 234 + }; 235 + 236 + adc-chan@9 { 237 + reg = <0x9>; 238 + }; 239 + 240 + adc-chan@a { 241 + reg = <0xa>; 242 + }; 243 + 244 + adc-chan@e { 245 + reg = <0xe>; 246 + }; 247 + 248 + adc-chan@f { 249 + reg = <0xf>; 250 + }; 251 + }; 252 + };