| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1 | /* |
| Dipen Parmar | 46f8ac6 | 2014-01-19 22:45:11 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | /* |
| 14 | * Qualcomm PMIC QPNP ADC driver header file |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #ifndef __QPNP_ADC_H |
| 19 | #define __QPNP_ADC_H |
| 20 | |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/list.h> |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 23 | #include <linux/qpnp-revid.h> |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 24 | /** |
| 25 | * enum qpnp_vadc_channels - QPNP AMUX arbiter channels |
| 26 | */ |
| 27 | enum qpnp_vadc_channels { |
| 28 | USBIN = 0, |
| 29 | DCIN, |
| 30 | VCHG_SNS, |
| 31 | SPARE1_03, |
| Siddartha Mohanadoss | 2cadeba | 2012-11-13 18:40:27 -0800 | [diff] [blame] | 32 | USB_ID_MV, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 33 | VCOIN, |
| 34 | VBAT_SNS, |
| 35 | VSYS, |
| 36 | DIE_TEMP, |
| 37 | REF_625MV, |
| 38 | REF_125V, |
| 39 | CHG_TEMP, |
| 40 | SPARE1, |
| 41 | SPARE2, |
| 42 | GND_REF, |
| 43 | VDD_VADC, |
| 44 | P_MUX1_1_1, |
| 45 | P_MUX2_1_1, |
| 46 | P_MUX3_1_1, |
| 47 | P_MUX4_1_1, |
| 48 | P_MUX5_1_1, |
| 49 | P_MUX6_1_1, |
| 50 | P_MUX7_1_1, |
| 51 | P_MUX8_1_1, |
| 52 | P_MUX9_1_1, |
| 53 | P_MUX10_1_1, |
| 54 | P_MUX11_1_1, |
| 55 | P_MUX12_1_1, |
| 56 | P_MUX13_1_1, |
| 57 | P_MUX14_1_1, |
| 58 | P_MUX15_1_1, |
| 59 | P_MUX16_1_1, |
| 60 | P_MUX1_1_3, |
| 61 | P_MUX2_1_3, |
| 62 | P_MUX3_1_3, |
| 63 | P_MUX4_1_3, |
| 64 | P_MUX5_1_3, |
| 65 | P_MUX6_1_3, |
| 66 | P_MUX7_1_3, |
| 67 | P_MUX8_1_3, |
| 68 | P_MUX9_1_3, |
| 69 | P_MUX10_1_3, |
| 70 | P_MUX11_1_3, |
| 71 | P_MUX12_1_3, |
| 72 | P_MUX13_1_3, |
| 73 | P_MUX14_1_3, |
| 74 | P_MUX15_1_3, |
| 75 | P_MUX16_1_3, |
| 76 | LR_MUX1_BATT_THERM, |
| 77 | LR_MUX2_BAT_ID, |
| 78 | LR_MUX3_XO_THERM, |
| 79 | LR_MUX4_AMUX_THM1, |
| 80 | LR_MUX5_AMUX_THM2, |
| 81 | LR_MUX6_AMUX_THM3, |
| 82 | LR_MUX7_HW_ID, |
| 83 | LR_MUX8_AMUX_THM4, |
| 84 | LR_MUX9_AMUX_THM5, |
| Siddartha Mohanadoss | 2cadeba | 2012-11-13 18:40:27 -0800 | [diff] [blame] | 85 | LR_MUX10_USB_ID_LV, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 86 | AMUX_PU1, |
| 87 | AMUX_PU2, |
| 88 | LR_MUX3_BUF_XO_THERM_BUF, |
| Siddartha Mohanadoss | 2cadeba | 2012-11-13 18:40:27 -0800 | [diff] [blame] | 89 | LR_MUX1_PU1_BAT_THERM = 112, |
| 90 | LR_MUX2_PU1_BAT_ID = 113, |
| 91 | LR_MUX3_PU1_XO_THERM = 114, |
| 92 | LR_MUX4_PU1_AMUX_THM1 = 115, |
| 93 | LR_MUX5_PU1_AMUX_THM2 = 116, |
| 94 | LR_MUX6_PU1_AMUX_THM3 = 117, |
| 95 | LR_MUX7_PU1_AMUX_HW_ID = 118, |
| 96 | LR_MUX8_PU1_AMUX_THM4 = 119, |
| 97 | LR_MUX9_PU1_AMUX_THM5 = 120, |
| 98 | LR_MUX10_PU1_AMUX_USB_ID_LV = 121, |
| 99 | LR_MUX3_BUF_PU1_XO_THERM_BUF = 124, |
| 100 | LR_MUX1_PU2_BAT_THERM = 176, |
| 101 | LR_MUX2_PU2_BAT_ID = 177, |
| 102 | LR_MUX3_PU2_XO_THERM = 178, |
| 103 | LR_MUX4_PU2_AMUX_THM1 = 179, |
| 104 | LR_MUX5_PU2_AMUX_THM2 = 180, |
| 105 | LR_MUX6_PU2_AMUX_THM3 = 181, |
| 106 | LR_MUX7_PU2_AMUX_HW_ID = 182, |
| 107 | LR_MUX8_PU2_AMUX_THM4 = 183, |
| 108 | LR_MUX9_PU2_AMUX_THM5 = 184, |
| 109 | LR_MUX10_PU2_AMUX_USB_ID_LV = 185, |
| 110 | LR_MUX3_BUF_PU2_XO_THERM_BUF = 188, |
| 111 | LR_MUX1_PU1_PU2_BAT_THERM = 240, |
| 112 | LR_MUX2_PU1_PU2_BAT_ID = 241, |
| 113 | LR_MUX3_PU1_PU2_XO_THERM = 242, |
| 114 | LR_MUX4_PU1_PU2_AMUX_THM1 = 243, |
| 115 | LR_MUX5_PU1_PU2_AMUX_THM2 = 244, |
| 116 | LR_MUX6_PU1_PU2_AMUX_THM3 = 245, |
| 117 | LR_MUX7_PU1_PU2_AMUX_HW_ID = 246, |
| 118 | LR_MUX8_PU1_PU2_AMUX_THM4 = 247, |
| 119 | LR_MUX9_PU1_PU2_AMUX_THM5 = 248, |
| 120 | LR_MUX10_PU1_PU2_AMUX_USB_ID_LV = 249, |
| 121 | LR_MUX3_BUF_PU1_PU2_XO_THERM_BUF = 252, |
| 122 | ALL_OFF = 255, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 123 | ADC_MAX_NUM, |
| 124 | }; |
| 125 | |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 126 | /** |
| 127 | * enum qpnp_iadc_channels - QPNP IADC channel list |
| 128 | */ |
| 129 | enum qpnp_iadc_channels { |
| 130 | INTERNAL_RSENSE = 0, |
| 131 | EXTERNAL_RSENSE, |
| 132 | ALT_LEAD_PAIR, |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 133 | GAIN_CALIBRATION_17P857MV, |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 134 | OFFSET_CALIBRATION_SHORT_CADC_LEADS, |
| 135 | OFFSET_CALIBRATION_CSP_CSN, |
| 136 | OFFSET_CALIBRATION_CSP2_CSN2, |
| 137 | IADC_MUX_NUM, |
| 138 | }; |
| 139 | |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 140 | #define QPNP_ADC_625_UV 625000 |
| Siddartha Mohanadoss | 1c21831 | 2012-11-08 11:30:43 -0800 | [diff] [blame] | 141 | #define QPNP_ADC_HWMON_NAME_LENGTH 64 |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 142 | #define QPNP_MAX_PROP_NAME_LEN 32 |
| 143 | |
| 144 | /* Structure device for qpnp vadc */ |
| 145 | struct qpnp_vadc_chip; |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 146 | |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 147 | /* Structure device for qpnp iadc */ |
| 148 | struct qpnp_iadc_chip; |
| 149 | |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 150 | /* Structure device for qpnp adc tm */ |
| 151 | struct qpnp_adc_tm_chip; |
| 152 | |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 153 | /** |
| 154 | * enum qpnp_adc_decimation_type - Sampling rate supported. |
| 155 | * %DECIMATION_TYPE1: 512 |
| 156 | * %DECIMATION_TYPE2: 1K |
| 157 | * %DECIMATION_TYPE3: 2K |
| 158 | * %DECIMATION_TYPE4: 4k |
| 159 | * %DECIMATION_NONE: Do not use this Sampling type. |
| 160 | * |
| 161 | * The Sampling rate is specific to each channel of the QPNP ADC arbiter. |
| 162 | */ |
| 163 | enum qpnp_adc_decimation_type { |
| 164 | DECIMATION_TYPE1 = 0, |
| 165 | DECIMATION_TYPE2, |
| 166 | DECIMATION_TYPE3, |
| 167 | DECIMATION_TYPE4, |
| 168 | DECIMATION_NONE, |
| 169 | }; |
| 170 | |
| 171 | /** |
| 172 | * enum qpnp_adc_calib_type - QPNP ADC Calibration type. |
| 173 | * %ADC_CALIB_ABSOLUTE: Use 625mV and 1.25V reference channels. |
| 174 | * %ADC_CALIB_RATIOMETRIC: Use reference Voltage/GND. |
| 175 | * %ADC_CALIB_CONFIG_NONE: Do not use this calibration type. |
| 176 | * |
| 177 | * Use the input reference voltage depending on the calibration type |
| 178 | * to calcluate the offset and gain parameters. The calibration is |
| 179 | * specific to each channel of the QPNP ADC. |
| 180 | */ |
| 181 | enum qpnp_adc_calib_type { |
| 182 | CALIB_ABSOLUTE = 0, |
| 183 | CALIB_RATIOMETRIC, |
| 184 | CALIB_NONE, |
| 185 | }; |
| 186 | |
| 187 | /** |
| 188 | * enum qpnp_adc_channel_scaling_param - pre-scaling AMUX ratio. |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 189 | * %CHAN_PATH_SCALING0: ratio of {1, 1} |
| 190 | * %CHAN_PATH_SCALING1: ratio of {1, 3} |
| 191 | * %CHAN_PATH_SCALING2: ratio of {1, 4} |
| 192 | * %CHAN_PATH_SCALING3: ratio of {1, 6} |
| 193 | * %CHAN_PATH_SCALING4: ratio of {1, 20} |
| Dipen Parmar | 46f8ac6 | 2014-01-19 22:45:11 +0530 | [diff] [blame] | 194 | * %CHAN_PATH_SCALING5: ratio of {1, 8} |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 195 | * %CHAN_PATH_NONE: Do not use this pre-scaling ratio type. |
| 196 | * |
| 197 | * The pre-scaling is applied for signals to be within the voltage range |
| 198 | * of the ADC. |
| 199 | */ |
| 200 | enum qpnp_adc_channel_scaling_param { |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 201 | PATH_SCALING0 = 0, |
| 202 | PATH_SCALING1, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 203 | PATH_SCALING2, |
| 204 | PATH_SCALING3, |
| 205 | PATH_SCALING4, |
| Dipen Parmar | 46f8ac6 | 2014-01-19 22:45:11 +0530 | [diff] [blame] | 206 | PATH_SCALING5, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 207 | PATH_SCALING_NONE, |
| 208 | }; |
| 209 | |
| 210 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 211 | * enum qpnp_adc_scale_fn_type - Scaling function for pm8941 pre calibrated |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 212 | * digital data relative to ADC reference. |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 213 | * %SCALE_DEFAULT: Default scaling to convert raw adc code to voltage (uV). |
| 214 | * %SCALE_BATT_THERM: Conversion to temperature(decidegC) based on btm |
| 215 | * parameters. |
| 216 | * %SCALE_THERM_100K_PULLUP: Returns temperature in degC. |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 217 | * Uses a mapping table with 100K pullup. |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 218 | * %SCALE_PMIC_THERM: Returns result in milli degree's Centigrade. |
| 219 | * %SCALE_XOTHERM: Returns XO thermistor voltage in degree's Centigrade. |
| 220 | * %SCALE_THERM_150K_PULLUP: Returns temperature in degC. |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 221 | * Uses a mapping table with 150K pullup. |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 222 | * %SCALE_QRD_BATT_THERM: Conversion to temperature(decidegC) based on |
| 223 | * btm parameters. |
| Xu Kai | 81c6052 | 2013-07-27 14:26:04 +0800 | [diff] [blame] | 224 | * %SCALE_QRD_SKUAA_BATT_THERM: Conversion to temperature(decidegC) based on |
| 225 | * btm parametersi for SKUAA. |
| Wu Fenglin | 2c6ef8f | 2013-12-17 11:33:33 +0800 | [diff] [blame] | 226 | * %SCALE_QRD_SKUG_BATT_THERM: Conversion to temperature(decidegC) based on |
| 227 | * btm parametersi for SKUG. |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 228 | * %SCALE_NONE: Do not use this scaling type. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 229 | */ |
| 230 | enum qpnp_adc_scale_fn_type { |
| 231 | SCALE_DEFAULT = 0, |
| 232 | SCALE_BATT_THERM, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 233 | SCALE_THERM_100K_PULLUP, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 234 | SCALE_PMIC_THERM, |
| 235 | SCALE_XOTHERM, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 236 | SCALE_THERM_150K_PULLUP, |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 237 | SCALE_QRD_BATT_THERM, |
| Xu Kai | 81c6052 | 2013-07-27 14:26:04 +0800 | [diff] [blame] | 238 | SCALE_QRD_SKUAA_BATT_THERM, |
| Wu Fenglin | 2c6ef8f | 2013-12-17 11:33:33 +0800 | [diff] [blame] | 239 | SCALE_QRD_SKUG_BATT_THERM = 9, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 240 | SCALE_NONE, |
| 241 | }; |
| 242 | |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 243 | |
| 244 | /** |
| 245 | * enum qpnp_adc_tm_rscale_fn_type - Scaling function used to convert the |
| 246 | * channels input voltage/temperature to corresponding ADC code that is |
| 247 | * applied for thresholds. Check the corresponding channels scaling to |
| 248 | * determine the appropriate temperature/voltage units that are passed |
| 249 | * to the scaling function. Example battery follows the power supply |
| 250 | * framework that needs its units to be in decidegreesC so it passes |
| 251 | * deci-degreesC. PA_THERM clients pass the temperature in degrees. |
| 252 | * The order below should match the one in the driver for |
| 253 | * adc_tm_rscale_fn[]. |
| 254 | */ |
| 255 | enum qpnp_adc_tm_rscale_fn_type { |
| 256 | SCALE_R_VBATT = 0, |
| 257 | SCALE_RBATT_THERM, |
| 258 | SCALE_R_USB_ID, |
| 259 | SCALE_RPMIC_THERM, |
| 260 | SCALE_RSCALE_NONE, |
| 261 | }; |
| 262 | |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 263 | /** |
| 264 | * enum qpnp_adc_fast_avg_ctl - Provides ability to obtain single result |
| 265 | * from the ADC that is an average of multiple measurement |
| 266 | * samples. Select number of samples for use in fast |
| 267 | * average mode (i.e. 2 ^ value). |
| 268 | * %ADC_FAST_AVG_SAMPLE_1: 0x0 = 1 |
| 269 | * %ADC_FAST_AVG_SAMPLE_2: 0x1 = 2 |
| 270 | * %ADC_FAST_AVG_SAMPLE_4: 0x2 = 4 |
| 271 | * %ADC_FAST_AVG_SAMPLE_8: 0x3 = 8 |
| 272 | * %ADC_FAST_AVG_SAMPLE_16: 0x4 = 16 |
| 273 | * %ADC_FAST_AVG_SAMPLE_32: 0x5 = 32 |
| 274 | * %ADC_FAST_AVG_SAMPLE_64: 0x6 = 64 |
| 275 | * %ADC_FAST_AVG_SAMPLE_128: 0x7 = 128 |
| 276 | * %ADC_FAST_AVG_SAMPLE_256: 0x8 = 256 |
| 277 | * %ADC_FAST_AVG_SAMPLE_512: 0x9 = 512 |
| 278 | */ |
| 279 | enum qpnp_adc_fast_avg_ctl { |
| 280 | ADC_FAST_AVG_SAMPLE_1 = 0, |
| 281 | ADC_FAST_AVG_SAMPLE_2, |
| 282 | ADC_FAST_AVG_SAMPLE_4, |
| 283 | ADC_FAST_AVG_SAMPLE_8, |
| 284 | ADC_FAST_AVG_SAMPLE_16, |
| 285 | ADC_FAST_AVG_SAMPLE_32, |
| 286 | ADC_FAST_AVG_SAMPLE_64, |
| 287 | ADC_FAST_AVG_SAMPLE_128, |
| 288 | ADC_FAST_AVG_SAMPLE_256, |
| 289 | ADC_FAST_AVG_SAMPLE_512, |
| 290 | ADC_FAST_AVG_SAMPLE_NONE, |
| 291 | }; |
| 292 | |
| 293 | /** |
| 294 | * enum qpnp_adc_hw_settle_time - Time between AMUX getting configured and |
| 295 | * the ADC starting conversion. Delay = 100us * value for |
| 296 | * value < 11 and 2ms * (value - 10) otherwise. |
| 297 | * %ADC_CHANNEL_HW_SETTLE_DELAY_0US: 0us |
| 298 | * %ADC_CHANNEL_HW_SETTLE_DELAY_100US: 100us |
| 299 | * %ADC_CHANNEL_HW_SETTLE_DELAY_200US: 200us |
| 300 | * %ADC_CHANNEL_HW_SETTLE_DELAY_300US: 300us |
| 301 | * %ADC_CHANNEL_HW_SETTLE_DELAY_400US: 400us |
| 302 | * %ADC_CHANNEL_HW_SETTLE_DELAY_500US: 500us |
| 303 | * %ADC_CHANNEL_HW_SETTLE_DELAY_600US: 600us |
| 304 | * %ADC_CHANNEL_HW_SETTLE_DELAY_700US: 700us |
| 305 | * %ADC_CHANNEL_HW_SETTLE_DELAY_800US: 800us |
| 306 | * %ADC_CHANNEL_HW_SETTLE_DELAY_900US: 900us |
| 307 | * %ADC_CHANNEL_HW_SETTLE_DELAY_1MS: 1ms |
| 308 | * %ADC_CHANNEL_HW_SETTLE_DELAY_2MS: 2ms |
| 309 | * %ADC_CHANNEL_HW_SETTLE_DELAY_4MS: 4ms |
| 310 | * %ADC_CHANNEL_HW_SETTLE_DELAY_6MS: 6ms |
| 311 | * %ADC_CHANNEL_HW_SETTLE_DELAY_8MS: 8ms |
| 312 | * %ADC_CHANNEL_HW_SETTLE_DELAY_10MS: 10ms |
| 313 | * %ADC_CHANNEL_HW_SETTLE_NONE |
| 314 | */ |
| 315 | enum qpnp_adc_hw_settle_time { |
| 316 | ADC_CHANNEL_HW_SETTLE_DELAY_0US = 0, |
| 317 | ADC_CHANNEL_HW_SETTLE_DELAY_100US, |
| 318 | ADC_CHANNEL_HW_SETTLE_DELAY_2000US, |
| 319 | ADC_CHANNEL_HW_SETTLE_DELAY_300US, |
| 320 | ADC_CHANNEL_HW_SETTLE_DELAY_400US, |
| 321 | ADC_CHANNEL_HW_SETTLE_DELAY_500US, |
| 322 | ADC_CHANNEL_HW_SETTLE_DELAY_600US, |
| 323 | ADC_CHANNEL_HW_SETTLE_DELAY_700US, |
| 324 | ADC_CHANNEL_HW_SETTLE_DELAY_800US, |
| 325 | ADC_CHANNEL_HW_SETTLE_DELAY_900US, |
| 326 | ADC_CHANNEL_HW_SETTLE_DELAY_1MS, |
| 327 | ADC_CHANNEL_HW_SETTLE_DELAY_2MS, |
| 328 | ADC_CHANNEL_HW_SETTLE_DELAY_4MS, |
| 329 | ADC_CHANNEL_HW_SETTLE_DELAY_6MS, |
| 330 | ADC_CHANNEL_HW_SETTLE_DELAY_8MS, |
| 331 | ADC_CHANNEL_HW_SETTLE_DELAY_10MS, |
| 332 | ADC_CHANNEL_HW_SETTLE_NONE, |
| 333 | }; |
| 334 | |
| 335 | /** |
| 336 | * enum qpnp_vadc_mode_sel - Selects the basic mode of operation. |
| 337 | * - The normal mode is used for single measurement. |
| 338 | * - The Conversion sequencer is used to trigger an |
| 339 | * ADC read when a HW trigger is selected. |
| 340 | * - The measurement interval performs a single or |
| 341 | * continous measurement at a specified interval/delay. |
| 342 | * %ADC_OP_NORMAL_MODE : Normal mode used for single measurement. |
| 343 | * %ADC_OP_CONVERSION_SEQUENCER : Conversion sequencer used to trigger |
| 344 | * an ADC read on a HW supported trigger. |
| 345 | * Refer to enum qpnp_vadc_trigger for |
| 346 | * supported HW triggers. |
| 347 | * %ADC_OP_MEASUREMENT_INTERVAL : The measurement interval performs a |
| 348 | * single or continous measurement after a specified delay. |
| 349 | * For delay look at qpnp_adc_meas_timer. |
| 350 | */ |
| 351 | enum qpnp_vadc_mode_sel { |
| 352 | ADC_OP_NORMAL_MODE = 0, |
| 353 | ADC_OP_CONVERSION_SEQUENCER, |
| 354 | ADC_OP_MEASUREMENT_INTERVAL, |
| 355 | ADC_OP_MODE_NONE, |
| 356 | }; |
| 357 | |
| 358 | /** |
| 359 | * enum qpnp_vadc_trigger - Select the HW trigger to be used while |
| 360 | * measuring the ADC reading. |
| 361 | * %ADC_GSM_PA_ON : GSM power amplifier on. |
| 362 | * %ADC_TX_GTR_THRES : Transmit power greater than threshold. |
| 363 | * %ADC_CAMERA_FLASH_RAMP : Flash ramp up done. |
| 364 | * %ADC_DTEST : DTEST. |
| 365 | */ |
| 366 | enum qpnp_vadc_trigger { |
| 367 | ADC_GSM_PA_ON = 0, |
| 368 | ADC_TX_GTR_THRES, |
| 369 | ADC_CAMERA_FLASH_RAMP, |
| 370 | ADC_DTEST, |
| 371 | ADC_SEQ_NONE, |
| 372 | }; |
| 373 | |
| 374 | /** |
| 375 | * enum qpnp_vadc_conv_seq_timeout - Select delay (0 to 15ms) from |
| 376 | * conversion request to triggering conversion sequencer |
| 377 | * hold off time. |
| 378 | */ |
| 379 | enum qpnp_vadc_conv_seq_timeout { |
| 380 | ADC_CONV_SEQ_TIMEOUT_0MS = 0, |
| 381 | ADC_CONV_SEQ_TIMEOUT_1MS, |
| 382 | ADC_CONV_SEQ_TIMEOUT_2MS, |
| 383 | ADC_CONV_SEQ_TIMEOUT_3MS, |
| 384 | ADC_CONV_SEQ_TIMEOUT_4MS, |
| 385 | ADC_CONV_SEQ_TIMEOUT_5MS, |
| 386 | ADC_CONV_SEQ_TIMEOUT_6MS, |
| 387 | ADC_CONV_SEQ_TIMEOUT_7MS, |
| 388 | ADC_CONV_SEQ_TIMEOUT_8MS, |
| 389 | ADC_CONV_SEQ_TIMEOUT_9MS, |
| 390 | ADC_CONV_SEQ_TIMEOUT_10MS, |
| 391 | ADC_CONV_SEQ_TIMEOUT_11MS, |
| 392 | ADC_CONV_SEQ_TIMEOUT_12MS, |
| 393 | ADC_CONV_SEQ_TIMEOUT_13MS, |
| 394 | ADC_CONV_SEQ_TIMEOUT_14MS, |
| 395 | ADC_CONV_SEQ_TIMEOUT_15MS, |
| 396 | ADC_CONV_SEQ_TIMEOUT_NONE, |
| 397 | }; |
| 398 | |
| 399 | /** |
| 400 | * enum qpnp_adc_conv_seq_holdoff - Select delay from conversion |
| 401 | * trigger signal (i.e. adc_conv_seq_trig) transition |
| 402 | * to ADC enable. Delay = 25us * (value + 1). |
| 403 | */ |
| 404 | enum qpnp_adc_conv_seq_holdoff { |
| 405 | ADC_SEQ_HOLD_25US = 0, |
| 406 | ADC_SEQ_HOLD_50US, |
| 407 | ADC_SEQ_HOLD_75US, |
| 408 | ADC_SEQ_HOLD_100US, |
| 409 | ADC_SEQ_HOLD_125US, |
| 410 | ADC_SEQ_HOLD_150US, |
| 411 | ADC_SEQ_HOLD_175US, |
| 412 | ADC_SEQ_HOLD_200US, |
| 413 | ADC_SEQ_HOLD_225US, |
| 414 | ADC_SEQ_HOLD_250US, |
| 415 | ADC_SEQ_HOLD_275US, |
| 416 | ADC_SEQ_HOLD_300US, |
| 417 | ADC_SEQ_HOLD_325US, |
| 418 | ADC_SEQ_HOLD_350US, |
| 419 | ADC_SEQ_HOLD_375US, |
| 420 | ADC_SEQ_HOLD_400US, |
| 421 | ADC_SEQ_HOLD_NONE, |
| 422 | }; |
| 423 | |
| 424 | /** |
| 425 | * enum qpnp_adc_conv_seq_state - Conversion sequencer operating state |
| 426 | * %ADC_CONV_SEQ_IDLE : Sequencer is in idle. |
| 427 | * %ADC_CONV_TRIG_RISE : Waiting for rising edge trigger. |
| 428 | * %ADC_CONV_TRIG_HOLDOFF : Waiting for rising trigger hold off time. |
| 429 | * %ADC_CONV_MEAS_RISE : Measuring selected ADC signal. |
| 430 | * %ADC_CONV_TRIG_FALL : Waiting for falling trigger edge. |
| 431 | * %ADC_CONV_FALL_HOLDOFF : Waiting for falling trigger hold off time. |
| 432 | * %ADC_CONV_MEAS_FALL : Measuring selected ADC signal. |
| 433 | * %ADC_CONV_ERROR : Aberrant Hardware problem. |
| 434 | */ |
| 435 | enum qpnp_adc_conv_seq_state { |
| 436 | ADC_CONV_SEQ_IDLE = 0, |
| 437 | ADC_CONV_TRIG_RISE, |
| 438 | ADC_CONV_TRIG_HOLDOFF, |
| 439 | ADC_CONV_MEAS_RISE, |
| 440 | ADC_CONV_TRIG_FALL, |
| 441 | ADC_CONV_FALL_HOLDOFF, |
| 442 | ADC_CONV_MEAS_FALL, |
| 443 | ADC_CONV_ERROR, |
| 444 | ADC_CONV_NONE, |
| 445 | }; |
| 446 | |
| 447 | /** |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 448 | * enum qpnp_adc_meas_timer_1 - Selects the measurement interval time. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 449 | * If value = 0, use 0ms else use 2^(value + 4)/ 32768). |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 450 | * The timer period is used by the USB_ID. Do not set a polling rate |
| 451 | * greater than 1 second on PMIC 2.0. The max polling rate on the PMIC 2.0 |
| 452 | * appears to be limited to 1 second. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 453 | * %ADC_MEAS_INTERVAL_0MS : 0ms |
| 454 | * %ADC_MEAS_INTERVAL_1P0MS : 1ms |
| 455 | * %ADC_MEAS_INTERVAL_2P0MS : 2ms |
| 456 | * %ADC_MEAS_INTERVAL_3P9MS : 3.9ms |
| 457 | * %ADC_MEAS_INTERVAL_7P8MS : 7.8ms |
| 458 | * %ADC_MEAS_INTERVAL_15P6MS : 15.6ms |
| 459 | * %ADC_MEAS_INTERVAL_31P3MS : 31.3ms |
| 460 | * %ADC_MEAS_INTERVAL_62P5MS : 62.5ms |
| 461 | * %ADC_MEAS_INTERVAL_125MS : 125ms |
| 462 | * %ADC_MEAS_INTERVAL_250MS : 250ms |
| 463 | * %ADC_MEAS_INTERVAL_500MS : 500ms |
| 464 | * %ADC_MEAS_INTERVAL_1S : 1seconds |
| 465 | * %ADC_MEAS_INTERVAL_2S : 2seconds |
| 466 | * %ADC_MEAS_INTERVAL_4S : 4seconds |
| 467 | * %ADC_MEAS_INTERVAL_8S : 8seconds |
| 468 | * %ADC_MEAS_INTERVAL_16S: 16seconds |
| 469 | */ |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 470 | enum qpnp_adc_meas_timer_1 { |
| 471 | ADC_MEAS1_INTERVAL_0MS = 0, |
| 472 | ADC_MEAS1_INTERVAL_1P0MS, |
| 473 | ADC_MEAS1_INTERVAL_2P0MS, |
| 474 | ADC_MEAS1_INTERVAL_3P9MS, |
| 475 | ADC_MEAS1_INTERVAL_7P8MS, |
| 476 | ADC_MEAS1_INTERVAL_15P6MS, |
| 477 | ADC_MEAS1_INTERVAL_31P3MS, |
| 478 | ADC_MEAS1_INTERVAL_62P5MS, |
| 479 | ADC_MEAS1_INTERVAL_125MS, |
| 480 | ADC_MEAS1_INTERVAL_250MS, |
| 481 | ADC_MEAS1_INTERVAL_500MS, |
| 482 | ADC_MEAS1_INTERVAL_1S, |
| 483 | ADC_MEAS1_INTERVAL_2S, |
| 484 | ADC_MEAS1_INTERVAL_4S, |
| 485 | ADC_MEAS1_INTERVAL_8S, |
| 486 | ADC_MEAS1_INTERVAL_16S, |
| 487 | ADC_MEAS1_INTERVAL_NONE, |
| 488 | }; |
| 489 | |
| 490 | /** |
| 491 | * enum qpnp_adc_meas_timer_2 - Selects the measurement interval time. |
| 492 | * If value = 0, use 0ms else use 2^(value + 4)/ 32768). |
| 493 | * The timer period is used by the batt_therm. Do not set a polling rate |
| 494 | * greater than 1 second on PMIC 2.0. The max polling rate on the PMIC 2.0 |
| 495 | * appears to be limited to 1 second. |
| 496 | * %ADC_MEAS_INTERVAL_0MS : 0ms |
| 497 | * %ADC_MEAS_INTERVAL_100MS : 100ms |
| 498 | * %ADC_MEAS_INTERVAL_200MS : 200ms |
| 499 | * %ADC_MEAS_INTERVAL_300MS : 300ms |
| 500 | * %ADC_MEAS_INTERVAL_400MS : 400ms |
| 501 | * %ADC_MEAS_INTERVAL_500MS : 500ms |
| 502 | * %ADC_MEAS_INTERVAL_600MS : 600ms |
| 503 | * %ADC_MEAS_INTERVAL_700MS : 700ms |
| 504 | * %ADC_MEAS_INTERVAL_800MS : 800ms |
| 505 | * %ADC_MEAS_INTERVAL_900MS : 900ms |
| 506 | * %ADC_MEAS_INTERVAL_1S: 1seconds |
| 507 | * %ADC_MEAS_INTERVAL_1P1S: 1.1seconds |
| 508 | * %ADC_MEAS_INTERVAL_1P2S: 1.2seconds |
| 509 | * %ADC_MEAS_INTERVAL_1P3S: 1.3seconds |
| 510 | * %ADC_MEAS_INTERVAL_1P4S: 1.4seconds |
| 511 | * %ADC_MEAS_INTERVAL_1P5S: 1.5seconds |
| 512 | */ |
| 513 | enum qpnp_adc_meas_timer_2 { |
| 514 | ADC_MEAS2_INTERVAL_0MS = 0, |
| 515 | ADC_MEAS2_INTERVAL_100MS, |
| 516 | ADC_MEAS2_INTERVAL_200MS, |
| 517 | ADC_MEAS2_INTERVAL_300MS, |
| 518 | ADC_MEAS2_INTERVAL_400MS, |
| 519 | ADC_MEAS2_INTERVAL_500MS, |
| 520 | ADC_MEAS2_INTERVAL_600MS, |
| 521 | ADC_MEAS2_INTERVAL_700MS, |
| 522 | ADC_MEAS2_INTERVAL_800MS, |
| 523 | ADC_MEAS2_INTERVAL_900MS, |
| 524 | ADC_MEAS2_INTERVAL_1S, |
| 525 | ADC_MEAS2_INTERVAL_1P1S, |
| 526 | ADC_MEAS2_INTERVAL_1P2S, |
| 527 | ADC_MEAS2_INTERVAL_1P3S, |
| 528 | ADC_MEAS2_INTERVAL_1P4S, |
| 529 | ADC_MEAS2_INTERVAL_1P5S, |
| 530 | ADC_MEAS2_INTERVAL_NONE, |
| 531 | }; |
| 532 | |
| 533 | /** |
| 534 | * enum qpnp_adc_meas_timer_3 - Selects the measurement interval time. |
| 535 | * If value = 0, use 0ms else use 2^(value + 4)/ 32768). |
| 536 | * Do not set a polling rate greater than 1 second on PMIC 2.0. |
| 537 | * The max polling rate on the PMIC 2.0 appears to be limited to 1 second. |
| 538 | * %ADC_MEAS_INTERVAL_0MS : 0ms |
| 539 | * %ADC_MEAS_INTERVAL_1S : 1seconds |
| 540 | * %ADC_MEAS_INTERVAL_2S : 2seconds |
| 541 | * %ADC_MEAS_INTERVAL_3S : 3seconds |
| 542 | * %ADC_MEAS_INTERVAL_4S : 4seconds |
| 543 | * %ADC_MEAS_INTERVAL_5S : 5seconds |
| 544 | * %ADC_MEAS_INTERVAL_6S: 6seconds |
| 545 | * %ADC_MEAS_INTERVAL_7S : 7seconds |
| 546 | * %ADC_MEAS_INTERVAL_8S : 8seconds |
| 547 | * %ADC_MEAS_INTERVAL_9S : 9seconds |
| 548 | * %ADC_MEAS_INTERVAL_10S : 10seconds |
| 549 | * %ADC_MEAS_INTERVAL_11S : 11seconds |
| 550 | * %ADC_MEAS_INTERVAL_12S : 12seconds |
| 551 | * %ADC_MEAS_INTERVAL_13S : 13seconds |
| 552 | * %ADC_MEAS_INTERVAL_14S : 14seconds |
| 553 | * %ADC_MEAS_INTERVAL_15S : 15seconds |
| 554 | */ |
| 555 | enum qpnp_adc_meas_timer_3 { |
| 556 | ADC_MEAS3_INTERVAL_0S = 0, |
| 557 | ADC_MEAS3_INTERVAL_1S, |
| 558 | ADC_MEAS3_INTERVAL_2S, |
| 559 | ADC_MEAS3_INTERVAL_3S, |
| 560 | ADC_MEAS3_INTERVAL_4S, |
| 561 | ADC_MEAS3_INTERVAL_5S, |
| 562 | ADC_MEAS3_INTERVAL_6S, |
| 563 | ADC_MEAS3_INTERVAL_7S, |
| 564 | ADC_MEAS3_INTERVAL_8S, |
| 565 | ADC_MEAS3_INTERVAL_9S, |
| 566 | ADC_MEAS3_INTERVAL_10S, |
| 567 | ADC_MEAS3_INTERVAL_11S, |
| 568 | ADC_MEAS3_INTERVAL_12S, |
| 569 | ADC_MEAS3_INTERVAL_13S, |
| 570 | ADC_MEAS3_INTERVAL_14S, |
| 571 | ADC_MEAS3_INTERVAL_15S, |
| 572 | ADC_MEAS3_INTERVAL_NONE, |
| 573 | }; |
| 574 | |
| 575 | /** |
| 576 | * enum qpnp_adc_meas_timer_select - Selects the timer for which |
| 577 | * the appropriate polling frequency is set. |
| Siddartha Mohanadoss | 58ffe0e | 2014-02-11 17:40:13 -0800 | [diff] [blame] | 578 | * %ADC_MEAS_TIMER_SELECT1 - Select this timer for measurement polling interval |
| 579 | * for 1 second. |
| 580 | * %ADC_MEAS_TIMER_SELECT2 - Select this timer for 500ms measurement interval. |
| 581 | * %ADC_MEAS_TIMER_SELECT3 - Select this timer for 5 second interval. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 582 | */ |
| 583 | enum qpnp_adc_meas_timer_select { |
| 584 | ADC_MEAS_TIMER_SELECT1 = 0, |
| 585 | ADC_MEAS_TIMER_SELECT2, |
| 586 | ADC_MEAS_TIMER_SELECT3, |
| 587 | ADC_MEAS_TIMER_NUM, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 588 | }; |
| 589 | |
| 590 | /** |
| 591 | * enum qpnp_adc_meas_interval_op_ctl - Select operating mode. |
| 592 | * %ADC_MEAS_INTERVAL_OP_SINGLE : Conduct single measurement at specified time |
| 593 | * delay. |
| 594 | * %ADC_MEAS_INTERVAL_OP_CONTINUOUS : Make measurements at measurement interval |
| 595 | * times. |
| 596 | */ |
| 597 | enum qpnp_adc_meas_interval_op_ctl { |
| 598 | ADC_MEAS_INTERVAL_OP_SINGLE = 0, |
| 599 | ADC_MEAS_INTERVAL_OP_CONTINUOUS, |
| 600 | ADC_MEAS_INTERVAL_OP_NONE, |
| 601 | }; |
| 602 | |
| 603 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 604 | * Channel selection registers for each of the configurable measurements |
| 605 | * Channels allotment is set at device config for a channel. |
| 606 | * The USB_ID, BATT_THERM, PMIC_THERM and VBAT channels are used by the |
| 607 | * kernel space USB, Battery and IADC drivers. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 608 | * The other 3 channels are configurable for use by userspace clients. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 609 | */ |
| 610 | enum qpnp_adc_tm_channel_select { |
| 611 | QPNP_ADC_TM_M0_ADC_CH_SEL_CTL = 0x48, |
| 612 | QPNP_ADC_TM_M1_ADC_CH_SEL_CTL = 0x68, |
| 613 | QPNP_ADC_TM_M2_ADC_CH_SEL_CTL = 0x70, |
| 614 | QPNP_ADC_TM_M3_ADC_CH_SEL_CTL = 0x78, |
| 615 | QPNP_ADC_TM_M4_ADC_CH_SEL_CTL = 0x80, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 616 | QPNP_ADC_TM_M5_ADC_CH_SEL_CTL = 0x88, |
| 617 | QPNP_ADC_TM_M6_ADC_CH_SEL_CTL = 0x90, |
| 618 | QPNP_ADC_TM_M7_ADC_CH_SEL_CTL = 0x98, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 619 | QPNP_ADC_TM_CH_SELECT_NONE |
| 620 | }; |
| 621 | |
| Siddartha Mohanadoss | 71a8344 | 2013-08-29 11:43:24 -0700 | [diff] [blame] | 622 | /** |
| 623 | * Channel index for the corresponding index to qpnp_adc_tm_channel_selec |
| 624 | */ |
| 625 | enum qpnp_adc_tm_channel_num { |
| 626 | QPNP_ADC_TM_CHAN0 = 0, |
| 627 | QPNP_ADC_TM_CHAN1, |
| 628 | QPNP_ADC_TM_CHAN2, |
| 629 | QPNP_ADC_TM_CHAN3, |
| 630 | QPNP_ADC_TM_CHAN4, |
| 631 | QPNP_ADC_TM_CHAN5, |
| 632 | QPNP_ADC_TM_CHAN6, |
| 633 | QPNP_ADC_TM_CHAN7, |
| 634 | QPNP_ADC_TM_CHAN_NONE |
| 635 | }; |
| 636 | |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 637 | enum qpnp_comp_scheme_type { |
| 638 | COMP_ID_GF = 0, |
| 639 | COMP_ID_SMIC, |
| 640 | COMP_ID_TSMC, |
| 641 | COMP_ID_NUM, |
| 642 | }; |
| 643 | |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 644 | /** |
| 645 | * struct qpnp_adc_tm_config - Represent ADC Thermal Monitor configuration. |
| 646 | * @channel: ADC channel for which thermal monitoring is requested. |
| 647 | * @adc_code: The pre-calibrated digital output of a given ADC releative to the |
| 648 | * ADC reference. |
| 649 | * @high_thr_temp: Temperature at which high threshold notification is required. |
| 650 | * @low_thr_temp: Temperature at which low threshold notification is required. |
| 651 | * @low_thr_voltage : Low threshold voltage ADC code used for reverse |
| 652 | * calibration. |
| 653 | * @high_thr_voltage: High threshold voltage ADC code used for reverse |
| 654 | * calibration. |
| 655 | */ |
| 656 | struct qpnp_adc_tm_config { |
| 657 | int channel; |
| 658 | int adc_code; |
| 659 | int high_thr_temp; |
| 660 | int low_thr_temp; |
| 661 | int64_t high_thr_voltage; |
| 662 | int64_t low_thr_voltage; |
| 663 | }; |
| 664 | |
| 665 | /** |
| 666 | * enum qpnp_adc_tm_trip_type - Type for setting high/low temperature/voltage. |
| 667 | * %ADC_TM_TRIP_HIGH_WARM: Setting high temperature. Note that high temperature |
| 668 | * corresponds to low voltage. Driver handles this case |
| 669 | * appropriately to set high/low thresholds for voltage. |
| 670 | * threshold. |
| 671 | * %ADC_TM_TRIP_LOW_COOL: Setting low temperature. |
| 672 | */ |
| 673 | enum qpnp_adc_tm_trip_type { |
| 674 | ADC_TM_TRIP_HIGH_WARM = 0, |
| 675 | ADC_TM_TRIP_LOW_COOL, |
| 676 | ADC_TM_TRIP_NUM, |
| 677 | }; |
| 678 | |
| 679 | /** |
| 680 | * enum qpnp_tm_state - This lets the client know whether the threshold |
| 681 | * that was crossed was high/low. |
| 682 | * %ADC_TM_HIGH_STATE: Client is notified of crossing the requested high |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 683 | * voltage threshold. |
| 684 | * %ADC_TM_COOL_STATE: Client is notified of crossing the requested cool |
| 685 | * temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 686 | * %ADC_TM_LOW_STATE: Client is notified of crossing the requested low |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 687 | * voltage threshold. |
| 688 | * %ADC_TM_WARM_STATE: Client is notified of crossing the requested high |
| 689 | * temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 690 | */ |
| 691 | enum qpnp_tm_state { |
| 692 | ADC_TM_HIGH_STATE = 0, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 693 | ADC_TM_COOL_STATE = ADC_TM_HIGH_STATE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 694 | ADC_TM_LOW_STATE, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 695 | ADC_TM_WARM_STATE = ADC_TM_LOW_STATE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 696 | ADC_TM_STATE_NUM, |
| 697 | }; |
| 698 | |
| 699 | /** |
| 700 | * enum qpnp_state_request - Request to enable/disable the corresponding |
| 701 | * high/low voltage/temperature thresholds. |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 702 | * %ADC_TM_HIGH_THR_ENABLE: Enable high voltage threshold. |
| 703 | * %ADC_TM_COOL_THR_ENABLE = Enables cool temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 704 | * %ADC_TM_LOW_THR_ENABLE: Enable low voltage/temperature threshold. |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 705 | * %ADC_TM_WARM_THR_ENABLE = Enables warm temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 706 | * %ADC_TM_HIGH_LOW_THR_ENABLE: Enable high and low voltage/temperature |
| 707 | * threshold. |
| 708 | * %ADC_TM_HIGH_THR_DISABLE: Disable high voltage/temperature threshold. |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 709 | * %ADC_TM_COOL_THR_ENABLE = Disables cool temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 710 | * %ADC_TM_LOW_THR_DISABLE: Disable low voltage/temperature threshold. |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 711 | * %ADC_TM_WARM_THR_ENABLE = Disables warm temperature threshold. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 712 | * %ADC_TM_HIGH_THR_DISABLE: Disable high and low voltage/temperature |
| 713 | * threshold. |
| 714 | */ |
| 715 | enum qpnp_state_request { |
| 716 | ADC_TM_HIGH_THR_ENABLE = 0, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 717 | ADC_TM_COOL_THR_ENABLE = ADC_TM_HIGH_THR_ENABLE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 718 | ADC_TM_LOW_THR_ENABLE, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 719 | ADC_TM_WARM_THR_ENABLE = ADC_TM_LOW_THR_ENABLE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 720 | ADC_TM_HIGH_LOW_THR_ENABLE, |
| 721 | ADC_TM_HIGH_THR_DISABLE, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 722 | ADC_TM_COOL_THR_DISABLE = ADC_TM_HIGH_THR_DISABLE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 723 | ADC_TM_LOW_THR_DISABLE, |
| Siddartha Mohanadoss | b8109da | 2013-03-25 09:53:43 -0700 | [diff] [blame] | 724 | ADC_TM_WARM_THR_DISABLE = ADC_TM_LOW_THR_DISABLE, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 725 | ADC_TM_HIGH_LOW_THR_DISABLE, |
| 726 | ADC_TM_THR_NUM, |
| 727 | }; |
| 728 | |
| 729 | /** |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 730 | * struct qpnp_adc_tm_btm_param - Represent Battery temperature threshold |
| 731 | * monitoring configuration. |
| 732 | * @high_temp: High temperature threshold for which notification is requested. |
| 733 | * @low_temp: Low temperature threshold for which notification is requested. |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 734 | * @high_thr_voltage: High voltage for which notification is requested. |
| 735 | * @low_thr_voltage: Low voltage for which notification is requested. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 736 | * @state_request: Enable/disable the corresponding high and low temperature |
| 737 | * thresholds. |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 738 | * @timer_interval1: Select polling rate from qpnp_adc_meas_timer_1 type. |
| 739 | * @timer_interval2: Select polling rate from qpnp_adc_meas_timer_2 type. |
| 740 | * @timer_interval3: Select polling rate from qpnp_adc_meas_timer_3 type. |
| Siddartha Mohanadoss | d71e240 | 2013-02-01 17:36:23 -0800 | [diff] [blame] | 741 | * @btmid_ctx: A context of void type. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 742 | * @threshold_notification: Notification callback once threshold are crossed. |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 743 | * units to be used for High/Low temperature and voltage notification - |
| 744 | * This depends on the clients usage. Check the rscaling function |
| 745 | * for the appropriate channel nodes. |
| 746 | * @Batt therm clients temperature units is decidegreesCentigrate. |
| 747 | * @USB_ID inputs the voltage units in milli-volts. |
| 748 | * @PA_THERM inputs the units in degC. |
| 749 | * @PMIC_THERM inputs the units in millidegC. |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 750 | */ |
| 751 | struct qpnp_adc_tm_btm_param { |
| 752 | int32_t high_temp; |
| 753 | int32_t low_temp; |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 754 | int32_t high_thr; |
| 755 | int32_t low_thr; |
| 756 | enum qpnp_vadc_channels channel; |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 757 | enum qpnp_state_request state_request; |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 758 | enum qpnp_adc_meas_timer_1 timer_interval; |
| 759 | enum qpnp_adc_meas_timer_2 timer_interval2; |
| 760 | enum qpnp_adc_meas_timer_3 timer_interval3; |
| Siddartha Mohanadoss | d71e240 | 2013-02-01 17:36:23 -0800 | [diff] [blame] | 761 | void *btm_ctx; |
| 762 | void (*threshold_notification) (enum qpnp_tm_state state, |
| 763 | void *ctx); |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 764 | }; |
| 765 | |
| 766 | /** |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 767 | * struct qpnp_vadc_linear_graph - Represent ADC characteristics. |
| 768 | * @dy: Numerator slope to calculate the gain. |
| 769 | * @dx: Denominator slope to calculate the gain. |
| 770 | * @adc_vref: A/D word of the voltage reference used for the channel. |
| 771 | * @adc_gnd: A/D word of the ground reference used for the channel. |
| 772 | * |
| 773 | * Each ADC device has different offset and gain parameters which are computed |
| 774 | * to calibrate the device. |
| 775 | */ |
| 776 | struct qpnp_vadc_linear_graph { |
| 777 | int64_t dy; |
| 778 | int64_t dx; |
| 779 | int64_t adc_vref; |
| 780 | int64_t adc_gnd; |
| 781 | }; |
| 782 | |
| 783 | /** |
| 784 | * struct qpnp_vadc_map_pt - Map the graph representation for ADC channel |
| 785 | * @x: Represent the ADC digitized code. |
| 786 | * @y: Represent the physical data which can be temperature, voltage, |
| 787 | * resistance. |
| 788 | */ |
| 789 | struct qpnp_vadc_map_pt { |
| 790 | int32_t x; |
| 791 | int32_t y; |
| 792 | }; |
| 793 | |
| 794 | /** |
| 795 | * struct qpnp_vadc_scaling_ratio - Represent scaling ratio for adc input. |
| 796 | * @num: Numerator scaling parameter. |
| 797 | * @den: Denominator scaling parameter. |
| 798 | */ |
| 799 | struct qpnp_vadc_scaling_ratio { |
| 800 | int32_t num; |
| 801 | int32_t den; |
| 802 | }; |
| 803 | |
| 804 | /** |
| 805 | * struct qpnp_adc_properties - Represent the ADC properties. |
| 806 | * @adc_reference: Reference voltage for QPNP ADC. |
| 807 | * @bitresolution: ADC bit resolution for QPNP ADC. |
| 808 | * @biploar: Polarity for QPNP ADC. |
| 809 | */ |
| 810 | struct qpnp_adc_properties { |
| 811 | uint32_t adc_vdd_reference; |
| 812 | uint32_t bitresolution; |
| 813 | bool bipolar; |
| 814 | }; |
| 815 | |
| 816 | /** |
| 817 | * struct qpnp_vadc_chan_properties - Represent channel properties of the ADC. |
| 818 | * @offset_gain_numerator: The inverse numerator of the gain applied to the |
| 819 | * input channel. |
| 820 | * @offset_gain_denominator: The inverse denominator of the gain applied to the |
| 821 | * input channel. |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 822 | * @high_thr: High threshold voltage that is requested to be set. |
| 823 | * @low_thr: Low threshold voltage that is requested to be set. |
| 824 | * @timer_select: Choosen from one of the 3 timers to set the polling rate for |
| 825 | * the VADC_BTM channel. |
| 826 | * @meas_interval1: Polling rate to set for timer 1. |
| 827 | * @meas_interval2: Polling rate to set for timer 2. |
| 828 | * @tm_channel_select: BTM channel number for the 5 VADC_BTM channels. |
| 829 | * @state_request: User can select either enable or disable high/low or both |
| 830 | * activation levels based on the qpnp_state_request type. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 831 | * @adc_graph: ADC graph for the channel of struct type qpnp_adc_linear_graph. |
| 832 | */ |
| 833 | struct qpnp_vadc_chan_properties { |
| 834 | uint32_t offset_gain_numerator; |
| 835 | uint32_t offset_gain_denominator; |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 836 | uint32_t high_thr; |
| 837 | uint32_t low_thr; |
| 838 | enum qpnp_adc_meas_timer_select timer_select; |
| 839 | enum qpnp_adc_meas_timer_1 meas_interval1; |
| 840 | enum qpnp_adc_meas_timer_2 meas_interval2; |
| 841 | enum qpnp_adc_tm_channel_select tm_channel_select; |
| 842 | enum qpnp_state_request state_request; |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 843 | struct qpnp_vadc_linear_graph adc_graph[2]; |
| 844 | }; |
| 845 | |
| 846 | /** |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 847 | * struct qpnp_vadc_result - Represent the result of the QPNP ADC. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 848 | * @chan: The channel number of the requested conversion. |
| 849 | * @adc_code: The pre-calibrated digital output of a given ADC relative to the |
| 850 | * the ADC reference. |
| 851 | * @measurement: In units specific for a given ADC; most ADC uses reference |
| 852 | * voltage but some ADC uses reference current. This measurement |
| 853 | * here is a number relative to a reference of a given ADC. |
| 854 | * @physical: The data meaningful for each individual channel whether it is |
| 855 | * voltage, current, temperature, etc. |
| 856 | * All voltage units are represented in micro - volts. |
| 857 | * -Battery temperature units are represented as 0.1 DegC. |
| 858 | * -PA Therm temperature units are represented as DegC. |
| 859 | * -PMIC Die temperature units are represented as 0.001 DegC. |
| 860 | */ |
| 861 | struct qpnp_vadc_result { |
| 862 | uint32_t chan; |
| 863 | int32_t adc_code; |
| 864 | int64_t measurement; |
| 865 | int64_t physical; |
| 866 | }; |
| 867 | |
| 868 | /** |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 869 | * struct qpnp_adc_amux - AMUX properties for individual channel |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 870 | * @name: Channel string name. |
| 871 | * @channel_num: Channel in integer used from qpnp_adc_channels. |
| 872 | * @chan_path_prescaling: Channel scaling performed on the input signal. |
| 873 | * @adc_decimation: Sampling rate desired for the channel. |
| 874 | * adc_scale_fn: Scaling function to convert to the data meaningful for |
| 875 | * each individual channel whether it is voltage, current, |
| 876 | * temperature, etc and compensates the channel properties. |
| 877 | */ |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 878 | struct qpnp_adc_amux { |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 879 | char *name; |
| 880 | enum qpnp_vadc_channels channel_num; |
| 881 | enum qpnp_adc_channel_scaling_param chan_path_prescaling; |
| 882 | enum qpnp_adc_decimation_type adc_decimation; |
| 883 | enum qpnp_adc_scale_fn_type adc_scale_fn; |
| 884 | enum qpnp_adc_fast_avg_ctl fast_avg_setup; |
| 885 | enum qpnp_adc_hw_settle_time hw_settle_time; |
| 886 | }; |
| 887 | |
| 888 | /** |
| 889 | * struct qpnp_vadc_scaling_ratio |
| 890 | * |
| 891 | */ |
| 892 | static const struct qpnp_vadc_scaling_ratio qpnp_vadc_amux_scaling_ratio[] = { |
| 893 | {1, 1}, |
| 894 | {1, 3}, |
| 895 | {1, 4}, |
| 896 | {1, 6}, |
| Dipen Parmar | 46f8ac6 | 2014-01-19 22:45:11 +0530 | [diff] [blame] | 897 | {1, 20}, |
| 898 | {1, 8} |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 899 | }; |
| 900 | |
| 901 | /** |
| 902 | * struct qpnp_vadc_scale_fn - Scaling function prototype |
| 903 | * @chan: Function pointer to one of the scaling functions |
| 904 | * which takes the adc properties, channel properties, |
| 905 | * and returns the physical result |
| 906 | */ |
| 907 | struct qpnp_vadc_scale_fn { |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 908 | int32_t (*chan) (struct qpnp_vadc_chip *, int32_t, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 909 | const struct qpnp_adc_properties *, |
| 910 | const struct qpnp_vadc_chan_properties *, |
| 911 | struct qpnp_vadc_result *); |
| 912 | }; |
| 913 | |
| 914 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 915 | * struct qpnp_adc_tm_reverse_scale_fn - Reverse scaling prototype |
| 916 | * @chan: Function pointer to one of the scaling functions |
| 917 | * which takes the adc properties, channel properties, |
| 918 | * and returns the physical result |
| 919 | */ |
| 920 | struct qpnp_adc_tm_reverse_scale_fn { |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 921 | int32_t (*chan) (struct qpnp_vadc_chip *, |
| 922 | struct qpnp_adc_tm_btm_param *, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 923 | uint32_t *, uint32_t *); |
| 924 | }; |
| 925 | |
| 926 | /** |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 927 | * struct qpnp_iadc_calib - IADC channel calibration structure. |
| 928 | * @channel - Channel for which the historical offset and gain is |
| 929 | * calculated. Available channels are internal rsense, |
| 930 | * external rsense and alternate lead pairs. |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 931 | * @offset_raw - raw Offset value for the channel. |
| 932 | * @gain_raw - raw Gain of the channel. |
| 933 | * @ideal_offset_uv - ideal offset value for the channel. |
| 934 | * @ideal_gain_nv - ideal gain for the channel. |
| 935 | * @offset_uv - converted value of offset in uV. |
| 936 | * @gain_uv - converted value of gain in uV. |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 937 | */ |
| 938 | struct qpnp_iadc_calib { |
| 939 | enum qpnp_iadc_channels channel; |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 940 | uint16_t offset_raw; |
| 941 | uint16_t gain_raw; |
| 942 | uint32_t ideal_offset_uv; |
| 943 | uint32_t ideal_gain_nv; |
| 944 | uint32_t offset_uv; |
| 945 | uint32_t gain_uv; |
| 946 | }; |
| 947 | |
| 948 | /** |
| 949 | * struct qpnp_iadc_result - IADC read result structure. |
| 950 | * @oresult_uv - Result of ADC in uV. |
| 951 | * @result_ua - Result of ADC in uA. |
| 952 | */ |
| 953 | struct qpnp_iadc_result { |
| 954 | int32_t result_uv; |
| 955 | int32_t result_ua; |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 956 | }; |
| 957 | |
| 958 | /** |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 959 | * struct qpnp_adc_drv - QPNP ADC device structure. |
| 960 | * @spmi - spmi device for ADC peripheral. |
| 961 | * @offset - base offset for the ADC peripheral. |
| 962 | * @adc_prop - ADC properties specific to the ADC peripheral. |
| 963 | * @amux_prop - AMUX properties representing the ADC peripheral. |
| 964 | * @adc_channels - ADC channel properties for the ADC peripheral. |
| Siddartha Mohanadoss | 1210995 | 2012-11-20 14:57:51 -0800 | [diff] [blame] | 965 | * @adc_irq_eoc - End of Conversion IRQ. |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 966 | * @adc_irq_fifo_not_empty - Conversion sequencer request written |
| 967 | * to FIFO when not empty. |
| 968 | * @adc_irq_conv_seq_timeout - Conversion sequencer trigger timeout. |
| 969 | * @adc_high_thr_irq - Output higher than high threshold set for measurement. |
| 970 | * @adc_low_thr_irq - Output lower than low threshold set for measurement. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 971 | * @adc_lock - ADC lock for access to the peripheral. |
| 972 | * @adc_rslt_completion - ADC result notification after interrupt |
| 973 | * is received. |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 974 | * @calib - Internal rsens calibration values for gain and offset. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 975 | */ |
| 976 | struct qpnp_adc_drv { |
| 977 | struct spmi_device *spmi; |
| 978 | uint8_t slave; |
| 979 | uint16_t offset; |
| 980 | struct qpnp_adc_properties *adc_prop; |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 981 | struct qpnp_adc_amux_properties *amux_prop; |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 982 | struct qpnp_adc_amux *adc_channels; |
| Siddartha Mohanadoss | 1210995 | 2012-11-20 14:57:51 -0800 | [diff] [blame] | 983 | int adc_irq_eoc; |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 984 | int adc_irq_fifo_not_empty; |
| 985 | int adc_irq_conv_seq_timeout; |
| 986 | int adc_high_thr_irq; |
| 987 | int adc_low_thr_irq; |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 988 | struct mutex adc_lock; |
| 989 | struct completion adc_rslt_completion; |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 990 | struct qpnp_iadc_calib calib; |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 991 | }; |
| 992 | |
| 993 | /** |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 994 | * struct qpnp_adc_amux_properties - QPNP VADC amux channel property. |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 995 | * @amux_channel - Refer to the qpnp_vadc_channel list. |
| 996 | * @decimation - Sampling rate supported for the channel. |
| 997 | * @mode_sel - The basic mode of operation. |
| 998 | * @hw_settle_time - The time between AMUX being configured and the |
| 999 | * start of conversion. |
| 1000 | * @fast_avg_setup - Ability to provide single result from the ADC |
| 1001 | * that is an average of multiple measurements. |
| 1002 | * @trigger_channel - HW trigger channel for conversion sequencer. |
| 1003 | * @chan_prop - Represent the channel properties of the ADC. |
| 1004 | */ |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1005 | struct qpnp_adc_amux_properties { |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 1006 | uint32_t amux_channel; |
| 1007 | uint32_t decimation; |
| 1008 | uint32_t mode_sel; |
| 1009 | uint32_t hw_settle_time; |
| 1010 | uint32_t fast_avg_setup; |
| 1011 | enum qpnp_vadc_trigger trigger_channel; |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1012 | struct qpnp_vadc_chan_properties chan_prop[0]; |
| 1013 | }; |
| 1014 | |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 1015 | /* SW index's for PMIC type and version used by QPNP VADC and IADC */ |
| 1016 | #define QPNP_REV_ID_8941_3_1 1 |
| 1017 | #define QPNP_REV_ID_8026_1_0 2 |
| 1018 | #define QPNP_REV_ID_8026_2_0 3 |
| 1019 | #define QPNP_REV_ID_8110_1_0 4 |
| 1020 | #define QPNP_REV_ID_8026_2_1 5 |
| Xiaozhe Shi | 8075422 | 2013-10-30 14:11:41 -0700 | [diff] [blame] | 1021 | #define QPNP_REV_ID_8110_2_0 6 |
| Siddartha Mohanadoss | 68b4e08 | 2014-01-28 10:53:13 -0800 | [diff] [blame] | 1022 | #define QPNP_REV_ID_8026_2_2 7 |
| Siddartha Mohanadoss | 8b076be | 2014-03-11 19:03:03 -0700 | [diff] [blame] | 1023 | #define QPNP_REV_ID_8941_3_0 8 |
| 1024 | #define QPNP_REV_ID_8941_2_0 9 |
| 1025 | |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 1026 | |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1027 | /* Public API */ |
| 1028 | #if defined(CONFIG_SENSORS_QPNP_ADC_VOLTAGE) \ |
| 1029 | || defined(CONFIG_SENSORS_QPNP_ADC_VOLTAGE_MODULE) |
| 1030 | /** |
| 1031 | * qpnp_vadc_read() - Performs ADC read on the channel. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1032 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1033 | * @channel: Input channel to perform the ADC read. |
| 1034 | * @result: Structure pointer of type adc_chan_result |
| 1035 | * in which the ADC read results are stored. |
| 1036 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1037 | int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev, |
| 1038 | enum qpnp_vadc_channels channel, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1039 | struct qpnp_vadc_result *result); |
| 1040 | |
| 1041 | /** |
| 1042 | * qpnp_vadc_conv_seq_request() - Performs ADC read on the conversion |
| 1043 | * sequencer channel. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1044 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1045 | * @channel: Input channel to perform the ADC read. |
| 1046 | * @result: Structure pointer of type adc_chan_result |
| 1047 | * in which the ADC read results are stored. |
| 1048 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1049 | int32_t qpnp_vadc_conv_seq_request(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1050 | enum qpnp_vadc_trigger trigger_channel, |
| 1051 | enum qpnp_vadc_channels channel, |
| 1052 | struct qpnp_vadc_result *result); |
| 1053 | |
| 1054 | /** |
| 1055 | * qpnp_vadc_check_result() - Performs check on the ADC raw code. |
| 1056 | * @data: Data used for verifying the range of the ADC code. |
| 1057 | */ |
| 1058 | int32_t qpnp_vadc_check_result(int32_t *data); |
| 1059 | |
| 1060 | /** |
| 1061 | * qpnp_adc_get_devicetree_data() - Abstracts the ADC devicetree data. |
| 1062 | * @spmi: spmi ADC device. |
| 1063 | * @adc_qpnp: spmi device tree node structure |
| 1064 | */ |
| 1065 | int32_t qpnp_adc_get_devicetree_data(struct spmi_device *spmi, |
| 1066 | struct qpnp_adc_drv *adc_qpnp); |
| 1067 | |
| 1068 | /** |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1069 | * qpnp_adc_scale_default() - Scales the pre-calibrated digital output |
| 1070 | * of an ADC to the ADC reference and compensates for the |
| 1071 | * gain and offset. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1072 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1073 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1074 | * @adc_prop: adc properties of the qpnp adc such as bit resolution, |
| 1075 | * reference voltage. |
| 1076 | * @chan_prop: Individual channel properties to compensate the i/p scaling, |
| 1077 | * slope and offset. |
| 1078 | * @chan_rslt: Physical result to be stored. |
| 1079 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1080 | int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *dev, |
| 1081 | int32_t adc_code, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1082 | const struct qpnp_adc_properties *adc_prop, |
| 1083 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1084 | struct qpnp_vadc_result *chan_rslt); |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1085 | /** |
| 1086 | * qpnp_adc_scale_pmic_therm() - Scales the pre-calibrated digital output |
| 1087 | * of an ADC to the ADC reference and compensates for the |
| 1088 | * gain and offset. Performs the AMUX out as 2mV/K and returns |
| 1089 | * the temperature in milli degC. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1090 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1091 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1092 | * @adc_prop: adc properties of the qpnp adc such as bit resolution, |
| 1093 | * reference voltage. |
| 1094 | * @chan_prop: Individual channel properties to compensate the i/p scaling, |
| 1095 | * slope and offset. |
| 1096 | * @chan_rslt: Physical result to be stored. |
| 1097 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1098 | int32_t qpnp_adc_scale_pmic_therm(struct qpnp_vadc_chip *dev, |
| 1099 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1100 | const struct qpnp_adc_properties *adc_prop, |
| 1101 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1102 | struct qpnp_vadc_result *chan_rslt); |
| 1103 | /** |
| 1104 | * qpnp_adc_scale_batt_therm() - Scales the pre-calibrated digital output |
| 1105 | * of an ADC to the ADC reference and compensates for the |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1106 | * gain and offset. Returns the temperature in decidegC. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1107 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1108 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1109 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1110 | * reference voltage. |
| 1111 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1112 | * slope and offset. |
| 1113 | * @chan_rslt: physical result to be stored. |
| 1114 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1115 | int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *dev, |
| 1116 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1117 | const struct qpnp_adc_properties *adc_prop, |
| 1118 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1119 | struct qpnp_vadc_result *chan_rslt); |
| 1120 | /** |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1121 | * qpnp_adc_scale_qrd_batt_therm() - Scales the pre-calibrated digital output |
| 1122 | * of an ADC to the ADC reference and compensates for the |
| 1123 | * gain and offset. Returns the temperature in decidegC. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1124 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1125 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1126 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1127 | * reference voltage. |
| 1128 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1129 | * slope and offset. |
| 1130 | * @chan_rslt: physical result to be stored. |
| 1131 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1132 | int32_t qpnp_adc_scale_qrd_batt_therm(struct qpnp_vadc_chip *dev, |
| 1133 | int32_t adc_code, |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1134 | const struct qpnp_adc_properties *adc_prop, |
| 1135 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1136 | struct qpnp_vadc_result *chan_rslt); |
| 1137 | /** |
| Xu Kai | 81c6052 | 2013-07-27 14:26:04 +0800 | [diff] [blame] | 1138 | * qpnp_adc_scale_qrd_skuaa_batt_therm() - Scales the pre-calibrated digital output |
| 1139 | * of an ADC to the ADC reference and compensates for the |
| 1140 | * gain and offset. Returns the temperature in decidegC. |
| 1141 | * @dev: Structure device for qpnp vadc |
| 1142 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1143 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1144 | * reference voltage. |
| 1145 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1146 | * slope and offset. |
| 1147 | * @chan_rslt: physical result to be stored. |
| 1148 | */ |
| 1149 | int32_t qpnp_adc_scale_qrd_skuaa_batt_therm(struct qpnp_vadc_chip *dev, |
| 1150 | int32_t adc_code, |
| 1151 | const struct qpnp_adc_properties *adc_prop, |
| 1152 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1153 | struct qpnp_vadc_result *chan_rslt); |
| 1154 | /** |
| Wu Fenglin | 2c6ef8f | 2013-12-17 11:33:33 +0800 | [diff] [blame] | 1155 | * qpnp_adc_scale_qrd_skug_batt_therm() - Scales the pre-calibrated digital output |
| 1156 | * of an ADC to the ADC reference and compensates for the |
| 1157 | * gain and offset. Returns the temperature in decidegC. |
| 1158 | * @dev: Structure device for qpnp vadc |
| 1159 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1160 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1161 | * reference voltage. |
| 1162 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1163 | * slope and offset. |
| 1164 | * @chan_rslt: physical result to be stored. |
| 1165 | */ |
| 1166 | int32_t qpnp_adc_scale_qrd_skug_batt_therm(struct qpnp_vadc_chip *dev, |
| 1167 | int32_t adc_code, |
| 1168 | const struct qpnp_adc_properties *adc_prop, |
| 1169 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1170 | struct qpnp_vadc_result *chan_rslt); |
| 1171 | /** |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1172 | * qpnp_adc_scale_batt_id() - Scales the pre-calibrated digital output |
| 1173 | * of an ADC to the ADC reference and compensates for the |
| 1174 | * gain and offset. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1175 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1176 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1177 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1178 | * reference voltage. |
| 1179 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1180 | * slope and offset. |
| 1181 | * @chan_rslt: physical result to be stored. |
| 1182 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1183 | int32_t qpnp_adc_scale_batt_id(struct qpnp_vadc_chip *dev, int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1184 | const struct qpnp_adc_properties *adc_prop, |
| 1185 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1186 | struct qpnp_vadc_result *chan_rslt); |
| 1187 | /** |
| 1188 | * qpnp_adc_scale_tdkntcg_therm() - Scales the pre-calibrated digital output |
| 1189 | * of an ADC to the ADC reference and compensates for the |
| 1190 | * gain and offset. Returns the temperature of the xo therm in mili |
| 1191 | degC. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1192 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1193 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1194 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1195 | * reference voltage. |
| 1196 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1197 | * slope and offset. |
| 1198 | * @chan_rslt: physical result to be stored. |
| 1199 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1200 | int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *dev, int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1201 | const struct qpnp_adc_properties *adc_prop, |
| 1202 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1203 | struct qpnp_vadc_result *chan_rslt); |
| 1204 | /** |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1205 | * qpnp_adc_scale_therm_pu1() - Scales the pre-calibrated digital output |
| 1206 | * of an ADC to the ADC reference and compensates for the |
| 1207 | * gain and offset. Returns the temperature of the therm in degC. |
| 1208 | * It uses a mapping table computed for a 150K pull-up. |
| 1209 | * Pull-up1 is an internal pull-up on the AMUX of 150K. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1210 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1211 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1212 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1213 | * reference voltage. |
| 1214 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1215 | * slope and offset. |
| 1216 | * @chan_rslt: physical result to be stored. |
| 1217 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1218 | int32_t qpnp_adc_scale_therm_pu1(struct qpnp_vadc_chip *dev, int32_t adc_code, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1219 | const struct qpnp_adc_properties *adc_prop, |
| 1220 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1221 | struct qpnp_vadc_result *chan_rslt); |
| 1222 | /** |
| 1223 | * qpnp_adc_scale_therm_pu2() - Scales the pre-calibrated digital output |
| 1224 | * of an ADC to the ADC reference and compensates for the |
| 1225 | * gain and offset. Returns the temperature of the therm in degC. |
| 1226 | * It uses a mapping table computed for a 100K pull-up. |
| 1227 | * Pull-up2 is an internal pull-up on the AMUX of 100K. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1228 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1229 | * @adc_code: pre-calibrated digital ouput of the ADC. |
| 1230 | * @adc_prop: adc properties of the pm8xxx adc such as bit resolution, |
| 1231 | * reference voltage. |
| 1232 | * @chan_prop: individual channel properties to compensate the i/p scaling, |
| 1233 | * slope and offset. |
| 1234 | * @chan_rslt: physical result to be stored. |
| 1235 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1236 | int32_t qpnp_adc_scale_therm_pu2(struct qpnp_vadc_chip *dev, int32_t adc_code, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1237 | const struct qpnp_adc_properties *adc_prop, |
| 1238 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1239 | struct qpnp_vadc_result *chan_rslt); |
| 1240 | /** |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1241 | * qpnp_get_vadc() - Clients need to register with the vadc using the |
| 1242 | * corresponding device instance it wants to read the channels |
| 1243 | * from. Read the bindings document on how to pass the phandle |
| 1244 | * for the corresponding vadc driver to register with. |
| 1245 | * @dev: Clients device structure |
| 1246 | * @name: Corresponding client's DT parser name. Read the DT bindings |
| 1247 | * document on how to register with the vadc |
| 1248 | * @struct qpnp_vadc_chip * - On success returns the vadc device structure |
| 1249 | * pointer that needs to be used during an ADC request. |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1250 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1251 | struct qpnp_vadc_chip *qpnp_get_vadc(struct device *dev, const char *name); |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1252 | /** |
| 1253 | * qpnp_adc_tm_scaler() - Performs reverse calibration. |
| 1254 | * @config: Thermal monitoring configuration. |
| 1255 | * @adc_prop: adc properties of the qpnp adc such as bit resolution and |
| 1256 | * reference voltage. |
| 1257 | * @chan_prop: Individual channel properties to compensate the i/p scaling, |
| 1258 | * slope and offset. |
| 1259 | */ |
| 1260 | static inline int32_t qpnp_adc_tm_scaler(struct qpnp_adc_tm_config *tm_config, |
| 1261 | const struct qpnp_adc_properties *adc_prop, |
| 1262 | const struct qpnp_vadc_chan_properties *chan_prop) |
| 1263 | { return -ENXIO; } |
| 1264 | /** |
| 1265 | * qpnp_get_vadc_gain_and_offset() - Obtains the VADC gain and offset |
| 1266 | * for absolute and ratiometric calibration. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1267 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1268 | * @param: The result in which the ADC offset and gain values are stored. |
| 1269 | * @type: The calibration type whether client needs the absolute or |
| 1270 | * ratiometric gain and offset values. |
| 1271 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1272 | int32_t qpnp_get_vadc_gain_and_offset(struct qpnp_vadc_chip *dev, |
| 1273 | struct qpnp_vadc_linear_graph *param, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1274 | enum qpnp_adc_calib_type calib_type); |
| 1275 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1276 | * qpnp_adc_scale_millidegc_pmic_voltage_thr() - Performs reverse calibration |
| 1277 | * on the low/high temperature threshold values passed by the |
| 1278 | * client. The function coverts milldegC to voltage threshold |
| 1279 | * and accounts for the corresponding channels scaling as (2mV/K). |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1280 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1281 | * @param: The input parameters that contain the low/high temperature |
| 1282 | * values. |
| 1283 | * @low_threshold: The low threshold value that needs to be updated with |
| 1284 | * the above calibrated voltage value. |
| 1285 | * @high_threshold: The low threshold value that needs to be updated with |
| 1286 | * the above calibrated voltage value. |
| 1287 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1288 | int32_t qpnp_adc_scale_millidegc_pmic_voltage_thr(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1289 | struct qpnp_adc_tm_btm_param *param, |
| 1290 | uint32_t *low_threshold, uint32_t *high_threshold); |
| 1291 | /** |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1292 | * qpnp_adc_btm_scaler() - Performs reverse calibration on the low/high |
| 1293 | * temperature threshold values passed by the client. |
| 1294 | * The function maps the temperature to voltage and applies |
| 1295 | * ratiometric calibration on the voltage values. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1296 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1297 | * @param: The input parameters that contain the low/high temperature |
| 1298 | * values. |
| 1299 | * @low_threshold: The low threshold value that needs to be updated with |
| 1300 | * the above calibrated voltage value. |
| 1301 | * @high_threshold: The low threshold value that needs to be updated with |
| 1302 | * the above calibrated voltage value. |
| 1303 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1304 | int32_t qpnp_adc_btm_scaler(struct qpnp_vadc_chip *dev, |
| 1305 | struct qpnp_adc_tm_btm_param *param, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1306 | uint32_t *low_threshold, uint32_t *high_threshold); |
| 1307 | /** |
| 1308 | * qpnp_adc_tm_scale_therm_voltage_pu2() - Performs reverse calibration |
| 1309 | * and convert given temperature to voltage on supported |
| 1310 | * thermistor channels using 100k pull-up. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1311 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1312 | * @param: The input temperature values. |
| 1313 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1314 | int32_t qpnp_adc_tm_scale_therm_voltage_pu2(struct qpnp_vadc_chip *dev, |
| 1315 | struct qpnp_adc_tm_config *param); |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1316 | /** |
| 1317 | * qpnp_adc_tm_scale_therm_voltage_pu2() - Performs reverse calibration |
| 1318 | * and converts the given ADC code to temperature for |
| 1319 | * thermistor channels using 100k pull-up. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1320 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1321 | * @reg: The input ADC code. |
| 1322 | * @result: The physical measurement temperature on the thermistor. |
| 1323 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1324 | int32_t qpnp_adc_tm_scale_voltage_therm_pu2(struct qpnp_vadc_chip *dev, |
| 1325 | uint32_t reg, int64_t *result); |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1326 | /** |
| 1327 | * qpnp_adc_usb_scaler() - Performs reverse calibration on the low/high |
| 1328 | * voltage threshold values passed by the client. |
| 1329 | * The function applies ratiometric calibration on the |
| 1330 | * voltage values. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1331 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1332 | * @param: The input parameters that contain the low/high voltage |
| 1333 | * threshold values. |
| 1334 | * @low_threshold: The low threshold value that needs to be updated with |
| 1335 | * the above calibrated voltage value. |
| 1336 | * @high_threshold: The low threshold value that needs to be updated with |
| 1337 | * the above calibrated voltage value. |
| 1338 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1339 | int32_t qpnp_adc_usb_scaler(struct qpnp_vadc_chip *dev, |
| 1340 | struct qpnp_adc_tm_btm_param *param, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1341 | uint32_t *low_threshold, uint32_t *high_threshold); |
| 1342 | /** |
| 1343 | * qpnp_adc_vbatt_rscaler() - Performs reverse calibration on the low/high |
| 1344 | * voltage threshold values passed by the client. |
| 1345 | * The function applies ratiometric calibration on the |
| 1346 | * voltage values. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1347 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1348 | * @param: The input parameters that contain the low/high voltage |
| 1349 | * threshold values. |
| 1350 | * @low_threshold: The low threshold value that needs to be updated with |
| 1351 | * the above calibrated voltage value. |
| 1352 | * @high_threshold: The low threshold value that needs to be updated with |
| 1353 | * the above calibrated voltage value. |
| 1354 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1355 | int32_t qpnp_adc_vbatt_rscaler(struct qpnp_vadc_chip *dev, |
| 1356 | struct qpnp_adc_tm_btm_param *param, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1357 | uint32_t *low_threshold, uint32_t *high_threshold); |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1358 | /** |
| 1359 | * qpnp_vadc_iadc_sync_request() - Performs Voltage ADC read and |
| 1360 | * locks the peripheral. When performing simultaneous |
| 1361 | * voltage and current request the VADC peripheral is |
| 1362 | * prepared for conversion and the IADC sync conversion |
| 1363 | * is done from the IADC peripheral. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1364 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1365 | * @channel: Input channel to perform the voltage ADC read. |
| 1366 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1367 | int32_t qpnp_vadc_iadc_sync_request(struct qpnp_vadc_chip *dev, |
| 1368 | enum qpnp_vadc_channels channel); |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1369 | /** |
| 1370 | * qpnp_vadc_iadc_sync_complete_request() - Reads the ADC result and |
| 1371 | * unlocks the peripheral. |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1372 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1373 | * @result: Structure pointer of type adc_chan_result |
| 1374 | * in which the ADC read results are stored. |
| 1375 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1376 | int32_t qpnp_vadc_iadc_sync_complete_request(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1377 | enum qpnp_vadc_channels channel, struct qpnp_vadc_result *result); |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 1378 | /** |
| 1379 | * qpnp_vadc_sns_comp_result() - Compensate vbatt readings based on temperature |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1380 | * @dev: Structure device for qpnp vadc |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 1381 | * @result: Voltage in uV that needs compensation. |
| Xiaozhe Shi | 8075422 | 2013-10-30 14:11:41 -0700 | [diff] [blame] | 1382 | * @is_pon_ocv: Whether the reading is from a power on OCV or not |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 1383 | */ |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1384 | int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, |
| Xiaozhe Shi | 8075422 | 2013-10-30 14:11:41 -0700 | [diff] [blame] | 1385 | int64_t *result, bool is_pon_ocv); |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 1386 | /** |
| 1387 | * qpnp_adc_get_revid_version() - Obtain the PMIC number and revision. |
| 1388 | * @dev: Structure device node. |
| 1389 | * returns internal mapped PMIC number and revision id. |
| 1390 | */ |
| 1391 | int qpnp_adc_get_revid_version(struct device *dev); |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1392 | #else |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1393 | static inline int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev, |
| 1394 | uint32_t channel, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1395 | struct qpnp_vadc_result *result) |
| 1396 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1397 | static inline int32_t qpnp_vadc_conv_seq_request(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1398 | enum qpnp_vadc_trigger trigger_channel, |
| 1399 | enum qpnp_vadc_channels channel, |
| 1400 | struct qpnp_vadc_result *result) |
| 1401 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1402 | static inline int32_t qpnp_adc_scale_default(struct qpnp_vadc_chip *vadc, |
| 1403 | int32_t adc_code, |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1404 | const struct qpnp_adc_properties *adc_prop, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1405 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1406 | struct qpnp_vadc_result *chan_rslt) |
| 1407 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1408 | static inline int32_t qpnp_adc_scale_pmic_therm(struct qpnp_vadc_chip *vadc, |
| 1409 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1410 | const struct qpnp_adc_properties *adc_prop, |
| 1411 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1412 | struct qpnp_vadc_result *chan_rslt) |
| 1413 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1414 | static inline int32_t qpnp_adc_scale_batt_therm(struct qpnp_vadc_chip *vadc, |
| 1415 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1416 | const struct qpnp_adc_properties *adc_prop, |
| 1417 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1418 | struct qpnp_vadc_result *chan_rslt) |
| 1419 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1420 | static inline int32_t qpnp_adc_scale_qrd_batt_therm( |
| 1421 | struct qpnp_vadc_chip *vadc, int32_t adc_code, |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1422 | const struct qpnp_adc_properties *adc_prop, |
| 1423 | const struct qpnp_vadc_chan_properties *chan_prop, |
| Xu Kai | 81c6052 | 2013-07-27 14:26:04 +0800 | [diff] [blame] | 1424 | struct qpnp_vadc_result *chan_rslt) |
| 1425 | { return -ENXIO; } |
| 1426 | static inline int32_t qpnp_adc_scale_qrd_skuaa_batt_therm( |
| 1427 | struct qpnp_vadc_chip *vadc, int32_t adc_code, |
| 1428 | const struct qpnp_adc_properties *adc_prop, |
| 1429 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1430 | struct qpnp_vadc_result *chan_rslt) |
| Siddartha Mohanadoss | b99cfa9 | 2013-05-01 20:19:58 -0700 | [diff] [blame] | 1431 | { return -ENXIO; } |
| Wu Fenglin | 2c6ef8f | 2013-12-17 11:33:33 +0800 | [diff] [blame] | 1432 | static inline int32_t qpnp_adc_scale_qrd_skug_batt_therm( |
| 1433 | struct qpnp_vadc_chip *vadc, int32_t adc_code, |
| 1434 | const struct qpnp_adc_properties *adc_prop, |
| 1435 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1436 | struct qpnp_vadc_result *chan_rslt) |
| 1437 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1438 | static inline int32_t qpnp_adc_scale_batt_id(struct qpnp_vadc_chip *vadc, |
| 1439 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1440 | const struct qpnp_adc_properties *adc_prop, |
| 1441 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1442 | struct qpnp_vadc_result *chan_rslt) |
| 1443 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1444 | static inline int32_t qpnp_adc_tdkntcg_therm(struct qpnp_vadc_chip *vadc, |
| 1445 | int32_t adc_code, |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1446 | const struct qpnp_adc_properties *adc_prop, |
| 1447 | const struct qpnp_vadc_chan_properties *chan_prop, |
| 1448 | struct qpnp_vadc_result *chan_rslt) |
| 1449 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1450 | static inline int32_t qpnp_adc_scale_therm_pu1(struct qpnp_vadc_chip *vadc, |
| 1451 | int32_t adc_code, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1452 | const struct qpnp_adc_properties *adc_prop, |
| 1453 | const struct qpnp_vadc_chan_properties *chan_prop, |
| David Keitel | c96dc85 | 2013-03-04 14:57:34 -0800 | [diff] [blame] | 1454 | struct qpnp_vadc_result *chan_rslt) |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1455 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1456 | static inline int32_t qpnp_adc_scale_therm_pu2(struct qpnp_vadc_chip *vadc, |
| 1457 | int32_t adc_code, |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1458 | const struct qpnp_adc_properties *adc_prop, |
| 1459 | const struct qpnp_vadc_chan_properties *chan_prop, |
| David Keitel | c96dc85 | 2013-03-04 14:57:34 -0800 | [diff] [blame] | 1460 | struct qpnp_vadc_result *chan_rslt) |
| Siddartha Mohanadoss | e77edf1 | 2012-09-13 14:26:32 -0700 | [diff] [blame] | 1461 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1462 | static inline struct qpnp_vadc_chip *qpnp_get_vadc(struct device *dev, |
| 1463 | const char *name) |
| 1464 | { return ERR_PTR(-ENXIO); } |
| 1465 | static inline int32_t qpnp_get_vadc_gain_and_offset(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1466 | struct qpnp_vadc_linear_graph *param, |
| 1467 | enum qpnp_adc_calib_type calib_type) |
| 1468 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1469 | static inline int32_t qpnp_adc_usb_scaler(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1470 | struct qpnp_adc_tm_btm_param *param, |
| 1471 | uint32_t *low_threshold, uint32_t *high_threshold) |
| 1472 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1473 | static inline int32_t qpnp_adc_vbatt_rscaler(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1474 | struct qpnp_adc_tm_btm_param *param, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1475 | uint32_t *low_threshold, uint32_t *high_threshold) |
| 1476 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1477 | static inline int32_t qpnp_adc_btm_scaler(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1478 | struct qpnp_adc_tm_btm_param *param, |
| 1479 | uint32_t *low_threshold, uint32_t *high_threshold) |
| 1480 | { return -ENXIO; } |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1481 | static inline int32_t qpnp_adc_scale_millidegc_pmic_voltage_thr( |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1482 | struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1483 | struct qpnp_adc_tm_btm_param *param, |
| 1484 | uint32_t *low_threshold, uint32_t *high_threshold) |
| 1485 | { return -ENXIO; } |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1486 | static inline int32_t qpnp_adc_tm_scale_therm_voltage_pu2( |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1487 | struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1488 | struct qpnp_adc_tm_config *param) |
| 1489 | { return -ENXIO; } |
| 1490 | static inline int32_t qpnp_adc_tm_scale_voltage_therm_pu2( |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1491 | struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | d0f4fd1 | 2012-11-20 16:28:40 -0800 | [diff] [blame] | 1492 | uint32_t reg, int64_t *result) |
| 1493 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1494 | static inline int32_t qpnp_vadc_iadc_sync_request(struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1495 | enum qpnp_vadc_channels channel) |
| 1496 | { return -ENXIO; } |
| 1497 | static inline int32_t qpnp_vadc_iadc_sync_complete_request( |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1498 | struct qpnp_vadc_chip *dev, |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1499 | enum qpnp_vadc_channels channel, |
| 1500 | struct qpnp_vadc_result *result) |
| 1501 | { return -ENXIO; } |
| Siddartha Mohanadoss | 3cb2b6b | 2013-06-21 12:07:05 -0700 | [diff] [blame] | 1502 | static inline int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev, |
| 1503 | int64_t *result) |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 1504 | { return -ENXIO; } |
| Siddartha Mohanadoss | 9376184 | 2013-09-11 17:46:54 -0700 | [diff] [blame] | 1505 | static inline int qpnp_adc_get_revid_version(struct device *dev) |
| 1506 | { return -ENXIO; } |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1507 | #endif |
| 1508 | |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1509 | /* Public API */ |
| 1510 | #if defined(CONFIG_SENSORS_QPNP_ADC_CURRENT) \ |
| 1511 | || defined(CONFIG_SENSORS_QPNP_ADC_CURRENT_MODULE) |
| 1512 | /** |
| 1513 | * qpnp_iadc_read() - Performs ADC read on the current channel. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1514 | * @dev: Structure device for qpnp iadc |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1515 | * @channel: Input channel to perform the ADC read. |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1516 | * @result: Current across rsense in mA. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1517 | * @return: 0 on success. |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1518 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1519 | int32_t qpnp_iadc_read(struct qpnp_iadc_chip *dev, |
| 1520 | enum qpnp_iadc_channels channel, |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 1521 | struct qpnp_iadc_result *result); |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1522 | /** |
| Xiaozhe Shi | 767fdb6 | 2013-01-10 15:09:08 -0800 | [diff] [blame] | 1523 | * qpnp_iadc_get_rsense() - Reads the RDS resistance value from the |
| 1524 | trim registers. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1525 | * @dev: Structure device for qpnp iadc |
| Xiaozhe Shi | 767fdb6 | 2013-01-10 15:09:08 -0800 | [diff] [blame] | 1526 | * @rsense: RDS resistance in nOhms. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1527 | * @return: 0 on success. |
| Xiaozhe Shi | 767fdb6 | 2013-01-10 15:09:08 -0800 | [diff] [blame] | 1528 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1529 | int32_t qpnp_iadc_get_rsense(struct qpnp_iadc_chip *dev, int32_t *rsense); |
| Xiaozhe Shi | 767fdb6 | 2013-01-10 15:09:08 -0800 | [diff] [blame] | 1530 | /** |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 1531 | * qpnp_iadc_get_gain_and_offset() - Performs gain calibration |
| 1532 | * over 17.8571mV and offset over selected |
| 1533 | * channel. Channel can be internal rsense, |
| 1534 | * external rsense and alternate lead pair. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1535 | * @dev: Structure device for qpnp iadc |
| Siddartha Mohanadoss | 5e2988d | 2012-09-24 17:03:56 -0700 | [diff] [blame] | 1536 | * @result: result structure where the gain and offset is stored of |
| 1537 | * type qpnp_iadc_calib. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1538 | * @return: 0 on success. |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1539 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1540 | int32_t qpnp_iadc_get_gain_and_offset(struct qpnp_iadc_chip *dev, |
| 1541 | struct qpnp_iadc_calib *result); |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1542 | /** |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1543 | * qpnp_get_iadc() - Clients need to register with the iadc with the |
| 1544 | * corresponding device instance it wants to read the channels. |
| 1545 | * Read the bindings document on how to pass the phandle for |
| 1546 | * the corresponding vadc driver to register with. |
| 1547 | * @dev: Clients device structure |
| 1548 | * @name: Corresponding client's DT parser name. Read the DT bindings |
| 1549 | * document on how to register with the iadc |
| 1550 | * @struct qpnp_iadc_chip * - On success returns the iadc device structure |
| 1551 | * pointer used everytime client makes an ADC request. |
| Siddartha Mohanadoss | 5ace110 | 2012-08-20 23:18:10 -0700 | [diff] [blame] | 1552 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1553 | struct qpnp_iadc_chip *qpnp_get_iadc(struct device *dev, const char *name); |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1554 | /** |
| 1555 | * qpnp_iadc_vadc_sync_read() - Performs synchronous VADC and IADC read. |
| 1556 | * The api is to be used only by the BMS to perform |
| 1557 | * simultaneous VADC and IADC measurement for battery voltage |
| 1558 | * and current. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1559 | * @dev: Structure device for qpnp iadc |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1560 | * @i_channel: Input battery current channel to perform the IADC read. |
| 1561 | * @i_result: Current across the rsense in mA. |
| 1562 | * @v_channel: Input battery voltage channel to perform VADC read. |
| 1563 | * @v_result: Voltage on the vbatt channel with units in mV. |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1564 | * @return: 0 on success. |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1565 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1566 | int32_t qpnp_iadc_vadc_sync_read(struct qpnp_iadc_chip *dev, |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1567 | enum qpnp_iadc_channels i_channel, struct qpnp_iadc_result *i_result, |
| 1568 | enum qpnp_vadc_channels v_channel, struct qpnp_vadc_result *v_result); |
| Siddartha Mohanadoss | 0667392 | 2013-03-27 11:14:19 -0700 | [diff] [blame] | 1569 | /** |
| Abhijeet Dharmapurikar | 0ef9b5c | 2013-07-15 18:24:38 -0700 | [diff] [blame] | 1570 | * qpnp_iadc_calibrate_for_trim - Clients can use this API to re-calibrate |
| 1571 | * IADC. The offset and gain values are programmed in the trim |
| 1572 | * registers. The offset and the gain can be retrieved using |
| 1573 | * qpnp_iadc_get_gain_and_offset |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1574 | * @dev: Structure device for qpnp iadc |
| Abhijeet Dharmapurikar | 0ef9b5c | 2013-07-15 18:24:38 -0700 | [diff] [blame] | 1575 | * @batfet_closed: batfet is opened or closed. The IADC chooses proper |
| 1576 | * channel (internal/external) based on batfet status |
| 1577 | * for calibration. |
| 1578 | * RETURNS: 0 on success. |
| Siddartha Mohanadoss | 0667392 | 2013-03-27 11:14:19 -0700 | [diff] [blame] | 1579 | */ |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1580 | int32_t qpnp_iadc_calibrate_for_trim(struct qpnp_iadc_chip *dev, |
| 1581 | bool batfet_closed); |
| 1582 | /** |
| 1583 | * qpnp_iadc_comp_result() - Compensates the result of the current based on |
| 1584 | * the gain and offset co-effients and rsense parameters. |
| 1585 | * @dev: Structure device for qpnp iadc |
| 1586 | * @result: Current value to perform the compensation. |
| 1587 | * @return: 0 on success. |
| 1588 | */ |
| 1589 | int32_t qpnp_iadc_comp_result(struct qpnp_iadc_chip *dev, int64_t *result); |
| 1590 | /** |
| 1591 | * qpnp_iadc_skip_calibration() - Clients can use this API to ask the driver |
| 1592 | * to skip iadc calibrations |
| 1593 | * @dev: Structure device for qpnp iadc |
| 1594 | * @result: 0 on success and -EPROBE_DEFER when probe for the device |
| 1595 | * has not occured. |
| 1596 | */ |
| 1597 | int qpnp_iadc_skip_calibration(struct qpnp_iadc_chip *dev); |
| 1598 | /** |
| 1599 | * qpnp_iadc_resume_calibration() - Clients can use this API to ask the driver |
| 1600 | * to resume iadc calibrations |
| 1601 | * @dev: Structure device for qpnp iadc |
| 1602 | * @result: 0 on success and -EPROBE_DEFER when probe for the device |
| 1603 | * has not occured. |
| 1604 | */ |
| 1605 | int qpnp_iadc_resume_calibration(struct qpnp_iadc_chip *dev); |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1606 | #else |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1607 | static inline int32_t qpnp_iadc_read(struct qpnp_iadc_chip *iadc, |
| 1608 | enum qpnp_iadc_channels channel, struct qpnp_iadc_result *result) |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1609 | { return -ENXIO; } |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1610 | static inline int32_t qpnp_iadc_get_rsense(struct qpnp_iadc_chip *iadc, |
| 1611 | int32_t *rsense) |
| Siddartha Mohanadoss | 563166b | 2013-02-20 12:47:24 -0800 | [diff] [blame] | 1612 | { return -ENXIO; } |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1613 | static inline int32_t qpnp_iadc_get_gain_and_offset(struct qpnp_iadc_chip *iadc, |
| 1614 | struct qpnp_iadc_calib *result) |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1615 | { return -ENXIO; } |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1616 | static inline struct qpnp_iadc_chip *qpnp_get_iadc(struct device *dev, |
| 1617 | const char *name) |
| 1618 | { return ERR_PTR(-ENXIO); } |
| 1619 | static inline int32_t qpnp_iadc_vadc_sync_read(struct qpnp_iadc_chip *iadc, |
| Siddartha Mohanadoss | a32ea2a | 2013-02-12 09:58:31 -0800 | [diff] [blame] | 1620 | enum qpnp_iadc_channels i_channel, struct qpnp_iadc_result *i_result, |
| 1621 | enum qpnp_vadc_channels v_channel, struct qpnp_vadc_result *v_result) |
| 1622 | { return -ENXIO; } |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1623 | static inline int32_t qpnp_iadc_calibrate_for_trim(struct qpnp_iadc_chip *iadc, |
| 1624 | bool batfet_closed) |
| Siddartha Mohanadoss | 0667392 | 2013-03-27 11:14:19 -0700 | [diff] [blame] | 1625 | { return -ENXIO; } |
| Siddartha Mohanadoss | 55d0bca | 2013-06-24 08:29:34 -0700 | [diff] [blame] | 1626 | static inline int32_t qpnp_iadc_comp_result(struct qpnp_iadc_chip *iadc, |
| 1627 | int64_t *result, int32_t sign) |
| Siddartha Mohanadoss | 4e64f8c | 2013-04-08 15:57:32 -0700 | [diff] [blame] | 1628 | { return -ENXIO; } |
| Siddartha Mohanadoss | c4a6af1 | 2012-07-13 18:50:12 -0700 | [diff] [blame] | 1629 | #endif |
| 1630 | |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1631 | /* Public API */ |
| 1632 | #if defined(CONFIG_THERMAL_QPNP_ADC_TM) \ |
| 1633 | || defined(CONFIG_THERMAL_QPNP_ADC_TM_MODULE) |
| 1634 | /** |
| 1635 | * qpnp_adc_tm_usbid_configure() - Configures Channel 0 of VADC_BTM to |
| 1636 | * monitor USB_ID channel using 100k internal pull-up. |
| 1637 | * USB driver passes the high/low voltage threshold along |
| 1638 | * with the notification callback once the set thresholds |
| 1639 | * are crossed. |
| 1640 | * @param: Structure pointer of qpnp_adc_tm_usbid_param type. |
| 1641 | * Clients pass the low/high voltage along with the threshold |
| 1642 | * notification callback. |
| 1643 | */ |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1644 | int32_t qpnp_adc_tm_usbid_configure(struct qpnp_adc_tm_chip *chip, |
| 1645 | struct qpnp_adc_tm_btm_param *param); |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1646 | /** |
| 1647 | * qpnp_adc_tm_usbid_end() - Disables the monitoring of channel 0 thats |
| 1648 | * assigned for monitoring USB_ID. Disables the low/high |
| 1649 | * threshold activation for channel 0 as well. |
| 1650 | * @param: none. |
| 1651 | */ |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1652 | int32_t qpnp_adc_tm_usbid_end(struct qpnp_adc_tm_chip *chip); |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1653 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1654 | * qpnp_adc_tm_channel_measure() - Configures kernel clients a channel to |
| 1655 | * monitor the corresponding ADC channel for threshold detection. |
| 1656 | * Driver passes the high/low voltage threshold along |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1657 | * with the notification callback once the set thresholds |
| 1658 | * are crossed. |
| 1659 | * @param: Structure pointer of qpnp_adc_tm_btm_param type. |
| 1660 | * Clients pass the low/high temperature along with the threshold |
| 1661 | * notification callback. |
| 1662 | */ |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1663 | int32_t qpnp_adc_tm_channel_measure(struct qpnp_adc_tm_chip *chip, |
| 1664 | struct qpnp_adc_tm_btm_param *param); |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1665 | /** |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1666 | * qpnp_adc_tm_disable_chan_meas() - Disables the monitoring of channel thats |
| 1667 | * assigned for monitoring kernel clients. Disables the low/high |
| 1668 | * threshold activation for the corresponding channel. |
| 1669 | * @param: Structure pointer of qpnp_adc_tm_btm_param type. |
| 1670 | * This is used to identify the channel for which the corresponding |
| 1671 | * channels high/low threshold notification will be disabled. |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1672 | */ |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1673 | int32_t qpnp_adc_tm_disable_chan_meas(struct qpnp_adc_tm_chip *chip, |
| 1674 | struct qpnp_adc_tm_btm_param *param); |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1675 | /** |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1676 | * qpnp_get_adc_tm() - Clients need to register with the adc_tm using the |
| 1677 | * corresponding device instance it wants to read the channels |
| 1678 | * from. Read the bindings document on how to pass the phandle |
| 1679 | * for the corresponding adc_tm driver to register with. |
| 1680 | * @name: Corresponding client's DT parser name. Read the DT bindings |
| 1681 | * document on how to register with the vadc |
| 1682 | * @struct qpnp_adc_tm_chip * - On success returns the vadc device structure |
| 1683 | * pointer that needs to be used during an ADC TM request. |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1684 | */ |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1685 | struct qpnp_adc_tm_chip *qpnp_get_adc_tm(struct device *dev, const char *name); |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1686 | #else |
| 1687 | static inline int32_t qpnp_adc_tm_usbid_configure( |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1688 | struct qpnp_adc_tm_chip *chip, |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1689 | struct qpnp_adc_tm_btm_param *param) |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1690 | { return -ENXIO; } |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1691 | static inline int32_t qpnp_adc_tm_usbid_end(struct qpnp_adc_tm_chip *chip) |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1692 | { return -ENXIO; } |
| Siddartha Mohanadoss | a3e3551 | 2013-02-22 17:06:07 -0800 | [diff] [blame] | 1693 | static inline int32_t qpnp_adc_tm_channel_measure( |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1694 | struct qpnp_adc_tm_chip *chip, |
| 1695 | struct qpnp_adc_tm_btm_param *param) |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1696 | { return -ENXIO; } |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1697 | static inline int32_t qpnp_adc_tm_disable_chan_meas( |
| 1698 | struct qpnp_adc_tm_chip *chip) |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1699 | { return -ENXIO; } |
| Siddartha Mohanadoss | 88a3fde | 2013-06-24 16:18:52 -0700 | [diff] [blame] | 1700 | static inline struct qpnp_adc_tm_chip *qpnp_get_adc_tm(struct device *dev, |
| 1701 | const char *name) |
| 1702 | { return ERR_PTR(-ENXIO); } |
| Siddartha Mohanadoss | 31f6096 | 2012-11-27 14:11:02 -0800 | [diff] [blame] | 1703 | #endif |
| 1704 | |
| Siddartha Mohanadoss | 7b116e1 | 2012-06-05 23:27:46 -0700 | [diff] [blame] | 1705 | #endif |