| Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, The Linux Foundation. All rights reserved. | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 |  * | 
 | 3 |  * This program is free software; you can redistribute it and/or modify | 
 | 4 |  * it under the terms of the GNU General Public License version 2 and | 
 | 5 |  * only version 2 as published by the Free Software Foundation. | 
 | 6 |  * | 
 | 7 |  * This program is distributed in the hope that it will be useful, | 
 | 8 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 9 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 10 |  * GNU General Public License for more details. | 
 | 11 |  */ | 
 | 12 |  | 
 | 13 | #ifndef __PMIC8058_CHARGER_H__ | 
 | 14 | #define __PMIC8058_CHARGER_H__ | 
| Abhijeet Dharmapurikar | f734c67 | 2011-08-11 10:20:27 -0700 | [diff] [blame] | 15 | /** | 
 | 16 |  * enum pmic8058_chg_state - pmic8058 charging states | 
 | 17 |  * @PMIC8058_CHG_STATE_NONE:		Initial off state | 
 | 18 |  * @PMIC8058_CHG_STATE_PWR_CHG:		Device powered from charger | 
 | 19 |  * @PMIC8058_CHG_STATE_ATC:		Device is Auto Tricke Charged (ATC) | 
 | 20 |  * @PMIC8058_CHG_STATE_PWR_BAT:		Device powered from Battery | 
 | 21 |  * @PMIC8058_CHG_STATE_ATC_FAIL:	ATC failed | 
 | 22 |  * @PMIC8058_CHG_STATE_AUX_EN:		Transient state | 
 | 23 |  * @PMIC8058_CHG_STATE_PON_AFTER_ATC:	Power on from battery and chg with limit | 
 | 24 |  *					of 90mA | 
 | 25 |  * @PMIC8058_CHG_STATE_FAST_CHG:	pmic is fast charging the battery | 
 | 26 |  * @PMIC8058_CHG_STATE_TRKL_CHG:	pmic is trck charging the battery | 
 | 27 |  * @PMIC8058_CHG_STATE_CHG_FAIL:	charging failed | 
 | 28 |  * @PMIC8058_CHG_STATE_EOC:		end of charging reached | 
 | 29 |  * @PMIC8058_CHG_STATE_INRUSH_LIMIT:	Brings up Vdd with 90mA max drawn from | 
 | 30 |  *					VBUS | 
 | 31 |  * @PMIC8058_CHG_STATE_USB_SUSPENDED:	USB supended, no current drawn from VBUS | 
 | 32 |  * @PMIC8058_CHG_STATE_PAUSE_ATC:	ATC paused | 
 | 33 |  * @PMIC8058_CHG_STATE_PAUSE_FAST_CHG:	FAST charging paused | 
 | 34 |  * @PMIC8058_CHG_STATE_PAUSE_TRKL_CHG:	TRLK charging paused | 
 | 35 |  * | 
 | 36 |  * The paused states happen when a unfavourable condition for charging is | 
 | 37 |  * detected. The most common one being the battery gets too hot ot gets | 
 | 38 |  * too cold for charging. | 
 | 39 |  */ | 
 | 40 | enum pmic8058_chg_state { | 
 | 41 | 	PMIC8058_CHG_STATE_NONE, | 
 | 42 | 	PMIC8058_CHG_STATE_PWR_CHG, | 
 | 43 | 	PMIC8058_CHG_STATE_ATC, | 
 | 44 | 	PMIC8058_CHG_STATE_PWR_BAT, | 
 | 45 | 	PMIC8058_CHG_STATE_ATC_FAIL, | 
 | 46 | 	PMIC8058_CHG_STATE_AUX_EN, | 
 | 47 | 	PMIC8058_CHG_STATE_PON_AFTER_ATC, | 
 | 48 | 	PMIC8058_CHG_STATE_FAST_CHG, | 
 | 49 | 	PMIC8058_CHG_STATE_TRKL_CHG, | 
 | 50 | 	PMIC8058_CHG_STATE_CHG_FAIL, | 
 | 51 | 	PMIC8058_CHG_STATE_EOC, | 
 | 52 | 	PMIC8058_CHG_STATE_INRUSH_LIMIT, | 
 | 53 | 	PMIC8058_CHG_STATE_USB_SUSPENDED, | 
 | 54 | 	PMIC8058_CHG_STATE_PAUSE_ATC, | 
 | 55 | 	PMIC8058_CHG_STATE_PAUSE_FAST_CHG, | 
 | 56 | 	PMIC8058_CHG_STATE_PAUSE_TRKL_CHG | 
 | 57 | }; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 58 |  | 
 | 59 | #if defined(CONFIG_BATTERY_MSM8X60) || defined(CONFIG_BATTERY_MSM8X60_MODULE) | 
 | 60 | int pmic8058_get_charge_batt(void); | 
 | 61 | int pmic8058_set_charge_batt(int); | 
| Abhijeet Dharmapurikar | f734c67 | 2011-08-11 10:20:27 -0700 | [diff] [blame] | 62 | /** | 
 | 63 |  * pmic8058_get_fsm_state - | 
 | 64 |  * | 
 | 65 |  * CONTEXT: may sleep - should not be called from non-atomic context | 
 | 66 |  * | 
 | 67 |  * RETURNS: The pmic internal state, or error otherwise | 
 | 68 |  */ | 
 | 69 | enum pmic8058_chg_state pmic8058_get_fsm_state(void); | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 70 | #else | 
 | 71 | int pmic8058_get_charge_batt(void) | 
 | 72 | { | 
 | 73 | 	return -ENXIO; | 
 | 74 | } | 
 | 75 | int pmic8058_set_charge_batt(int) | 
 | 76 | { | 
 | 77 | 	return -ENXIO; | 
 | 78 | } | 
| Abhijeet Dharmapurikar | f734c67 | 2011-08-11 10:20:27 -0700 | [diff] [blame] | 79 | enum pmic8058_chg_state pmic8058_get_fsm_state(void) | 
 | 80 | { | 
 | 81 | 	return -ENXIO; | 
 | 82 | } | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 83 | #endif | 
 | 84 | #endif /* __PMIC8058_CHARGER_H__ */ |