|
| 1 | +Qualcomm's PM8xxx voltage XOADC |
| 2 | + |
| 3 | +The Qualcomm PM8xxx PMICs contain a HK/XO ADC (Housekeeping/Crystal |
| 4 | +oscillator ADC) encompassing PM8018, PM8038, PM8058 and PM8921. |
| 5 | + |
| 6 | +Required properties: |
| 7 | + |
| 8 | +- compatible: should be one of: |
| 9 | + "qcom,pm8018-adc" |
| 10 | + "qcom,pm8038-adc" |
| 11 | + "qcom,pm8058-adc" |
| 12 | + "qcom,pm8921-adc" |
| 13 | + |
| 14 | +- reg: should contain the ADC base address in the PMIC, typically |
| 15 | + 0x197. |
| 16 | + |
| 17 | +- xoadc-ref-supply: should reference a regulator that can supply |
| 18 | + a reference voltage on demand. The reference voltage may vary |
| 19 | + with PMIC variant but is typically something like 2.2 or 1.8V. |
| 20 | + |
| 21 | +The following required properties are standard for IO channels, see |
| 22 | +iio-bindings.txt for more details: |
| 23 | + |
| 24 | +- #address-cells: should be set to <1> |
| 25 | + |
| 26 | +- #size-cells: should be set to <0> |
| 27 | + |
| 28 | +- #io-channel-cells: should be set to <1> |
| 29 | + |
| 30 | +- interrupts: should refer to the parent PMIC interrupt controller |
| 31 | + and reference the proper ADC interrupt. |
| 32 | + |
| 33 | +Required subnodes: |
| 34 | + |
| 35 | +The ADC channels are configured as subnodes of the ADC. Since some of |
| 36 | +them are used for calibrating the ADC, these nodes are compulsory: |
| 37 | + |
| 38 | +adc-channel@c { |
| 39 | + reg = <0x0c>; |
| 40 | +}; |
| 41 | + |
| 42 | +adc-channel@d { |
| 43 | + reg = <0x0d>; |
| 44 | +}; |
| 45 | + |
| 46 | +adc-channel@f { |
| 47 | + reg = <0x0f>; |
| 48 | +}; |
| 49 | + |
| 50 | +These three nodes are used for absolute and ratiometric calibration |
| 51 | +and only need to have these reg values: they are by hardware definition |
| 52 | +1:1 ratio converters that sample 625, 1250 and 0 milliV and create |
| 53 | +an interpolation calibration for all other ADCs. |
| 54 | + |
| 55 | +Optional subnodes: any channels other than channel 0x0c, 0x0d and |
| 56 | +0x0f are optional. |
| 57 | + |
| 58 | +Required channel node properties: |
| 59 | + |
| 60 | +- reg: should contain the hardware channel number in the range |
| 61 | + 0 .. 0x0f (4 bits). The hardware only supports 16 channels. |
| 62 | + |
| 63 | +Optional channel node properties: |
| 64 | + |
| 65 | +- qcom,decimation: |
| 66 | + Value type: <u32> |
| 67 | + Definition: This parameter is used to decrease the ADC sampling rate. |
| 68 | + Quicker measurements can be made by reducing the decimation ratio. |
| 69 | + Valid values are 512, 1024, 2048, 4096. |
| 70 | + If the property is not found, a default value of 512 will be used. |
| 71 | + |
| 72 | +- qcom,ratiometric: |
| 73 | + Value type: <u32> |
| 74 | + Definition: Channel calibration type. If this property is specified |
| 75 | + VADC will use a special voltage references for channel |
| 76 | + calibration. The available references are specified in the |
| 77 | + as a u32 value setting (see below) and it is compulsory |
| 78 | + to also specify this reference if ratiometric calibration |
| 79 | + is selected. |
| 80 | + |
| 81 | + If the property is not found, the channel will be |
| 82 | + calibrated with the 0.625V and 1.25V reference channels, also |
| 83 | + known as an absolute calibration. |
| 84 | + The reference voltage pairs when using ratiometric calibration: |
| 85 | + 0 = XO_IN/XOADC_GND |
| 86 | + 1 = PMIC_IN/XOADC_GND |
| 87 | + 2 = PMIC_IN/BMS_CSP |
| 88 | + 3 (invalid) |
| 89 | + 4 = XOADC_GND/XOADC_GND |
| 90 | + 5 = XOADC_VREF/XOADC_GND |
| 91 | + |
| 92 | +Example: |
| 93 | + |
| 94 | +xoadc: xoadc@197 { |
| 95 | + compatible = "qcom,pm8058-adc"; |
| 96 | + reg = <0x197>; |
| 97 | + interrupt-parent = <&pm8058>; |
| 98 | + interrupts = <76 1>; |
| 99 | + #address-cells = <1>; |
| 100 | + #size-cells = <0>; |
| 101 | + #io-channel-cells = <1>; |
| 102 | + |
| 103 | + vcoin: adc-channel@0 { |
| 104 | + reg = <0x00>; |
| 105 | + }; |
| 106 | + vbat: adc-channel@1 { |
| 107 | + reg = <0x01>; |
| 108 | + }; |
| 109 | + dcin: adc-channel@2 { |
| 110 | + reg = <0x02>; |
| 111 | + }; |
| 112 | + ichg: adc-channel@3 { |
| 113 | + reg = <0x03>; |
| 114 | + }; |
| 115 | + vph_pwr: adc-channel@4 { |
| 116 | + reg = <0x04>; |
| 117 | + }; |
| 118 | + usb_vbus: adc-channel@a { |
| 119 | + reg = <0x0a>; |
| 120 | + }; |
| 121 | + die_temp: adc-channel@b { |
| 122 | + reg = <0x0b>; |
| 123 | + }; |
| 124 | + ref_625mv: adc-channel@c { |
| 125 | + reg = <0x0c>; |
| 126 | + }; |
| 127 | + ref_1250mv: adc-channel@d { |
| 128 | + reg = <0x0d>; |
| 129 | + }; |
| 130 | + ref_325mv: adc-channel@e { |
| 131 | + reg = <0x0e>; |
| 132 | + }; |
| 133 | + ref_muxoff: adc-channel@f { |
| 134 | + reg = <0x0f>; |
| 135 | + }; |
| 136 | +}; |
| 137 | + |
| 138 | + |
| 139 | +/* IIO client node */ |
| 140 | +iio-hwmon { |
| 141 | + compatible = "iio-hwmon"; |
| 142 | + io-channels = <&xoadc 0x01>, /* Battery */ |
| 143 | + <&xoadc 0x02>, /* DC in (charger) */ |
| 144 | + <&xoadc 0x04>, /* VPH the main system voltage */ |
| 145 | + <&xoadc 0x0b>, /* Die temperature */ |
| 146 | + <&xoadc 0x0c>, /* Reference voltage 1.25V */ |
| 147 | + <&xoadc 0x0d>, /* Reference voltage 0.625V */ |
| 148 | + <&xoadc 0x0e>; /* Reference voltage 0.325V */ |
| 149 | +}; |
0 commit comments