blob: 46ac15550b77abf1acf91ba979a777047b0afa94 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
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 8921 ADC driver header file
15 *
16 */
17
18#ifndef __MFD_PM8921_ADC_H
19#define __MFD_PM8921_ADC_H
20
21#include <linux/kernel.h>
22#include <linux/list.h>
23
24/**
25 * enum pm8921_adc_channels - PM8921 AMUX arbiter channels
26 * %CHANNEL_VCOIN: Backup voltage for certain register set
27 * %CHANNEL_VBAT: Battery voltage
28 * %CHANNEL_DCIN: Charger input voltage without internal OVP
29 * %CHANNEL_ICHG: Charge-current monitor
30 * %CHANNEL_VPH_PWR: Main system power
31 * %CHANNEL_IBAT: Battery charge current
32 * %CHANNEL_MPP_1: 16:1 pre-mux unity scale MPP input
33 * %CHANNEL_MPP_2: 16:1 pre-mux 1/3 scale MPP input
34 * %CHANNEL_BATT_THERM: Battery temperature
35 * %CHANNEL_BATT_ID: Battery detection
36 * %CHANNEL_USBIN: Charger input voltage with internal OVP
37 * %CHANNEL_DIE_TEMP: Pmic_die temperature
38 * %CHANNEL_625MV: 625mv reference channel
39 * %CHANNEL_125V: 1.25v reference channel
40 * %CHANNEL_CHG_TEMP: Charger temperature
41 * %CHANNEL_MUXOFF: Channel to reduce input load on the mux
42 * %CHANNEL_NONE: Do not use this channel
43 */
44enum pm8921_adc_channels {
45 CHANNEL_VCOIN = 0,
46 CHANNEL_VBAT,
47 CHANNEL_DCIN,
48 CHANNEL_ICHG,
49 CHANNEL_VPH_PWR,
50 CHANNEL_IBAT,
51 CHANNEL_MPP_1,
52 CHANNEL_MPP_2,
53 CHANNEL_BATT_THERM,
54 CHANNEL_BATT_ID,
55 CHANNEL_USBIN,
56 CHANNEL_DIE_TEMP,
57 CHANNEL_625MV,
58 CHANNEL_125V,
59 CHANNEL_CHG_TEMP,
60 CHANNEL_MUXOFF,
61 CHANNEL_NONE,
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -070062 ADC_MPP_1_ATEST_8 = 20,
63 ADC_MPP_1_USB_SNS_DIV20,
64 ADC_MPP_1_DCIN_SNS_DIV20,
65 ADC_MPP_1_AMUX3,
66 ADC_MPP_1_AMUX4,
67 ADC_MPP_1_AMUX5,
68 ADC_MPP_1_AMUX6,
69 ADC_MPP_1_AMUX7,
70 ADC_MPP_1_AMUX8,
71 ADC_MPP_1_ATEST_1,
72 ADC_MPP_1_ATEST_2,
73 ADC_MPP_1_ATEST_3,
74 ADC_MPP_1_ATEST_4,
75 ADC_MPP_1_ATEST_5,
76 ADC_MPP_1_ATEST_6,
77 ADC_MPP_1_ATEST_7,
78 ADC_MPP_1_CHANNEL_NONE,
79 ADC_MPP_2_ATEST_8 = 40,
80 ADC_MPP_2_USB_SNS_DIV20,
81 ADC_MPP_2_DCIN_SNS_DIV20,
82 ADC_MPP_2_AMUX3,
83 ADC_MPP_2_AMUX4,
84 ADC_MPP_2_AMUX5,
85 ADC_MPP_2_AMUX6,
86 ADC_MPP_2_AMUX7,
87 ADC_MPP_2_AMUX8,
88 ADC_MPP_2_ATEST_1,
89 ADC_MPP_2_ATEST_2,
90 ADC_MPP_2_ATEST_3,
91 ADC_MPP_2_ATEST_4,
92 ADC_MPP_2_ATEST_5,
93 ADC_MPP_2_ATEST_6,
94 ADC_MPP_2_ATEST_7,
95 ADC_MPP_2_CHANNEL_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096};
97
98#define PM8921_ADC_PMIC_0 0x0
99
100#define PM8921_CHANNEL_ADC_625_MV 625
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700101#define PM8921_CHANNEL_MPP_SCALE1_IDX 20
102#define PM8921_CHANNEL_MPP_SCALE3_IDX 40
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103
104#define PM8921_AMUX_MPP_3 0x3
105#define PM8921_AMUX_MPP_4 0x4
106#define PM8921_AMUX_MPP_5 0x5
107#define PM8921_AMUX_MPP_6 0x6
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700108#define PM8921_AMUX_MPP_7 0x7
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109#define PM8921_AMUX_MPP_8 0x8
110
111#define PM8921_ADC_DEV_NAME "pm8921-adc"
112
113/**
114 * enum pm8921_adc_decimation_type - Sampling rate supported
115 * %ADC_DECIMATION_TYPE1: 512
116 * %ADC_DECIMATION_TYPE2: 1K
117 * %ADC_DECIMATION_TYPE3: 2K
118 * %ADC_DECIMATION_TYPE4: 4k
119 * %ADC_DECIMATION_NONE: Do not use this Sampling type
120 *
121 * The Sampling rate is specific to each channel of the PM8921 ADC arbiter.
122 */
123enum pm8921_adc_decimation_type {
124 ADC_DECIMATION_TYPE1 = 0,
125 ADC_DECIMATION_TYPE2,
126 ADC_DECIMATION_TYPE3,
127 ADC_DECIMATION_TYPE4,
128 ADC_DECIMATION_NONE,
129};
130
131/**
132 * enum pm8921_adc_calib_type - PM8921 ADC Calibration type
133 * %ADC_CALIB_ABSOLUTE: Use 625mV and 1.25V reference channels
134 * %ADC_CALIB_RATIOMETRIC: Use reference Voltage/GND
135 * %ADC_CALIB_CONFIG_NONE: Do not use this calibration type
136 *
137 * Use the input reference voltage depending on the calibration type
138 * to calcluate the offset and gain parameters. The calibration is
139 * specific to each channel of the PM8921 ADC.
140 */
141enum pm8921_adc_calib_type {
142 ADC_CALIB_ABSOLUTE = 0,
143 ADC_CALIB_RATIOMETRIC,
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700144 ADC_CALIB_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700145};
146
147/**
148 * enum pm8921_adc_channel_scaling_param - pre-scaling AMUX ratio
149 * %CHAN_PATH_SCALING1: ratio of {1, 1}
150 * %CHAN_PATH_SCALING2: ratio of {1, 3}
151 * %CHAN_PATH_SCALING3: ratio of {1, 4}
152 * %CHAN_PATH_SCALING4: ratio of {1, 6}
153 * %CHAN_PATH_NONE: Do not use this pre-scaling ratio type
154 *
155 * The pre-scaling is applied for signals to be within the voltage range
156 * of the ADC.
157 */
158enum pm8921_adc_channel_scaling_param {
159 CHAN_PATH_SCALING1 = 0,
160 CHAN_PATH_SCALING2,
161 CHAN_PATH_SCALING3,
162 CHAN_PATH_SCALING4,
163 CHAN_PATH_SCALING_NONE,
164};
165
166/**
167 * enum pm8921_adc_amux_input_rsv - HK/XOADC reference voltage
168 * %AMUX_RSV0: XO_IN/XOADC_GND
169 * %AMUX_RSV1: PMIC_IN/XOADC_GND
170 * %AMUX_RSV2: PMIC_IN/BMS_CSP
171 * %AMUX_RSV3: not used
172 * %AMUX_RSV4: XOADC_GND/XOADC_GND
173 * %AMUX_RSV5: XOADC_VREF/XOADC_GND
174 * %AMUX_NONE: Do not use this input reference voltage selection
175 */
176enum pm8921_adc_amux_input_rsv {
177 AMUX_RSV0 = 0,
178 AMUX_RSV1,
179 AMUX_RSV2,
180 AMUX_RSV3,
181 AMUX_RSV4,
182 AMUX_RSV5,
183 AMUX_NONE,
184};
185
186/**
187 * enum pm8921_adc_premux_mpp_scale_type - 16:1 pre-mux scale ratio
188 * %PREMUX_MPP_SCALE_0: No scaling to the input signal
189 * %PREMUX_MPP_SCALE_1: Unity scaling selected by the user for MPP input
190 * %PREMUX_MPP_SCALE_1_DIV3: 1/3 pre-scale to the input MPP signal
191 * %PREMUX_MPP_NONE: Do not use this pre-scale mpp type
192 */
193enum pm8921_adc_premux_mpp_scale_type {
194 PREMUX_MPP_SCALE_0 = 0,
195 PREMUX_MPP_SCALE_1,
196 PREMUX_MPP_SCALE_1_DIV3,
197 PREMUX_MPP_NONE,
198};
199
200/**
201 * enum pm8921_adc_scale_fn_type - Scaling function for pm8921 pre calibrated
202 * digital data relative to ADC reference
203 * %ADC_SCALE_DEFAULT: Default scaling to convert raw adc code to voltage
204 * %ADC_SCALE_BATT_THERM: Conversion to temperature based on btm parameters
205 * %ADC_SCALE_PMIC_THERM: Returns result in milli degree's Centigrade
206 * %ADC_SCALE_XTERN_CHGR_CUR: Returns current across 0.1 ohm resistor
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700207 * %ADC_SCALE_XOTHERM: Returns XO thermistor voltage in degree's Centigrade
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208 * %ADC_SCALE_NONE: Do not use this scaling type
209 */
210enum pm8921_adc_scale_fn_type {
211 ADC_SCALE_DEFAULT = 0,
212 ADC_SCALE_BATT_THERM,
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700213 ADC_SCALE_PA_THERM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700214 ADC_SCALE_PMIC_THERM,
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700215 ADC_SCALE_XOTHERM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216 ADC_SCALE_NONE,
217};
218
219/**
220 * struct pm8921_adc_linear_graph - Represent ADC characteristics
221 * @offset: Offset with respect to the actual curve
222 * @dy: Numerator slope to calculate the gain
223 * @dx: Denominator slope to calculate the gain
224 *
225 * Each ADC device has different offset and gain parameters which are computed
226 * to calibrate the device.
227 */
228struct pm8921_adc_linear_graph {
229 int32_t offset;
230 int32_t dy;
231 int32_t dx;
232};
233
234/**
235 * struct pm8921_adc_map_pt - Map the graph representation for ADC channel
236 * @x: Represent the ADC digitized code
237 * @y: Represent the physical data which can be temperature, voltage,
238 * resistance
239 */
240struct pm8921_adc_map_pt {
241 int32_t x;
242 int32_t y;
243};
244
245/**
246 * struct pm8921_adc_scaling_ratio - Represent scaling ratio for adc input
247 * @num: Numerator scaling parameter
248 * @den: Denominator scaling parameter
249 */
250struct pm8921_adc_scaling_ratio {
251 int32_t num;
252 int32_t den;
253};
254
255/**
256 * struct pm8921_adc_properties - Represent the ADC properties
257 * @adc_reference: Reference voltage for PM8921 ADC
258 * @bitresolution: ADC bit resolution for PM8921 ADC
259 * @biploar: Polarity for PM8921 ADC
260 */
261struct pm8921_adc_properties {
262 uint32_t adc_vdd_reference;
263 uint32_t bitresolution;
264 bool bipolar;
265};
266
267/**
268 * struct pm8921_adc_chan_properties - Represent channel properties of the ADC
269 * @offset_gain_numerator: The inverse numerator of the gain applied to the
270 * input channel
271 * @offset_gain_denominator: The inverse denominator of the gain applied to the
272 * input channel
273 * @adc_graph: ADC graph for the channel of struct type pm8921_adc_linear_graph
274 */
275struct pm8921_adc_chan_properties {
276 uint32_t offset_gain_numerator;
277 uint32_t offset_gain_denominator;
278 struct pm8921_adc_linear_graph adc_graph[2];
279};
280
281/**
282 * struct pm8921_adc_chan_result - Represent the result of the PM8921 ADC
283 * @chan: The channel number of the requested conversion
284 * @adc_code: The pre-calibrated digital output of a given ADC relative to the
285 * the ADC reference
286 * @measurement: In units specific for a given ADC; most ADC uses reference
287 * voltage but some ADC uses reference current. This measurement
288 * here is a number relative to a reference of a given ADC
289 * @physical: The data meaningful for each individual channel whether it is
290 * voltage, current, temperature, etc.
291 */
292struct pm8921_adc_chan_result {
293 uint32_t chan;
294 int32_t adc_code;
295 int64_t measurement;
296 int64_t physical;
297};
298
299#if defined(CONFIG_MFD_PM8921_ADC) || defined(CONFIG_MFD_PM8921_ADC_MODULE)
300/**
301 * pm8921_adc_scale_default() - Scales the pre-calibrated digital output
302 * of an ADC to the ADC reference and compensates for the
303 * gain and offset.
304 * @adc_code: pre-calibrated digital ouput of the ADC.
305 * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
306 * reference voltage.
307 * @chan_prop: individual channel properties to compensate the i/p scaling,
308 * slope and offset.
309 * @chan_rslt: Physical result to be stored.
310 */
311int32_t pm8921_adc_scale_default(int32_t adc_code,
312 const struct pm8921_adc_properties *adc_prop,
313 const struct pm8921_adc_chan_properties *chan_prop,
314 struct pm8921_adc_chan_result *chan_rslt);
315/**
316 * pm8921_adc_scale_tdkntcg_therm() - Scales the pre-calibrated digital output
317 * of an ADC to the ADC reference and compensates for the
318 * gain and offset. Returns the temperature of the xo therm in mili
319 degC.
320 * @adc_code: pre-calibrated digital ouput of the ADC.
321 * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
322 * reference voltage.
323 * @chan_prop: individual channel properties to compensate the i/p scaling,
324 * slope and offset.
325 * @chan_rslt: physical result to be stored.
326 */
327int32_t pm8921_adc_tdkntcg_therm(int32_t adc_code,
328 const struct pm8921_adc_properties *adc_prop,
329 const struct pm8921_adc_chan_properties *chan_prop,
330 struct pm8921_adc_chan_result *chan_rslt);
331/**
332 * pm8921_adc_scale_batt_therm() - Scales the pre-calibrated digital output
333 * of an ADC to the ADC reference and compensates for the
334 * gain and offset. Returns the temperature in degC.
335 * @adc_code: pre-calibrated digital ouput of the ADC.
336 * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
337 * reference voltage.
338 * @chan_prop: individual channel properties to compensate the i/p scaling,
339 * slope and offset.
340 * @chan_rslt: physical result to be stored.
341 */
342int32_t pm8921_adc_scale_batt_therm(int32_t adc_code,
343 const struct pm8921_adc_properties *adc_prop,
344 const struct pm8921_adc_chan_properties *chan_prop,
345 struct pm8921_adc_chan_result *chan_rslt);
346/**
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700347 * pm8921_adc_scale_pa_therm() - Scales the pre-calibrated digital output
348 * of an ADC to the ADC reference and compensates for the
349 * gain and offset. Returns the temperature in degC.
350 * @adc_code: pre-calibrated digital ouput of the ADC.
351 * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
352 * reference voltage.
353 * @chan_prop: individual channel properties to compensate the i/p scaling,
354 * slope and offset.
355 * @chan_rslt: physical result to be stored.
356 */
357int32_t pm8921_adc_scale_pa_therm(int32_t adc_code,
358 const struct pm8921_adc_properties *adc_prop,
359 const struct pm8921_adc_chan_properties *chan_prop,
360 struct pm8921_adc_chan_result *chan_rslt);
361/**
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700362 * pm8921_adc_scale_pmic_therm() - Scales the pre-calibrated digital output
363 * of an ADC to the ADC reference and compensates for the
364 * gain and offset. Performs the AMUX out as 2mv/K and returns
365 * the temperature in mili degC.
366 * @adc_code: pre-calibrated digital ouput of the ADC.
367 * @adc_prop: adc properties of the pm8921 adc such as bit resolution,
368 * reference voltage.
369 * @chan_prop: individual channel properties to compensate the i/p scaling,
370 * slope and offset.
371 * @chan_rslt: physical result to be stored.
372 */
373int32_t pm8921_adc_scale_pmic_therm(int32_t adc_code,
374 const struct pm8921_adc_properties *adc_prop,
375 const struct pm8921_adc_chan_properties *chan_prop,
376 struct pm8921_adc_chan_result *chan_rslt);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700377#else
378static inline int32_t pm8921_adc_scale_default(int32_t adc_code,
379 const struct pm8921_adc_properties *adc_prop,
380 const struct pm8921_adc_chan_properties *chan_prop,
381 struct pm8921_adc_chan_result *chan_rslt)
382{ return -ENXIO; }
383static inline int32_t pm8921_adc_tdkntcg_therm(int32_t adc_code,
384 const struct pm8921_adc_properties *adc_prop,
385 const struct pm8921_adc_chan_properties *chan_prop,
386 struct pm8921_adc_chan_result *chan_rslt)
387{ return -ENXIO; }
388static inline int32_t pm8921_adc_scale_batt_therm(int32_t adc_code,
389 const struct pm8921_adc_properties *adc_prop,
390 const struct pm8921_adc_chan_properties *chan_prop,
391 struct pm8921_adc_chan_result *chan_rslt)
392{ return -ENXIO; }
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700393static inline int32_t pm8921_adc_scale_pa_therm(int32_t adc_code,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394 const struct pm8921_adc_properties *adc_prop,
395 const struct pm8921_adc_chan_properties *chan_prop,
396 struct pm8921_adc_chan_result *chan_rslt)
397{ return -ENXIO; }
Siddartha Mohanadossa0f51212011-09-13 17:49:32 -0700398static inline int32_t pm8921_adc_scale_pmic_therm(int32_t adc_code,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700399 const struct pm8921_adc_properties *adc_prop,
400 const struct pm8921_adc_chan_properties *chan_prop,
401 struct pm8921_adc_chan_result *chan_rslt)
402{ return -ENXIO; }
403#endif
404
405/**
406 * struct pm8921_adc_scale_fn - Scaling function prototype
407 * @chan: Function pointer to one of the scaling functions
408 * which takes the adc properties, channel properties,
409 * and returns the physical result
410 */
411struct pm8921_adc_scale_fn {
412 int32_t (*chan) (int32_t,
413 const struct pm8921_adc_properties *,
414 const struct pm8921_adc_chan_properties *,
415 struct pm8921_adc_chan_result *);
416};
417
418/**
419 * struct pm8921_adc_amux - AMUX properties for individual channel
420 * @name: Channel name
421 * @channel_name: Channel in integer used from pm8921_adc_channels
422 * @chan_path_prescaling: Channel scaling performed on the input signal
423 * @adc_rsv: Input reference Voltage/GND selection to the ADC
424 * @adc_decimation: Sampling rate desired for the channel
425 * adc_scale_fn: Scaling function to convert to the data meaningful for
426 * each individual channel whether it is voltage, current,
427 * temperature, etc and compensates the channel properties
428 */
429struct pm8921_adc_amux {
430 char *name;
431 enum pm8921_adc_channels channel_name;
432 enum pm8921_adc_channel_scaling_param chan_path_prescaling;
433 enum pm8921_adc_amux_input_rsv adc_rsv;
434 enum pm8921_adc_decimation_type adc_decimation;
435 enum pm8921_adc_scale_fn_type adc_scale_fn;
436};
437
438/**
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700439 * struct pm8921_adc_arb_btm_param - PM8921 ADC BTM parameters to set threshold
440 * temperature for client notification
441 * @low_thr_temp: low temperature threshold request for notification
442 * @high_thr_temp: high temperature threshold request for notification
443 * @low_thr_voltage: low temperature converted to voltage by arbiter driver
444 * @high_thr_voltage: high temperature converted to voltage by arbiter driver
445 * @interval: Interval period to check for temperature notification
Siddartha Mohanadoss93249a92011-08-09 14:28:00 -0700446 * @btm_warm_fn: Remote function call for warm threshold.
447 * @btm_cool_fn: Remote function call for cold threshold.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700448 *
449 * BTM client passes the parameters to be set for the
450 * temperature threshold notifications. The client is
451 * responsible for setting the new threshold
452 * levels once the thresholds are reached
453 */
454struct pm8921_adc_arb_btm_param {
455 uint32_t low_thr_temp;
456 uint32_t high_thr_temp;
Siddartha Mohanadoss93249a92011-08-09 14:28:00 -0700457 uint64_t low_thr_voltage;
458 uint64_t high_thr_voltage;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700459 int32_t interval;
Siddartha Mohanadoss93249a92011-08-09 14:28:00 -0700460 void (*btm_warm_fn) (bool);
461 void (*btm_cool_fn) (bool);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462};
463
464int32_t pm8921_adc_batt_scaler(struct pm8921_adc_arb_btm_param *);
465
466/**
467 * struct pm8921_adc_platform_data - PM8921 ADC platform data
468 * @adc_prop: ADC specific parameters, voltage and channel setup
469 * @adc_channel: Channel properties of the ADC arbiter
470 * @adc_num_channel: Total number of chanels supported
471 */
472struct pm8921_adc_platform_data {
473 struct pm8921_adc_properties *adc_prop;
474 struct pm8921_adc_amux *adc_channel;
475 uint32_t adc_num_channel;
476 u32 adc_wakeup;
477};
478
479/* Public API */
480#if defined(CONFIG_MFD_PM8921_ADC) || defined(CONFIG_MFD_PM8921_ADC_MODULE)
481/**
482 * pm8921_adc_read() - Performs ADC read on the channel.
483 * @channel: Input channel to perform the ADC read.
484 * @result: Structure pointer of type adc_chan_result
485 * in which the ADC read results are stored.
486 */
487uint32_t pm8921_adc_read(enum pm8921_adc_channels channel,
488 struct pm8921_adc_chan_result *result);
489/**
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700490 * pm8921_adc_btm_start() - Configure the BTM registers and start
491 monitoring the BATT_THERM channel for
492 threshold warm/cold temperature set
493 by the Battery client. The btm_start
494 api is to be used after calling the
495 pm8921_btm_configure() api which sets
496 the temperature thresholds, interval
497 and functions to call when warm/cold
498 events are triggered.
499 * @param: none.
500 */
501uint32_t pm8921_adc_btm_start(void);
502
503/**
504 * pm8921_adc_btm_end() - Configures the BTM registers to stop
505 * monitoring the BATT_THERM channel for
506 * warm/cold events and disables the
507 * interval timer.
508 * @param: none.
509 */
510uint32_t pm8921_adc_btm_end(void);
511
512/**
513 * pm8921_adc_btm_configure() - Configures the BATT_THERM channel
514 * parameters for warm/cold thresholds.
515 * Sets the interval timer for perfoming
516 * reading the temperature done by the HW.
517 * @btm_param: Structure pointer of type adc_arb_btm_param *
518 * which client provides for threshold warm/cold,
519 * interval and functions to call when warm/cold
520 * events are triggered.
521 */
522uint32_t pm8921_adc_btm_configure(struct pm8921_adc_arb_btm_param *);
523#else
524static inline uint32_t pm8921_adc_read(uint32_t channel,
525 struct pm8921_adc_chan_result *result)
526{ return -ENXIO; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527static inline uint32_t pm8921_adc_btm_start(void)
528{ return -ENXIO; }
529static inline uint32_t pm8921_adc_btm_end(void)
530{ return -ENXIO; }
531static inline uint32_t pm8921_adc_btm_configure(
532 struct pm8921_adc_arb_btm_param *param)
533{ return -ENXIO; }
534#endif
535
536#endif /* MFD_PM8921_ADC_H */