aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2009-11-04 16:24:57 -0500
committerAnton Vorontsov <cbouatmailru@gmail.com>2009-11-15 19:31:17 -0500
commite98c73a24f33d6f54402f5cef2e7bf282d1d1fcc (patch)
tree8c11a30ac8d3d8f8f96bee76d8bac40c7d6b8f43 /drivers/power
parent31b4ff06e01a9a98a8e6ae6e8c42213648eec1d1 (diff)
pcf50633: Get rid of charging restart software auto-triggering
After reaching Battery Full condition MBC state machine switches back into charging mode when the battery voltage falls below 96% of a battery float voltage. The voltage drop in Li-Ion batteries is marginal (1-2%) till about 80% of its capacity - which means, after a BATFULL, charging won't be restarted until 75-80%. That is a desired behaviour recommended by battery manufacturers, don't mess with it. Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pcf50633-charger.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 21b6e64e7805..338311996eea 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -37,8 +37,6 @@ struct pcf50633_mbc {
37 struct power_supply usb; 37 struct power_supply usb;
38 struct power_supply adapter; 38 struct power_supply adapter;
39 struct power_supply ac; 39 struct power_supply ac;
40
41 struct delayed_work charging_restart_work;
42}; 40};
43 41
44int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma) 42int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
@@ -236,44 +234,10 @@ static struct attribute_group mbc_attr_group = {
236 .attrs = pcf50633_mbc_sysfs_entries, 234 .attrs = pcf50633_mbc_sysfs_entries,
237}; 235};
238 236
239/* MBC state machine switches into charging mode when the battery voltage
240 * falls below 96% of a battery float voltage. But the voltage drop in Li-ion
241 * batteries is marginal(1~2 %) till about 80% of its capacity - which means,
242 * after a BATFULL, charging won't be restarted until 80%.
243 *
244 * This work_struct function restarts charging at regular intervals to make
245 * sure we don't discharge too much
246 */
247
248static void pcf50633_mbc_charging_restart(struct work_struct *work)
249{
250 struct pcf50633_mbc *mbc;
251 u8 mbcs2, chgmod;
252
253 mbc = container_of(work, struct pcf50633_mbc,
254 charging_restart_work.work);
255
256 mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2);
257 chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK);
258
259 if (chgmod != PCF50633_MBCS2_MBC_BAT_FULL)
260 return;
261
262 /* Restart charging */
263 pcf50633_reg_set_bit_mask(mbc->pcf, PCF50633_REG_MBCC1,
264 PCF50633_MBCC1_RESUME, PCF50633_MBCC1_RESUME);
265 mbc->usb_active = 1;
266 power_supply_changed(&mbc->usb);
267
268 dev_info(mbc->pcf->dev, "Charging restarted\n");
269}
270
271static void 237static void
272pcf50633_mbc_irq_handler(int irq, void *data) 238pcf50633_mbc_irq_handler(int irq, void *data)
273{ 239{
274 struct pcf50633_mbc *mbc = data; 240 struct pcf50633_mbc *mbc = data;
275 int chg_restart_interval =
276 mbc->pcf->pdata->charging_restart_interval;
277 241
278 /* USB */ 242 /* USB */
279 if (irq == PCF50633_IRQ_USBINS) { 243 if (irq == PCF50633_IRQ_USBINS) {
@@ -282,7 +246,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
282 mbc->usb_online = 0; 246 mbc->usb_online = 0;
283 mbc->usb_active = 0; 247 mbc->usb_active = 0;
284 pcf50633_mbc_usb_curlim_set(mbc->pcf, 0); 248 pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
285 cancel_delayed_work_sync(&mbc->charging_restart_work);
286 } 249 }
287 250
288 /* Adapter */ 251 /* Adapter */
@@ -297,10 +260,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
297 if (irq == PCF50633_IRQ_BATFULL) { 260 if (irq == PCF50633_IRQ_BATFULL) {
298 mbc->usb_active = 0; 261 mbc->usb_active = 0;
299 mbc->adapter_active = 0; 262 mbc->adapter_active = 0;
300
301 if (chg_restart_interval > 0)
302 schedule_delayed_work(&mbc->charging_restart_work,
303 chg_restart_interval);
304 } else if (irq == PCF50633_IRQ_USBLIMON) 263 } else if (irq == PCF50633_IRQ_USBLIMON)
305 mbc->usb_active = 0; 264 mbc->usb_active = 0;
306 else if (irq == PCF50633_IRQ_USBLIMOFF) 265 else if (irq == PCF50633_IRQ_USBLIMOFF)
@@ -463,9 +422,6 @@ static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
463 return ret; 422 return ret;
464 } 423 }
465 424
466 INIT_DELAYED_WORK(&mbc->charging_restart_work,
467 pcf50633_mbc_charging_restart);
468
469 ret = sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group); 425 ret = sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group);
470 if (ret) 426 if (ret)
471 dev_err(mbc->pcf->dev, "failed to create sysfs entries\n"); 427 dev_err(mbc->pcf->dev, "failed to create sysfs entries\n");
@@ -492,8 +448,6 @@ static int __devexit pcf50633_mbc_remove(struct platform_device *pdev)
492 power_supply_unregister(&mbc->adapter); 448 power_supply_unregister(&mbc->adapter);
493 power_supply_unregister(&mbc->ac); 449 power_supply_unregister(&mbc->ac);
494 450
495 cancel_delayed_work_sync(&mbc->charging_restart_work);
496
497 kfree(mbc); 451 kfree(mbc);
498 452
499 return 0; 453 return 0;