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