xref: /openbmc/linux/drivers/power/supply/ab8500-bm.h (revision 25b892b5)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _AB8500_CHARGER_H_
4 #define _AB8500_CHARGER_H_
5 
6 #include <linux/kernel.h>
7 
8 /*
9  * System control 2 register offsets.
10  * bank = 0x02
11  */
12 #define AB8500_MAIN_WDOG_CTRL_REG	0x01
13 #define AB8500_LOW_BAT_REG		0x03
14 #define AB8500_BATT_OK_REG		0x04
15 /*
16  * USB/ULPI register offsets
17  * Bank : 0x5
18  */
19 #define AB8500_USB_LINE_STAT_REG	0x80
20 #define AB8500_USB_LINE_CTRL2_REG	0x82
21 #define AB8500_USB_LINK1_STAT_REG	0x94
22 
23 /*
24  * Charger / status register offfsets
25  * Bank : 0x0B
26  */
27 #define AB8500_CH_STATUS1_REG		0x00
28 #define AB8500_CH_STATUS2_REG		0x01
29 #define AB8500_CH_USBCH_STAT1_REG	0x02
30 #define AB8500_CH_USBCH_STAT2_REG	0x03
31 #define AB8540_CH_USBCH_STAT3_REG	0x04
32 #define AB8500_CH_STAT_REG		0x05
33 
34 /*
35  * Charger / control register offfsets
36  * Bank : 0x0B
37  */
38 #define AB8500_CH_VOLT_LVL_REG		0x40
39 #define AB8500_CH_VOLT_LVL_MAX_REG	0x41  /*Only in Cut2.0*/
40 #define AB8500_CH_OPT_CRNTLVL_REG	0x42
41 #define AB8500_CH_OPT_CRNTLVL_MAX_REG	0x43  /*Only in Cut2.0*/
42 #define AB8500_CH_WD_TIMER_REG		0x50
43 #define AB8500_CHARG_WD_CTRL		0x51
44 #define AB8500_BTEMP_HIGH_TH		0x52
45 #define AB8500_LED_INDICATOR_PWM_CTRL	0x53
46 #define AB8500_LED_INDICATOR_PWM_DUTY	0x54
47 #define AB8500_BATT_OVV			0x55
48 #define AB8500_CHARGER_CTRL		0x56
49 #define AB8500_BAT_CTRL_CURRENT_SOURCE	0x60  /*Only in Cut2.0*/
50 
51 /*
52  * Charger / main control register offsets
53  * Bank : 0x0B
54  */
55 #define AB8500_MCH_CTRL1		0x80
56 #define AB8500_MCH_CTRL2		0x81
57 #define AB8500_MCH_IPT_CURLVL_REG	0x82
58 #define AB8500_CH_WD_REG		0x83
59 
60 /*
61  * Charger / USB control register offsets
62  * Bank : 0x0B
63  */
64 #define AB8500_USBCH_CTRL1_REG		0xC0
65 #define AB8500_USBCH_CTRL2_REG		0xC1
66 #define AB8500_USBCH_IPT_CRNTLVL_REG	0xC2
67 #define AB8540_USB_PP_MODE_REG		0xC5
68 #define AB8540_USB_PP_CHR_REG		0xC6
69 
70 /*
71  * Gas Gauge register offsets
72  * Bank : 0x0C
73  */
74 #define AB8500_GASG_CC_CTRL_REG		0x00
75 #define AB8500_GASG_CC_ACCU1_REG	0x01
76 #define AB8500_GASG_CC_ACCU2_REG	0x02
77 #define AB8500_GASG_CC_ACCU3_REG	0x03
78 #define AB8500_GASG_CC_ACCU4_REG	0x04
79 #define AB8500_GASG_CC_SMPL_CNTRL_REG	0x05
80 #define AB8500_GASG_CC_SMPL_CNTRH_REG	0x06
81 #define AB8500_GASG_CC_SMPL_CNVL_REG	0x07
82 #define AB8500_GASG_CC_SMPL_CNVH_REG	0x08
83 #define AB8500_GASG_CC_CNTR_AVGOFF_REG	0x09
84 #define AB8500_GASG_CC_OFFSET_REG	0x0A
85 #define AB8500_GASG_CC_NCOV_ACCU	0x10
86 #define AB8500_GASG_CC_NCOV_ACCU_CTRL	0x11
87 #define AB8500_GASG_CC_NCOV_ACCU_LOW	0x12
88 #define AB8500_GASG_CC_NCOV_ACCU_MED	0x13
89 #define AB8500_GASG_CC_NCOV_ACCU_HIGH	0x14
90 
91 /*
92  * Interrupt register offsets
93  * Bank : 0x0E
94  */
95 #define AB8500_IT_SOURCE2_REG		0x01
96 #define AB8500_IT_SOURCE21_REG		0x14
97 
98 /*
99  * RTC register offsets
100  * Bank: 0x0F
101  */
102 #define AB8500_RTC_BACKUP_CHG_REG	0x0C
103 #define AB8500_RTC_CC_CONF_REG		0x01
104 #define AB8500_RTC_CTRL_REG		0x0B
105 #define AB8500_RTC_CTRL1_REG		0x11
106 
107 /*
108  * OTP register offsets
109  * Bank : 0x15
110  */
111 #define AB8500_OTP_CONF_15		0x0E
112 
113 /* GPADC constants from AB8500 spec, UM0836 */
114 #define ADC_RESOLUTION			1024
115 #define ADC_CH_MAIN_MIN			0
116 #define ADC_CH_MAIN_MAX			20030
117 #define ADC_CH_VBUS_MIN			0
118 #define ADC_CH_VBUS_MAX			20030
119 #define ADC_CH_VBAT_MIN			2300
120 #define ADC_CH_VBAT_MAX			4800
121 #define ADC_CH_BKBAT_MIN		0
122 #define ADC_CH_BKBAT_MAX		3200
123 
124 /* Main charge i/p current */
125 #define MAIN_CH_IP_CUR_0P9A		0x80
126 #define MAIN_CH_IP_CUR_1P0A		0x90
127 #define MAIN_CH_IP_CUR_1P1A		0xA0
128 #define MAIN_CH_IP_CUR_1P2A		0xB0
129 #define MAIN_CH_IP_CUR_1P3A		0xC0
130 #define MAIN_CH_IP_CUR_1P4A		0xD0
131 #define MAIN_CH_IP_CUR_1P5A		0xE0
132 
133 /* ChVoltLevel */
134 #define CH_VOL_LVL_3P5			0x00
135 #define CH_VOL_LVL_4P0			0x14
136 #define CH_VOL_LVL_4P05			0x16
137 #define CH_VOL_LVL_4P1			0x1B
138 #define CH_VOL_LVL_4P15			0x20
139 #define CH_VOL_LVL_4P2			0x25
140 #define CH_VOL_LVL_4P6			0x4D
141 
142 /* ChOutputCurrentLevel */
143 #define CH_OP_CUR_LVL_0P1		0x00
144 #define CH_OP_CUR_LVL_0P2		0x01
145 #define CH_OP_CUR_LVL_0P3		0x02
146 #define CH_OP_CUR_LVL_0P4		0x03
147 #define CH_OP_CUR_LVL_0P5		0x04
148 #define CH_OP_CUR_LVL_0P6		0x05
149 #define CH_OP_CUR_LVL_0P7		0x06
150 #define CH_OP_CUR_LVL_0P8		0x07
151 #define CH_OP_CUR_LVL_0P9		0x08
152 #define CH_OP_CUR_LVL_1P4		0x0D
153 #define CH_OP_CUR_LVL_1P5		0x0E
154 #define CH_OP_CUR_LVL_1P6		0x0F
155 #define CH_OP_CUR_LVL_2P		0x3F
156 
157 /* BTEMP High thermal limits */
158 #define BTEMP_HIGH_TH_57_0		0x00
159 #define BTEMP_HIGH_TH_52		0x01
160 #define BTEMP_HIGH_TH_57_1		0x02
161 #define BTEMP_HIGH_TH_62		0x03
162 
163 /* current is mA */
164 #define USB_0P1A			100
165 #define USB_0P2A			200
166 #define USB_0P3A			300
167 #define USB_0P4A			400
168 #define USB_0P5A			500
169 
170 #define LOW_BAT_3P1V			0x20
171 #define LOW_BAT_2P3V			0x00
172 #define LOW_BAT_RESET			0x01
173 #define LOW_BAT_ENABLE			0x01
174 
175 /* Backup battery constants */
176 #define BUP_ICH_SEL_50UA		0x00
177 #define BUP_ICH_SEL_150UA		0x04
178 #define BUP_ICH_SEL_300UA		0x08
179 #define BUP_ICH_SEL_700UA		0x0C
180 
181 enum bup_vch_sel {
182 	BUP_VCH_SEL_2P5V,
183 	BUP_VCH_SEL_2P6V,
184 	BUP_VCH_SEL_2P8V,
185 	BUP_VCH_SEL_3P1V,
186 	/*
187 	 * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v
188 	 * are only available on ab8540. You can't choose these 5
189 	 * voltage on ab8500/ab8505/ab9540.
190 	 */
191 	BUP_VCH_SEL_2P7V,
192 	BUP_VCH_SEL_2P9V,
193 	BUP_VCH_SEL_3P0V,
194 	BUP_VCH_SEL_3P2V,
195 	BUP_VCH_SEL_3P3V,
196 };
197 
198 #define BUP_VCH_RANGE		0x02
199 #define VBUP33_VRTCN		0x01
200 
201 /* Battery OVV constants */
202 #define BATT_OVV_ENA			0x02
203 #define BATT_OVV_TH_3P7			0x00
204 #define BATT_OVV_TH_4P75		0x01
205 
206 /* A value to indicate over voltage */
207 #define BATT_OVV_VALUE			4750
208 
209 /* VBUS OVV constants */
210 #define VBUS_OVV_SELECT_MASK		0x78
211 #define VBUS_OVV_SELECT_5P6V		0x00
212 #define VBUS_OVV_SELECT_5P7V		0x08
213 #define VBUS_OVV_SELECT_5P8V		0x10
214 #define VBUS_OVV_SELECT_5P9V		0x18
215 #define VBUS_OVV_SELECT_6P0V		0x20
216 #define VBUS_OVV_SELECT_6P1V		0x28
217 #define VBUS_OVV_SELECT_6P2V		0x30
218 #define VBUS_OVV_SELECT_6P3V		0x38
219 
220 #define VBUS_AUTO_IN_CURR_LIM_ENA	0x04
221 
222 /* Fuel Gauge constants */
223 #define RESET_ACCU			0x02
224 #define READ_REQ			0x01
225 #define CC_DEEP_SLEEP_ENA		0x02
226 #define CC_PWR_UP_ENA			0x01
227 #define CC_SAMPLES_40			0x28
228 #define RD_NCONV_ACCU_REQ		0x01
229 #define CC_CALIB			0x08
230 #define CC_INTAVGOFFSET_ENA		0x10
231 #define CC_MUXOFFSET			0x80
232 #define CC_INT_CAL_N_AVG_MASK		0x60
233 #define CC_INT_CAL_SAMPLES_16		0x40
234 #define CC_INT_CAL_SAMPLES_8		0x20
235 #define CC_INT_CAL_SAMPLES_4		0x00
236 
237 /* RTC constants */
238 #define RTC_BUP_CH_ENA			0x10
239 
240 /* BatCtrl Current Source Constants */
241 #define BAT_CTRL_7U_ENA			0x01
242 #define BAT_CTRL_20U_ENA		0x02
243 #define BAT_CTRL_18U_ENA		0x01
244 #define BAT_CTRL_16U_ENA		0x02
245 #define BAT_CTRL_CMP_ENA		0x04
246 #define FORCE_BAT_CTRL_CMP_HIGH		0x08
247 #define BAT_CTRL_PULL_UP_ENA		0x10
248 
249 /* Battery type */
250 #define BATTERY_UNKNOWN			00
251 
252 /* Registers for pcut feature in ab8505 and ab9540 */
253 #define AB8505_RTC_PCUT_CTL_STATUS_REG	0x12
254 #define AB8505_RTC_PCUT_TIME_REG	0x13
255 #define AB8505_RTC_PCUT_MAX_TIME_REG	0x14
256 #define AB8505_RTC_PCUT_FLAG_TIME_REG	0x15
257 #define AB8505_RTC_PCUT_RESTART_REG	0x16
258 #define AB8505_RTC_PCUT_DEBOUNCE_REG	0x17
259 
260 /* USB Power Path constants for ab8540 */
261 #define BUS_VSYS_VOL_SELECT_MASK		0x06
262 #define BUS_VSYS_VOL_SELECT_3P6V		0x00
263 #define BUS_VSYS_VOL_SELECT_3P325V		0x02
264 #define BUS_VSYS_VOL_SELECT_3P9V		0x04
265 #define BUS_VSYS_VOL_SELECT_4P3V		0x06
266 #define BUS_POWER_PATH_MODE_ENA			0x01
267 #define BUS_PP_PRECHG_CURRENT_MASK		0x0E
268 #define BUS_POWER_PATH_PRECHG_ENA		0x01
269 
270 /*
271  * ADC for the battery thermistor.
272  * When using the AB8500_ADC_THERM_BATCTRL the battery ID resistor is combined
273  * with a NTC resistor to both identify the battery and to measure its
274  * temperature. Different phone manufactures uses different techniques to both
275  * identify the battery and to read its temperature.
276  */
277 enum ab8500_adc_therm {
278 	AB8500_ADC_THERM_BATCTRL,
279 	AB8500_ADC_THERM_BATTEMP,
280 };
281 
282 /**
283  * struct ab8500_res_to_temp - defines one point in a temp to res curve. To
284  * be used in battery packs that combines the identification resistor with a
285  * NTC resistor.
286  * @temp:			battery pack temperature in Celsius
287  * @resist:			NTC resistor net total resistance
288  */
289 struct ab8500_res_to_temp {
290 	int temp;
291 	int resist;
292 };
293 
294 /**
295  * struct ab8500_v_to_cap - Table for translating voltage to capacity
296  * @voltage:		Voltage in mV
297  * @capacity:		Capacity in percent
298  */
299 struct ab8500_v_to_cap {
300 	int voltage;
301 	int capacity;
302 };
303 
304 /* Forward declaration */
305 struct ab8500_fg;
306 
307 /**
308  * struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
309  * if not specified
310  * @recovery_sleep_timer:	Time between measurements while recovering
311  * @recovery_total_time:	Total recovery time
312  * @init_timer:			Measurement interval during startup
313  * @init_discard_time:		Time we discard voltage measurement at startup
314  * @init_total_time:		Total init time during startup
315  * @high_curr_time:		Time current has to be high to go to recovery
316  * @accu_charging:		FG accumulation time while charging
317  * @accu_high_curr:		FG accumulation time in high current mode
318  * @high_curr_threshold:	High current threshold, in mA
319  * @lowbat_threshold:		Low battery threshold, in mV
320  * @overbat_threshold:		Over battery threshold, in mV
321  * @battok_falling_th_sel0	Threshold in mV for battOk signal sel0
322  *				Resolution in 50 mV step.
323  * @battok_raising_th_sel1	Threshold in mV for battOk signal sel1
324  *				Resolution in 50 mV step.
325  * @user_cap_limit		Capacity reported from user must be within this
326  *				limit to be considered as sane, in percentage
327  *				points.
328  * @maint_thres			This is the threshold where we stop reporting
329  *				battery full while in maintenance, in per cent
330  * @pcut_enable:			Enable power cut feature in ab8505
331  * @pcut_max_time:		Max time threshold
332  * @pcut_flag_time:		Flagtime threshold
333  * @pcut_max_restart:		Max number of restarts
334  * @pcut_debounce_time:		Sets battery debounce time
335  */
336 struct ab8500_fg_parameters {
337 	int recovery_sleep_timer;
338 	int recovery_total_time;
339 	int init_timer;
340 	int init_discard_time;
341 	int init_total_time;
342 	int high_curr_time;
343 	int accu_charging;
344 	int accu_high_curr;
345 	int high_curr_threshold;
346 	int lowbat_threshold;
347 	int overbat_threshold;
348 	int battok_falling_th_sel0;
349 	int battok_raising_th_sel1;
350 	int user_cap_limit;
351 	int maint_thres;
352 	bool pcut_enable;
353 	u8 pcut_max_time;
354 	u8 pcut_flag_time;
355 	u8 pcut_max_restart;
356 	u8 pcut_debounce_time;
357 };
358 
359 /**
360  * struct ab8500_charger_maximization - struct used by the board config.
361  * @use_maxi:		Enable maximization for this battery type
362  * @maxi_chg_curr:	Maximum charger current allowed
363  * @maxi_wait_cycles:	cycles to wait before setting charger current
364  * @charger_curr_step	delta between two charger current settings (mA)
365  */
366 struct ab8500_maxim_parameters {
367 	bool ena_maxi;
368 	int chg_curr;
369 	int wait_cycles;
370 	int charger_curr_step;
371 };
372 
373 /**
374  * struct ab8500_battery_type - different batteries supported
375  * @name:			battery technology
376  * @resis_high:			battery upper resistance limit
377  * @resis_low:			battery lower resistance limit
378  * @charge_full_design:		Maximum battery capacity in mAh
379  * @nominal_voltage:		Nominal voltage of the battery in mV
380  * @termination_vol:		max voltage upto which battery can be charged
381  * @termination_curr		battery charging termination current in mA
382  * @recharge_cap		battery capacity limit that will trigger a new
383  *				full charging cycle in the case where maintenan-
384  *				-ce charging has been disabled
385  * @normal_cur_lvl:		charger current in normal state in mA
386  * @normal_vol_lvl:		charger voltage in normal state in mV
387  * @maint_a_cur_lvl:		charger current in maintenance A state in mA
388  * @maint_a_vol_lvl:		charger voltage in maintenance A state in mV
389  * @maint_a_chg_timer_h:	charge time in maintenance A state
390  * @maint_b_cur_lvl:		charger current in maintenance B state in mA
391  * @maint_b_vol_lvl:		charger voltage in maintenance B state in mV
392  * @maint_b_chg_timer_h:	charge time in maintenance B state
393  * @low_high_cur_lvl:		charger current in temp low/high state in mA
394  * @low_high_vol_lvl:		charger voltage in temp low/high state in mV'
395  * @battery_resistance:		battery inner resistance in mOhm.
396  * @n_r_t_tbl_elements:		number of elements in r_to_t_tbl
397  * @r_to_t_tbl:			table containing resistance to temp points
398  * @n_v_cap_tbl_elements:	number of elements in v_to_cap_tbl
399  * @v_to_cap_tbl:		Voltage to capacity (in %) table
400  * @n_batres_tbl_elements	number of elements in the batres_tbl
401  * @batres_tbl			battery internal resistance vs temperature table
402  */
403 struct ab8500_battery_type {
404 	int name;
405 	int resis_high;
406 	int resis_low;
407 	int charge_full_design;
408 	int nominal_voltage;
409 	int termination_vol;
410 	int termination_curr;
411 	int recharge_cap;
412 	int normal_cur_lvl;
413 	int normal_vol_lvl;
414 	int maint_a_cur_lvl;
415 	int maint_a_vol_lvl;
416 	int maint_a_chg_timer_h;
417 	int maint_b_cur_lvl;
418 	int maint_b_vol_lvl;
419 	int maint_b_chg_timer_h;
420 	int low_high_cur_lvl;
421 	int low_high_vol_lvl;
422 	int battery_resistance;
423 	int n_temp_tbl_elements;
424 	const struct ab8500_res_to_temp *r_to_t_tbl;
425 	int n_v_cap_tbl_elements;
426 	const struct ab8500_v_to_cap *v_to_cap_tbl;
427 	int n_batres_tbl_elements;
428 	const struct batres_vs_temp *batres_tbl;
429 };
430 
431 /**
432  * struct ab8500_bm_capacity_levels - ab8500 capacity level data
433  * @critical:		critical capacity level in percent
434  * @low:		low capacity level in percent
435  * @normal:		normal capacity level in percent
436  * @high:		high capacity level in percent
437  * @full:		full capacity level in percent
438  */
439 struct ab8500_bm_capacity_levels {
440 	int critical;
441 	int low;
442 	int normal;
443 	int high;
444 	int full;
445 };
446 
447 /**
448  * struct ab8500_bm_charger_parameters - Charger specific parameters
449  * @usb_volt_max:	maximum allowed USB charger voltage in mV
450  * @usb_curr_max:	maximum allowed USB charger current in mA
451  * @ac_volt_max:	maximum allowed AC charger voltage in mV
452  * @ac_curr_max:	maximum allowed AC charger current in mA
453  */
454 struct ab8500_bm_charger_parameters {
455 	int usb_volt_max;
456 	int usb_curr_max;
457 	int ac_volt_max;
458 	int ac_curr_max;
459 };
460 
461 /**
462  * struct ab8500_bm_data - ab8500 battery management data
463  * @temp_under		under this temp, charging is stopped
464  * @temp_low		between this temp and temp_under charging is reduced
465  * @temp_high		between this temp and temp_over charging is reduced
466  * @temp_over		over this temp, charging is stopped
467  * @temp_now		present battery temperature
468  * @temp_interval_chg	temperature measurement interval in s when charging
469  * @temp_interval_nochg	temperature measurement interval in s when not charging
470  * @main_safety_tmr_h	safety timer for main charger
471  * @usb_safety_tmr_h	safety timer for usb charger
472  * @bkup_bat_v		voltage which we charge the backup battery with
473  * @bkup_bat_i		current which we charge the backup battery with
474  * @no_maintenance	indicates that maintenance charging is disabled
475  * @capacity_scaling    indicates whether capacity scaling is to be used
476  * @ab8500_adc_therm	placement of thermistor, batctrl or battemp adc
477  * @chg_unknown_bat	flag to enable charging of unknown batteries
478  * @enable_overshoot	flag to enable VBAT overshoot control
479  * @auto_trig		flag to enable auto adc trigger
480  * @fg_res		resistance of FG resistor in 0.1mOhm
481  * @n_btypes		number of elements in array bat_type
482  * @batt_id		index of the identified battery in array bat_type
483  * @interval_charging	charge alg cycle period time when charging (sec)
484  * @interval_not_charging charge alg cycle period time when not charging (sec)
485  * @temp_hysteresis	temperature hysteresis
486  * @gnd_lift_resistance	Battery ground to phone ground resistance (mOhm)
487  * @n_chg_out_curr		number of elements in array chg_output_curr
488  * @n_chg_in_curr		number of elements in array chg_input_curr
489  * @chg_output_curr	charger output current level map
490  * @chg_input_curr		charger input current level map
491  * @maxi		maximization parameters
492  * @cap_levels		capacity in percent for the different capacity levels
493  * @bat_type		table of supported battery types
494  * @chg_params		charger parameters
495  * @fg_params		fuel gauge parameters
496  */
497 struct ab8500_bm_data {
498 	int temp_under;
499 	int temp_low;
500 	int temp_high;
501 	int temp_over;
502 	int temp_now;
503 	int temp_interval_chg;
504 	int temp_interval_nochg;
505 	int main_safety_tmr_h;
506 	int usb_safety_tmr_h;
507 	int bkup_bat_v;
508 	int bkup_bat_i;
509 	bool no_maintenance;
510 	bool capacity_scaling;
511 	bool chg_unknown_bat;
512 	bool enable_overshoot;
513 	bool auto_trig;
514 	enum ab8500_adc_therm adc_therm;
515 	int fg_res;
516 	int n_btypes;
517 	int batt_id;
518 	int interval_charging;
519 	int interval_not_charging;
520 	int temp_hysteresis;
521 	int gnd_lift_resistance;
522 	int n_chg_out_curr;
523 	int n_chg_in_curr;
524 	int *chg_output_curr;
525 	int *chg_input_curr;
526 	const struct ab8500_maxim_parameters *maxi;
527 	const struct ab8500_bm_capacity_levels *cap_levels;
528 	struct ab8500_battery_type *bat_type;
529 	const struct ab8500_bm_charger_parameters *chg_params;
530 	const struct ab8500_fg_parameters *fg_params;
531 };
532 
533 enum {
534 	NTC_EXTERNAL = 0,
535 	NTC_INTERNAL,
536 };
537 
538 /**
539  * struct res_to_temp - defines one point in a temp to res curve. To
540  * be used in battery packs that combines the identification resistor with a
541  * NTC resistor.
542  * @temp:			battery pack temperature in Celsius
543  * @resist:			NTC resistor net total resistance
544  */
545 struct res_to_temp {
546 	int temp;
547 	int resist;
548 };
549 
550 /**
551  * struct batres_vs_temp - defines one point in a temp vs battery internal
552  * resistance curve.
553  * @temp:			battery pack temperature in Celsius
554  * @resist:			battery internal reistance in mOhm
555  */
556 struct batres_vs_temp {
557 	int temp;
558 	int resist;
559 };
560 
561 /* Forward declaration */
562 struct ab8500_fg;
563 
564 extern struct ab8500_bm_data ab8500_bm_data;
565 
566 void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
567 struct ab8500_fg *ab8500_fg_get(void);
568 int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
569 int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
570 int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
571 int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
572 int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
573 int ab8500_bm_of_probe(struct device *dev,
574 		       struct device_node *np,
575 		       struct ab8500_bm_data *bm);
576 
577 extern struct platform_driver ab8500_fg_driver;
578 extern struct platform_driver ab8500_btemp_driver;
579 extern struct platform_driver ab8500_chargalg_driver;
580 
581 #endif /* _AB8500_CHARGER_H_ */
582