Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1 | Qualcomm's QPNP PMIC Voltage ADC Arbiter |
| 2 | |
| 3 | QPNP PMIC Voltage ADC (VADC) provides interface to clients to read |
| 4 | Voltage. A 15 bit ADC is used for Voltage measurements. There are multiple |
| 5 | peripherals to the VADC and the scope of the driver is to provide interface |
| 6 | for the USR peripheral of the VADC. |
| 7 | |
| 8 | VADC node |
| 9 | |
| 10 | Required properties: |
| 11 | - compatible : should be "qcom,qpnp-vadc" for Voltage ADC driver. |
| 12 | - reg : offset and length of the PMIC Aribter register map. |
Siddartha Mohanadoss | 96be0a0 | 2012-12-07 14:38:48 -0800 | [diff] [blame] | 13 | - address-cells : Must be one. |
| 14 | - size-cells : Must be zero. |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 15 | - interrupts : The USR bank peripheral VADC interrupt. |
Siddartha Mohanadoss | 1210995 | 2012-11-20 14:57:51 -0800 | [diff] [blame] | 16 | - interrupt-names : Should contain "eoc-int-en-set". |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 17 | - qcom,adc-bit-resolution : Bit resolution of the ADC. |
| 18 | - qcom,adc-vdd-reference : Voltage reference used by the ADC. |
| 19 | |
| 20 | Channel nodes |
| 21 | NOTE: Atleast one Channel node is required. |
| 22 | |
Siddartha Mohanadoss | 462088b | 2013-07-27 19:58:09 -0700 | [diff] [blame] | 23 | Optional properties: |
| 24 | - qcom,vadc-poll-eoc: Use polling instead of interrupts for End of Conversion completion. |
Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 25 | - qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the |
| 26 | PMIC type and revision for applying the appropriate temperature |
| 27 | compensation parameters. |
Siddartha Mohanadoss | 462088b | 2013-07-27 19:58:09 -0700 | [diff] [blame] | 28 | |
Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 29 | Client required property: |
| 30 | - qcom,<consumer name>-vadc : The phandle to the corresponding vadc device. |
| 31 | The consumer name passed to the driver when calling |
| 32 | qpnp_get_vadc() is used to associate the client |
| 33 | with the corresponding device. |
| 34 | |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 35 | Required properties: |
| 36 | - label : Channel name used for sysfs entry. |
Siddartha Mohanadoss | 96be0a0 | 2012-12-07 14:38:48 -0800 | [diff] [blame] | 37 | - reg : AMUX channel number. |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 38 | - qcom,decimation : Sampling rate to use for the individual channel measurement. |
| 39 | Select from following unsigned int. |
| 40 | 0 : 512 |
| 41 | 1 : 1K |
| 42 | 2 : 2K |
| 43 | 3 : 4K |
| 44 | - qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal |
Siddartha Mohanadoss | c049b9c | 2013-02-16 17:17:49 -0800 | [diff] [blame] | 45 | is being measured. Some of the AMUX channels |
| 46 | support dividing the signal from a predetermined |
| 47 | ratio. The configuration for this node is to know |
| 48 | the pre-determined ratio and use it for post scaling. |
| 49 | Select from the following unsinged int. |
| 50 | 0 : {1, 1} |
| 51 | 1 : {1, 3} |
| 52 | 2 : {1, 4} |
| 53 | 3 : {1, 6} |
| 54 | 4 : {1, 20} |
Dipen Parmar | 46f8ac6 | 2014-01-19 22:45:11 +0530 | [diff] [blame] | 55 | 5 : {1, 8} |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 56 | - qcom,calibration-type : Reference voltage to use for channel calibration. |
| 57 | Channel calibration is dependendent on the channel. |
| 58 | Certain channels like XO_THERM, BATT_THERM use ratiometric |
| 59 | calibration. Most other channels fall under absolute calibration. |
| 60 | Select from the following strings. |
| 61 | "absolute" : Uses the 625mv and 1.25V reference channels. |
| 62 | "ratiometric" : Uses the reference Voltage/GND for calibration. |
| 63 | - qcom,scale-function : Scaling function used to convert raw ADC code to units specific to |
| 64 | a given channel. |
| 65 | Select from the following unsigned int. |
| 66 | 0 : Default scaling to convert raw adc code to voltage. |
| 67 | 1 : Conversion to temperature based on btm parameters. |
Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 68 | 2 : Returns result in degC for 100k pull-up. |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 69 | 3 : Returns current across 0.1 ohm resistor. |
| 70 | 4 : Returns XO thermistor voltage in degree's Centigrade. |
Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 71 | 5 : Returns result in degC for 150k pull-up. |
Wu Fenglin | 2c6ef8f | 2013-12-17 11:33:33 +0800 | [diff] [blame] | 72 | 9 : Conversion to temperature based on -15~55 allowable |
| 73 | battery charging tempeature setting for btm parameters. |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 74 | - qcom,hw-settle-time : Settling period for the channel before ADC read. |
| 75 | Select from the following unsigned int. |
| 76 | 0 : 0us |
| 77 | 1 : 100us |
| 78 | 2 : 200us |
| 79 | 3 : 300us |
| 80 | 4 : 400us |
| 81 | 5 : 500us |
| 82 | 6 : 600us |
| 83 | 7 : 700us |
| 84 | 8 : 800us |
| 85 | 9 : 900us |
| 86 | 0xa : 1ms |
| 87 | 0xb : 2ms |
| 88 | 0xc : 4ms |
| 89 | 0xd : 6ms |
| 90 | 0xe : 8ms |
| 91 | 0xf : 10ms |
| 92 | - qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging |
| 93 | provides the option to obtain a single measurement from the ADC that |
| 94 | is an average of multiple samples. The value selected is 2^(value) |
| 95 | Select from the following unsigned int. |
| 96 | 0 : 1 |
| 97 | 1 : 2 |
| 98 | 2 : 4 |
| 99 | 3 : 8 |
| 100 | 4 : 16 |
| 101 | 5 : 32 |
| 102 | 6 : 64 |
| 103 | 7 : 128 |
| 104 | 8 : 256 |
| 105 | |
| 106 | Example: |
| 107 | /* Main Node */ |
| 108 | qcom,vadc@3100 { |
| 109 | compatible = "qcom,qpnp-vadc"; |
| 110 | reg = <0x3100 0x100>; |
Siddartha Mohanadoss | 96be0a0 | 2012-12-07 14:38:48 -0800 | [diff] [blame] | 111 | #address-cells = <1>; |
| 112 | #size-cells = <0>; |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 113 | interrupts = <0x0 0x31 0x0>; |
Siddartha Mohanadoss | 1210995 | 2012-11-20 14:57:51 -0800 | [diff] [blame] | 114 | interrupt-names = "eoc-int-en-set"; |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 115 | qcom,adc-bit-resolution = <15>; |
| 116 | qcom,adc-vdd-reference = <1800>; |
| 117 | |
| 118 | /* Channel Node */ |
| 119 | chan@0 { |
| 120 | label = "usb_in"; |
Siddartha Mohanadoss | 96be0a0 | 2012-12-07 14:38:48 -0800 | [diff] [blame] | 121 | reg = <0>; |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 122 | qcom,decimation = <0>; |
Siddartha Mohanadoss | c049b9c | 2013-02-16 17:17:49 -0800 | [diff] [blame] | 123 | qcom,pre-div-channel-scaling = <4>; |
Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 124 | qcom,calibration-type = "absolute"; |
| 125 | qcom,scale-function = <0>; |
| 126 | qcom,hw-settle-time = <0>; |
| 127 | qcom,fast-avg-setup = <0>; |
| 128 | }; |
| 129 | }; |
Siddartha Mohanadoss | c049b9c | 2013-02-16 17:17:49 -0800 | [diff] [blame] | 130 | |
Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 131 | Client device example: |
| 132 | /* Add to the clients node that needs the VADC channel A/D */ |
| 133 | client_node { |
| 134 | qcom,client-vadc = <&pm8941_vadc>; |
| 135 | }; |
| 136 | |
Siddartha Mohanadoss | c049b9c | 2013-02-16 17:17:49 -0800 | [diff] [blame] | 137 | /* Clients have an option of measuring an analog signal through an MPP. |
| 138 | MPP block is not part of the VADC block but is an individual PMIC |
| 139 | block that has an option to support clients to configure an MPP as |
| 140 | an analog input which can be routed through one of the VADC pre-mux |
| 141 | inputs. Here is an example of how to configure an MPP as an analog |
| 142 | input */ |
| 143 | |
| 144 | /* Configure MPP4 as an Analog input to AMUX8 and read from channel 0x23 */ |
| 145 | /* MPP DT configuration in the platform DT file*/ |
| 146 | mpp@a300 { /* MPP 4 */ |
| 147 | qcom,mode = <4>; /* AIN input */ |
| 148 | qcom,invert = <1>; /* Enable MPP */ |
| 149 | qcom,ain-route = <3>; /* AMUX 8 */ |
| 150 | qcom,master-en = <1>; |
| 151 | qcom,src-sel = <0>; /* Function constant */ |
| 152 | }; |
| 153 | |
| 154 | /* VADC Channel configuration */ |
| 155 | chan@23 { |
| 156 | label = "mpp4_div3"; |
| 157 | reg = <0x23>; |
| 158 | qcom,decimation = <0>; |
| 159 | qcom,pre-div-channel-scaling = <1>; |
| 160 | qcom,calibration-type = "absolute"; |
| 161 | qcom,scale-function = <0>; |
| 162 | qcom,hw-settle-time = <0>; |
| 163 | qcom,fast-avg-setup = <0>; |
| 164 | }; |