aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s3c2440/mach-gta02.c1
-rw-r--r--drivers/power/pcf50633-charger.c18
-rw-r--r--include/linux/mfd/pcf50633/core.h2
3 files changed, 14 insertions, 7 deletions
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 29d35f2e3a7..31759d850fd 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -639,6 +639,7 @@ struct pcf50633_platform_data gta02_pcf_pdata = {
.batteries = gta02_batteries,
.num_batteries = ARRAY_SIZE(gta02_batteries),
+ .charging_restart_interval = (900 * HZ),
.reg_init_data = {
[PCF50633_REGULATOR_AUTO] = {
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 98fb64557e0..1efd7987517 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -172,12 +172,10 @@ static struct attribute_group mbc_attr_group = {
* batteries is marginal(1~2 %) till about 80% of its capacity - which means,
* after a BATFULL, charging won't be restarted until 80%.
*
- * This work_struct function restarts charging every
- * CHARGING_RESTART_TIMEOUT seconds and makes sure we don't discharge too much
+ * This work_struct function restarts charging every few seconds and makes
+ * sure we don't discharge too much
*/
-#define CHARGING_RESTART_TIMEOUT (900 * HZ) /* 15 minutes */
-
static void pcf50633_mbc_charging_restart(struct work_struct *work)
{
struct pcf50633_mbc *mbc;
@@ -205,6 +203,8 @@ static void
pcf50633_mbc_irq_handler(int irq, void *data)
{
struct pcf50633_mbc *mbc = data;
+ int chg_restart_interval =
+ mbc->pcf->pdata->charging_restart_interval;
/* USB */
if (irq == PCF50633_IRQ_USBINS) {
@@ -212,7 +212,7 @@ pcf50633_mbc_irq_handler(int irq, void *data)
} else if (irq == PCF50633_IRQ_USBREM) {
mbc->usb_online = 0;
mbc->usb_active = 0;
- pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
+ pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
cancel_delayed_work_sync(&mbc->charging_restart_work);
}
@@ -228,8 +228,10 @@ pcf50633_mbc_irq_handler(int irq, void *data)
if (irq == PCF50633_IRQ_BATFULL) {
mbc->usb_active = 0;
mbc->adapter_active = 0;
- schedule_delayed_work(&mbc->charging_restart_work,
- CHARGING_RESTART_TIMEOUT);
+
+ if (chg_restart_interval > 0)
+ schedule_delayed_work(&mbc->charging_restart_work,
+ chg_restart_interval);
} else if (irq == PCF50633_IRQ_USBLIMON)
mbc->usb_active = 0;
else if (irq == PCF50633_IRQ_USBLIMOFF)
@@ -419,6 +421,8 @@ static int __devexit pcf50633_mbc_remove(struct platform_device *pdev)
power_supply_unregister(&mbc->usb);
power_supply_unregister(&mbc->adapter);
+ cancel_delayed_work_sync(&mbc->charging_restart_work);
+
kfree(mbc);
return 0;
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 2269f3ba7a4..b7a891bf9e0 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -29,6 +29,8 @@ struct pcf50633_platform_data {
char **batteries;
int num_batteries;
+ int charging_restart_interval;
+
/* Callbacks */
void (*probe_done)(struct pcf50633 *);
void (*mbc_event_callback)(struct pcf50633 *, int);