diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 15:10:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 15:10:15 -0400 |
| commit | 76f901eb4659779ecacd0e4eba49f55442daef53 (patch) | |
| tree | 0761f03211ffdfc06216eabeb61b02ef6d598d3c /include/linux | |
| parent | bd0e162d0312aa95e8b85ba883efddebf27be121 (diff) | |
| parent | 96facd23e45e6d5020be135c8ab392ba9e044fa4 (diff) | |
Merge tag 'for-v3.5' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov:
"A bunch of fixes for v3.5, nothing extraordinary."
* tag 'for-v3.5' of git://git.infradead.org/battery-2.6: (27 commits)
smb347-charger: Include missing <linux/err.h>
smb347-charger: Clean up battery attributes
max17042_battery: Add support for max17047/50 chip
sbs-battery.c: Capacity attr = remaining relative capacity
isp1704_charger: Use after free on probe error
ds2781_battery: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
charger-manager: Provide cm_notify_event function for in-kernel use
charger-manager: Poll battery health in normal state
smb347-charger: Convert to regmap API
smb347-charger: Move IRQ enabling to the end of probe
smb347-charger: Rename few functions to match better what they are doing
smb347-charger: Convert to use module_i2c_driver()
smb347_charger: Cleanup power supply registration code in probe
ab8500: Clean up probe routines
ab8500_fg: Harden platform data check
ab8500_btemp: Harden platform data check
ab8500_charger: Harden platform data check
MAINTAINERS: Fix 'F' entry for the power supply class
max17042_battery: Handle irq request failure case
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/power/charger-manager.h | 50 | ||||
| -rw-r--r-- | include/linux/power/max17042_battery.h | 17 | ||||
| -rw-r--r-- | include/linux/power_supply.h | 4 |
3 files changed, 62 insertions, 9 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index 4f75e531c112..241065c9ce51 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #include <linux/power_supply.h> | 18 | #include <linux/power_supply.h> |
| 19 | 19 | ||
| 20 | enum data_source { | 20 | enum data_source { |
| 21 | CM_BATTERY_PRESENT, | ||
| 22 | CM_NO_BATTERY, | ||
| 21 | CM_FUEL_GAUGE, | 23 | CM_FUEL_GAUGE, |
| 22 | CM_CHARGER_STAT, | 24 | CM_CHARGER_STAT, |
| 23 | }; | 25 | }; |
| @@ -29,6 +31,16 @@ enum polling_modes { | |||
| 29 | CM_POLL_CHARGING_ONLY, | 31 | CM_POLL_CHARGING_ONLY, |
| 30 | }; | 32 | }; |
| 31 | 33 | ||
| 34 | enum cm_event_types { | ||
| 35 | CM_EVENT_UNKNOWN = 0, | ||
| 36 | CM_EVENT_BATT_FULL, | ||
| 37 | CM_EVENT_BATT_IN, | ||
| 38 | CM_EVENT_BATT_OUT, | ||
| 39 | CM_EVENT_EXT_PWR_IN_OUT, | ||
| 40 | CM_EVENT_CHG_START_STOP, | ||
| 41 | CM_EVENT_OTHERS, | ||
| 42 | }; | ||
| 43 | |||
| 32 | /** | 44 | /** |
| 33 | * struct charger_global_desc | 45 | * struct charger_global_desc |
| 34 | * @rtc_name: the name of RTC used to wake up the system from suspend. | 46 | * @rtc_name: the name of RTC used to wake up the system from suspend. |
| @@ -38,11 +50,18 @@ enum polling_modes { | |||
| 38 | * rtc_only_wakeup() returning false. | 50 | * rtc_only_wakeup() returning false. |
| 39 | * If the RTC given to CM is the only wakeup reason, | 51 | * If the RTC given to CM is the only wakeup reason, |
| 40 | * rtc_only_wakeup should return true. | 52 | * rtc_only_wakeup should return true. |
| 53 | * @assume_timer_stops_in_suspend: | ||
| 54 | * Assume that the jiffy timer stops in suspend-to-RAM. | ||
| 55 | * When enabled, CM does not rely on jiffies value in | ||
| 56 | * suspend_again and assumes that jiffies value does not | ||
| 57 | * change during suspend. | ||
| 41 | */ | 58 | */ |
| 42 | struct charger_global_desc { | 59 | struct charger_global_desc { |
| 43 | char *rtc_name; | 60 | char *rtc_name; |
| 44 | 61 | ||
| 45 | bool (*rtc_only_wakeup)(void); | 62 | bool (*rtc_only_wakeup)(void); |
| 63 | |||
| 64 | bool assume_timer_stops_in_suspend; | ||
| 46 | }; | 65 | }; |
| 47 | 66 | ||
| 48 | /** | 67 | /** |
| @@ -50,6 +69,11 @@ struct charger_global_desc { | |||
| 50 | * @psy_name: the name of power-supply-class for charger manager | 69 | * @psy_name: the name of power-supply-class for charger manager |
| 51 | * @polling_mode: | 70 | * @polling_mode: |
| 52 | * Determine which polling mode will be used | 71 | * Determine which polling mode will be used |
| 72 | * @fullbatt_vchkdrop_ms: | ||
| 73 | * @fullbatt_vchkdrop_uV: | ||
| 74 | * Check voltage drop after the battery is fully charged. | ||
| 75 | * If it has dropped more than fullbatt_vchkdrop_uV after | ||
| 76 | * fullbatt_vchkdrop_ms, CM will restart charging. | ||
| 53 | * @fullbatt_uV: voltage in microvolt | 77 | * @fullbatt_uV: voltage in microvolt |
| 54 | * If it is not being charged and VBATT >= fullbatt_uV, | 78 | * If it is not being charged and VBATT >= fullbatt_uV, |
| 55 | * it is assumed to be full. | 79 | * it is assumed to be full. |
| @@ -76,6 +100,8 @@ struct charger_desc { | |||
| 76 | enum polling_modes polling_mode; | 100 | enum polling_modes polling_mode; |
| 77 | unsigned int polling_interval_ms; | 101 | unsigned int polling_interval_ms; |
| 78 | 102 | ||
| 103 | unsigned int fullbatt_vchkdrop_ms; | ||
| 104 | unsigned int fullbatt_vchkdrop_uV; | ||
| 79 | unsigned int fullbatt_uV; | 105 | unsigned int fullbatt_uV; |
| 80 | 106 | ||
| 81 | enum data_source battery_present; | 107 | enum data_source battery_present; |
| @@ -101,6 +127,11 @@ struct charger_desc { | |||
| 101 | * @fuel_gauge: power_supply for fuel gauge | 127 | * @fuel_gauge: power_supply for fuel gauge |
| 102 | * @charger_stat: array of power_supply for chargers | 128 | * @charger_stat: array of power_supply for chargers |
| 103 | * @charger_enabled: the state of charger | 129 | * @charger_enabled: the state of charger |
| 130 | * @fullbatt_vchk_jiffies_at: | ||
| 131 | * jiffies at the time full battery check will occur. | ||
| 132 | * @fullbatt_vchk_uV: voltage in microvolt | ||
| 133 | * criteria for full battery | ||
| 134 | * @fullbatt_vchk_work: work queue for full battery check | ||
| 104 | * @emergency_stop: | 135 | * @emergency_stop: |
| 105 | * When setting true, stop charging | 136 | * When setting true, stop charging |
| 106 | * @last_temp_mC: the measured temperature in milli-Celsius | 137 | * @last_temp_mC: the measured temperature in milli-Celsius |
| @@ -121,6 +152,10 @@ struct charger_manager { | |||
| 121 | 152 | ||
| 122 | bool charger_enabled; | 153 | bool charger_enabled; |
| 123 | 154 | ||
| 155 | unsigned long fullbatt_vchk_jiffies_at; | ||
| 156 | unsigned int fullbatt_vchk_uV; | ||
| 157 | struct delayed_work fullbatt_vchk_work; | ||
| 158 | |||
| 124 | int emergency_stop; | 159 | int emergency_stop; |
| 125 | int last_temp_mC; | 160 | int last_temp_mC; |
| 126 | 161 | ||
| @@ -134,14 +169,13 @@ struct charger_manager { | |||
| 134 | #ifdef CONFIG_CHARGER_MANAGER | 169 | #ifdef CONFIG_CHARGER_MANAGER |
| 135 | extern int setup_charger_manager(struct charger_global_desc *gd); | 170 | extern int setup_charger_manager(struct charger_global_desc *gd); |
| 136 | extern bool cm_suspend_again(void); | 171 | extern bool cm_suspend_again(void); |
| 172 | extern void cm_notify_event(struct power_supply *psy, | ||
| 173 | enum cm_event_types type, char *msg); | ||
| 137 | #else | 174 | #else |
| 138 | static void __maybe_unused setup_charger_manager(struct charger_global_desc *gd) | 175 | static inline int setup_charger_manager(struct charger_global_desc *gd) |
| 139 | { } | 176 | { return 0; } |
| 140 | 177 | static inline bool cm_suspend_again(void) { return false; } | |
| 141 | static bool __maybe_unused cm_suspend_again(void) | 178 | static inline void cm_notify_event(struct power_supply *psy, |
| 142 | { | 179 | enum cm_event_types type, char *msg) { } |
| 143 | return false; | ||
| 144 | } | ||
| 145 | #endif | 180 | #endif |
| 146 | |||
| 147 | #endif /* _CHARGER_MANAGER_H */ | 181 | #endif /* _CHARGER_MANAGER_H */ |
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h index e01b167e66f0..89dd84f47c6e 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h | |||
| @@ -116,6 +116,18 @@ enum max17042_register { | |||
| 116 | MAX17042_VFSOC = 0xFF, | 116 | MAX17042_VFSOC = 0xFF, |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | /* Registers specific to max17047/50 */ | ||
| 120 | enum max17047_register { | ||
| 121 | MAX17047_QRTbl00 = 0x12, | ||
| 122 | MAX17047_FullSOCThr = 0x13, | ||
| 123 | MAX17047_QRTbl10 = 0x22, | ||
| 124 | MAX17047_QRTbl20 = 0x32, | ||
| 125 | MAX17047_V_empty = 0x3A, | ||
| 126 | MAX17047_QRTbl30 = 0x42, | ||
| 127 | }; | ||
| 128 | |||
| 129 | enum max170xx_chip_type {MAX17042, MAX17047}; | ||
| 130 | |||
| 119 | /* | 131 | /* |
| 120 | * used for setting a register to a desired value | 132 | * used for setting a register to a desired value |
| 121 | * addr : address for a register | 133 | * addr : address for a register |
| @@ -144,6 +156,7 @@ struct max17042_config_data { | |||
| 144 | u16 shdntimer; /* 0x03F */ | 156 | u16 shdntimer; /* 0x03F */ |
| 145 | 157 | ||
| 146 | /* App data */ | 158 | /* App data */ |
| 159 | u16 full_soc_thresh; /* 0x13 */ | ||
| 147 | u16 design_cap; /* 0x18 */ | 160 | u16 design_cap; /* 0x18 */ |
| 148 | u16 ichgt_term; /* 0x1E */ | 161 | u16 ichgt_term; /* 0x1E */ |
| 149 | 162 | ||
| @@ -162,6 +175,10 @@ struct max17042_config_data { | |||
| 162 | u16 lavg_empty; /* 0x36 */ | 175 | u16 lavg_empty; /* 0x36 */ |
| 163 | u16 dqacc; /* 0x45 */ | 176 | u16 dqacc; /* 0x45 */ |
| 164 | u16 dpacc; /* 0x46 */ | 177 | u16 dpacc; /* 0x46 */ |
| 178 | u16 qrtbl00; /* 0x12 */ | ||
| 179 | u16 qrtbl10; /* 0x22 */ | ||
| 180 | u16 qrtbl20; /* 0x32 */ | ||
| 181 | u16 qrtbl30; /* 0x42 */ | ||
| 165 | 182 | ||
| 166 | /* Cell technology from power_supply.h */ | 183 | /* Cell technology from power_supply.h */ |
| 167 | u16 cell_technology; | 184 | u16 cell_technology; |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index c38c13db8832..3b912bee28d1 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -96,6 +96,7 @@ enum power_supply_property { | |||
| 96 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 96 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
| 97 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 97 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
| 98 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | 98 | POWER_SUPPLY_PROP_VOLTAGE_AVG, |
| 99 | POWER_SUPPLY_PROP_VOLTAGE_OCV, | ||
| 99 | POWER_SUPPLY_PROP_CURRENT_MAX, | 100 | POWER_SUPPLY_PROP_CURRENT_MAX, |
| 100 | POWER_SUPPLY_PROP_CURRENT_NOW, | 101 | POWER_SUPPLY_PROP_CURRENT_NOW, |
| 101 | POWER_SUPPLY_PROP_CURRENT_AVG, | 102 | POWER_SUPPLY_PROP_CURRENT_AVG, |
| @@ -211,7 +212,7 @@ extern void power_supply_changed(struct power_supply *psy); | |||
| 211 | extern int power_supply_am_i_supplied(struct power_supply *psy); | 212 | extern int power_supply_am_i_supplied(struct power_supply *psy); |
| 212 | extern int power_supply_set_battery_charged(struct power_supply *psy); | 213 | extern int power_supply_set_battery_charged(struct power_supply *psy); |
| 213 | 214 | ||
| 214 | #if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) | 215 | #ifdef CONFIG_POWER_SUPPLY |
| 215 | extern int power_supply_is_system_supplied(void); | 216 | extern int power_supply_is_system_supplied(void); |
| 216 | #else | 217 | #else |
| 217 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } | 218 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } |
| @@ -261,6 +262,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp) | |||
| 261 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 262 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
| 262 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | 263 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: |
| 263 | case POWER_SUPPLY_PROP_VOLTAGE_AVG: | 264 | case POWER_SUPPLY_PROP_VOLTAGE_AVG: |
| 265 | case POWER_SUPPLY_PROP_VOLTAGE_OCV: | ||
| 264 | case POWER_SUPPLY_PROP_POWER_NOW: | 266 | case POWER_SUPPLY_PROP_POWER_NOW: |
| 265 | return 1; | 267 | return 1; |
| 266 | default: | 268 | default: |
