diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-07 04:29:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-07 04:29:24 -0400 |
commit | e665faa424a4a782aa986274920c1fc5b76f5560 (patch) | |
tree | 2cf64abadecbbeadcffc02cb7671cb593fc45488 /include/linux/power | |
parent | ca4da6948bc6a7010ecf916dad528c177dcb9a81 (diff) | |
parent | 18766f0936d444fd7ff2e0064bd6e69a89d5c6fc (diff) |
Merge tag 'for-v3.7' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov:
"1. New drivers:
- Marvell 88pm860x charger and battery drivers;
- Texas Instruments LP8788 charger driver;
2. Two new power supply properties: whether a battery is authentic,
and chargers' maximal currents and voltages;
3. A lot of TI LP8727 Charger cleanups;
4. New features for Charger Manager, mainly now we can disable
specific regulators;
5. Random fixes and cleanups for other drivers."
Fix up trivial conflicts in <linux/mfd/88pm860x.h>
* tag 'for-v3.7' of git://git.infradead.org/battery-2.6: (52 commits)
pda_power: Remove ac_draw_failed goto and label
charger-manager: Add support sysfs entry for charger
charger-manager: Support limit of maximum possible
charger-manager: Check fully charged state of battery periodically
lp8727_charger: More pure cosmetic improvements
lp8727_charger: Fix checkpatch warning
lp8727_charger: Add description in the private data
lp8727_charger: Fix a typo - chg_parm to chg_param
lp8727_charger: Make some cosmetic changes in lp8727_delayed_func()
lp8727_charger: Clean up lp8727_charger_changed()
lp8727_charger: Return if the battery is discharging
lp8727_charger: Make lp8727_charger_get_propery() simpler
lp8727_charger: Make lp8727_ctrl_switch() inline
lp8727_charger: Make lp8727_init_device() shorter
lp8727_charger: Clean up lp8727_is_charger_attached()
lp8727_charger: Use specific definition
lp8727_charger: Clean up lp8727 definitions
lp8727_charger: Use the definition rather than enum
lp8727_charger: Fix code for getting battery temp
lp8727_charger: Clear interrrupts at inital time
...
Diffstat (limited to 'include/linux/power')
-rw-r--r-- | include/linux/power/charger-manager.h | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index cd22029e32aa..0e86840eb603 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
@@ -109,24 +109,43 @@ struct charger_cable { | |||
109 | * struct charger_regulator | 109 | * struct charger_regulator |
110 | * @regulator_name: the name of regulator for using charger. | 110 | * @regulator_name: the name of regulator for using charger. |
111 | * @consumer: the regulator consumer for the charger. | 111 | * @consumer: the regulator consumer for the charger. |
112 | * @externally_control: | ||
113 | * Set if the charger-manager cannot control charger, | ||
114 | * the charger will be maintained with disabled state. | ||
112 | * @cables: | 115 | * @cables: |
113 | * the array of charger cables to enable/disable charger | 116 | * the array of charger cables to enable/disable charger |
114 | * and set current limit according to constratint data of | 117 | * and set current limit according to constratint data of |
115 | * struct charger_cable if only charger cable included | 118 | * struct charger_cable if only charger cable included |
116 | * in the array of charger cables is attached/detached. | 119 | * in the array of charger cables is attached/detached. |
117 | * @num_cables: the number of charger cables. | 120 | * @num_cables: the number of charger cables. |
121 | * @attr_g: Attribute group for the charger(regulator) | ||
122 | * @attr_name: "name" sysfs entry | ||
123 | * @attr_state: "state" sysfs entry | ||
124 | * @attr_externally_control: "externally_control" sysfs entry | ||
125 | * @attrs: Arrays pointing to attr_name/state/externally_control for attr_g | ||
118 | */ | 126 | */ |
119 | struct charger_regulator { | 127 | struct charger_regulator { |
120 | /* The name of regulator for charging */ | 128 | /* The name of regulator for charging */ |
121 | const char *regulator_name; | 129 | const char *regulator_name; |
122 | struct regulator *consumer; | 130 | struct regulator *consumer; |
123 | 131 | ||
132 | /* charger never on when system is on */ | ||
133 | int externally_control; | ||
134 | |||
124 | /* | 135 | /* |
125 | * Store constraint information related to current limit, | 136 | * Store constraint information related to current limit, |
126 | * each cable have different condition for charging. | 137 | * each cable have different condition for charging. |
127 | */ | 138 | */ |
128 | struct charger_cable *cables; | 139 | struct charger_cable *cables; |
129 | int num_cables; | 140 | int num_cables; |
141 | |||
142 | struct attribute_group attr_g; | ||
143 | struct device_attribute attr_name; | ||
144 | struct device_attribute attr_state; | ||
145 | struct device_attribute attr_externally_control; | ||
146 | struct attribute *attrs[4]; | ||
147 | |||
148 | struct charger_manager *cm; | ||
130 | }; | 149 | }; |
131 | 150 | ||
132 | /** | 151 | /** |
@@ -140,7 +159,11 @@ struct charger_regulator { | |||
140 | * If it has dropped more than fullbatt_vchkdrop_uV after | 159 | * If it has dropped more than fullbatt_vchkdrop_uV after |
141 | * fullbatt_vchkdrop_ms, CM will restart charging. | 160 | * fullbatt_vchkdrop_ms, CM will restart charging. |
142 | * @fullbatt_uV: voltage in microvolt | 161 | * @fullbatt_uV: voltage in microvolt |
143 | * If it is not being charged and VBATT >= fullbatt_uV, | 162 | * If VBATT >= fullbatt_uV, it is assumed to be full. |
163 | * @fullbatt_soc: state of Charge in % | ||
164 | * If state of Charge >= fullbatt_soc, it is assumed to be full. | ||
165 | * @fullbatt_full_capacity: full capacity measure | ||
166 | * If full capacity of battery >= fullbatt_full_capacity, | ||
144 | * it is assumed to be full. | 167 | * it is assumed to be full. |
145 | * @polling_interval_ms: interval in millisecond at which | 168 | * @polling_interval_ms: interval in millisecond at which |
146 | * charger manager will monitor battery health | 169 | * charger manager will monitor battery health |
@@ -148,7 +171,7 @@ struct charger_regulator { | |||
148 | * Specify where information for existance of battery can be obtained | 171 | * Specify where information for existance of battery can be obtained |
149 | * @psy_charger_stat: the names of power-supply for chargers | 172 | * @psy_charger_stat: the names of power-supply for chargers |
150 | * @num_charger_regulator: the number of entries in charger_regulators | 173 | * @num_charger_regulator: the number of entries in charger_regulators |
151 | * @charger_regulators: array of regulator_bulk_data for chargers | 174 | * @charger_regulators: array of charger regulators |
152 | * @psy_fuel_gauge: the name of power-supply for fuel gauge | 175 | * @psy_fuel_gauge: the name of power-supply for fuel gauge |
153 | * @temperature_out_of_range: | 176 | * @temperature_out_of_range: |
154 | * Determine whether the status is overheat or cold or normal. | 177 | * Determine whether the status is overheat or cold or normal. |
@@ -158,6 +181,13 @@ struct charger_regulator { | |||
158 | * @measure_battery_temp: | 181 | * @measure_battery_temp: |
159 | * true: measure battery temperature | 182 | * true: measure battery temperature |
160 | * false: measure ambient temperature | 183 | * false: measure ambient temperature |
184 | * @charging_max_duration_ms: Maximum possible duration for charging | ||
185 | * If whole charging duration exceed 'charging_max_duration_ms', | ||
186 | * cm stop charging. | ||
187 | * @discharging_max_duration_ms: | ||
188 | * Maximum possible duration for discharging with charger cable | ||
189 | * after full-batt. If discharging duration exceed 'discharging | ||
190 | * max_duration_ms', cm start charging. | ||
161 | */ | 191 | */ |
162 | struct charger_desc { | 192 | struct charger_desc { |
163 | char *psy_name; | 193 | char *psy_name; |
@@ -168,6 +198,8 @@ struct charger_desc { | |||
168 | unsigned int fullbatt_vchkdrop_ms; | 198 | unsigned int fullbatt_vchkdrop_ms; |
169 | unsigned int fullbatt_vchkdrop_uV; | 199 | unsigned int fullbatt_vchkdrop_uV; |
170 | unsigned int fullbatt_uV; | 200 | unsigned int fullbatt_uV; |
201 | unsigned int fullbatt_soc; | ||
202 | unsigned int fullbatt_full_capacity; | ||
171 | 203 | ||
172 | enum data_source battery_present; | 204 | enum data_source battery_present; |
173 | 205 | ||
@@ -180,6 +212,9 @@ struct charger_desc { | |||
180 | 212 | ||
181 | int (*temperature_out_of_range)(int *mC); | 213 | int (*temperature_out_of_range)(int *mC); |
182 | bool measure_battery_temp; | 214 | bool measure_battery_temp; |
215 | |||
216 | u64 charging_max_duration_ms; | ||
217 | u64 discharging_max_duration_ms; | ||
183 | }; | 218 | }; |
184 | 219 | ||
185 | #define PSY_NAME_MAX 30 | 220 | #define PSY_NAME_MAX 30 |
@@ -194,8 +229,6 @@ struct charger_desc { | |||
194 | * @charger_enabled: the state of charger | 229 | * @charger_enabled: the state of charger |
195 | * @fullbatt_vchk_jiffies_at: | 230 | * @fullbatt_vchk_jiffies_at: |
196 | * jiffies at the time full battery check will occur. | 231 | * jiffies at the time full battery check will occur. |
197 | * @fullbatt_vchk_uV: voltage in microvolt | ||
198 | * criteria for full battery | ||
199 | * @fullbatt_vchk_work: work queue for full battery check | 232 | * @fullbatt_vchk_work: work queue for full battery check |
200 | * @emergency_stop: | 233 | * @emergency_stop: |
201 | * When setting true, stop charging | 234 | * When setting true, stop charging |
@@ -206,6 +239,8 @@ struct charger_desc { | |||
206 | * saved status of external power before entering suspend-to-RAM | 239 | * saved status of external power before entering suspend-to-RAM |
207 | * @status_save_batt: | 240 | * @status_save_batt: |
208 | * saved status of battery before entering suspend-to-RAM | 241 | * saved status of battery before entering suspend-to-RAM |
242 | * @charging_start_time: saved start time of enabling charging | ||
243 | * @charging_end_time: saved end time of disabling charging | ||
209 | */ | 244 | */ |
210 | struct charger_manager { | 245 | struct charger_manager { |
211 | struct list_head entry; | 246 | struct list_head entry; |
@@ -218,7 +253,6 @@ struct charger_manager { | |||
218 | bool charger_enabled; | 253 | bool charger_enabled; |
219 | 254 | ||
220 | unsigned long fullbatt_vchk_jiffies_at; | 255 | unsigned long fullbatt_vchk_jiffies_at; |
221 | unsigned int fullbatt_vchk_uV; | ||
222 | struct delayed_work fullbatt_vchk_work; | 256 | struct delayed_work fullbatt_vchk_work; |
223 | 257 | ||
224 | int emergency_stop; | 258 | int emergency_stop; |
@@ -229,6 +263,9 @@ struct charger_manager { | |||
229 | 263 | ||
230 | bool status_save_ext_pwr_inserted; | 264 | bool status_save_ext_pwr_inserted; |
231 | bool status_save_batt; | 265 | bool status_save_batt; |
266 | |||
267 | u64 charging_start_time; | ||
268 | u64 charging_end_time; | ||
232 | }; | 269 | }; |
233 | 270 | ||
234 | #ifdef CONFIG_CHARGER_MANAGER | 271 | #ifdef CONFIG_CHARGER_MANAGER |