aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/pcf50633-charger.c46
-rw-r--r--include/linux/mfd/pcf50633/core.h2
2 files changed, 0 insertions, 48 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;
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 09af8fdfbb5d..46df7f053c29 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -29,8 +29,6 @@ struct pcf50633_platform_data {
29 char **batteries; 29 char **batteries;
30 int num_batteries; 30 int num_batteries;
31 31
32 int charging_restart_interval;
33
34 /* 32 /*
35 * Should be set accordingly to the reference resistor used, see 33 * Should be set accordingly to the reference resistor used, see
36 * I_{ch(ref)} charger reference current in the pcf50633 User 34 * I_{ch(ref)} charger reference current in the pcf50633 User