From: Paul Fertser <fercerpav@gmail.com>
To: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
Paul Fertser <fercerpav@gmail.com>
Subject: [PATCH 4/6] power: pcf50633: get rid of charging restart software auto-triggering
Date: Thu, 5 Nov 2009 00:24:57 +0300 [thread overview]
Message-ID: <1257369899-325-4-git-send-email-fercerpav@gmail.com> (raw)
In-Reply-To: <1257369899-325-3-git-send-email-fercerpav@gmail.com>
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>
---
drivers/power/pcf50633-charger.c | 46 -------------------------------------
include/linux/mfd/pcf50633/core.h | 2 -
2 files changed, 0 insertions(+), 48 deletions(-)
diff --git a/drivers/power/pcf50633-charger.c b/drivers/power/pcf50633-charger.c
index 21b6e64..3383119 100644
--- a/drivers/power/pcf50633-charger.c
+++ b/drivers/power/pcf50633-charger.c
@@ -37,8 +37,6 @@ struct pcf50633_mbc {
struct power_supply usb;
struct power_supply adapter;
struct power_supply ac;
-
- struct delayed_work charging_restart_work;
};
int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma)
@@ -236,44 +234,10 @@ static struct attribute_group mbc_attr_group = {
.attrs = pcf50633_mbc_sysfs_entries,
};
-/* MBC state machine switches into charging mode when the battery voltage
- * falls below 96% of a battery float voltage. But 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 80%.
- *
- * This work_struct function restarts charging at regular intervals to make
- * sure we don't discharge too much
- */
-
-static void pcf50633_mbc_charging_restart(struct work_struct *work)
-{
- struct pcf50633_mbc *mbc;
- u8 mbcs2, chgmod;
-
- mbc = container_of(work, struct pcf50633_mbc,
- charging_restart_work.work);
-
- mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2);
- chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK);
-
- if (chgmod != PCF50633_MBCS2_MBC_BAT_FULL)
- return;
-
- /* Restart charging */
- pcf50633_reg_set_bit_mask(mbc->pcf, PCF50633_REG_MBCC1,
- PCF50633_MBCC1_RESUME, PCF50633_MBCC1_RESUME);
- mbc->usb_active = 1;
- power_supply_changed(&mbc->usb);
-
- dev_info(mbc->pcf->dev, "Charging restarted\n");
-}
-
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) {
@@ -282,7 +246,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
mbc->usb_online = 0;
mbc->usb_active = 0;
pcf50633_mbc_usb_curlim_set(mbc->pcf, 0);
- cancel_delayed_work_sync(&mbc->charging_restart_work);
}
/* Adapter */
@@ -297,10 +260,6 @@ pcf50633_mbc_irq_handler(int irq, void *data)
if (irq == PCF50633_IRQ_BATFULL) {
mbc->usb_active = 0;
mbc->adapter_active = 0;
-
- 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)
@@ -463,9 +422,6 @@ static int __devinit pcf50633_mbc_probe(struct platform_device *pdev)
return ret;
}
- INIT_DELAYED_WORK(&mbc->charging_restart_work,
- pcf50633_mbc_charging_restart);
-
ret = sysfs_create_group(&pdev->dev.kobj, &mbc_attr_group);
if (ret)
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)
power_supply_unregister(&mbc->adapter);
power_supply_unregister(&mbc->ac);
- 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 09af8fd..46df7f0 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -29,8 +29,6 @@ struct pcf50633_platform_data {
char **batteries;
int num_batteries;
- int charging_restart_interval;
-
/*
* Should be set accordingly to the reference resistor used, see
* I_{ch(ref)} charger reference current in the pcf50633 User
--
1.6.4.4
next prev parent reply other threads:[~2009-11-04 21:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 21:24 [PATCH 1/6] power: pcf50633: add ac power supply class to the charger Paul Fertser
2009-11-04 21:24 ` [PATCH 2/6] power: pcf50633: introduces battery charging current control Paul Fertser
2009-11-04 21:24 ` [PATCH 3/6] gta02: set pcf50633 charger_reference_current_ma Paul Fertser
2009-11-04 21:24 ` Paul Fertser [this message]
2009-11-04 21:24 ` [PATCH 5/6] power: pcf50633: properly reenable charging when the supply conditions change Paul Fertser
2009-11-04 21:24 ` [PATCH 6/6] power: pcf50633: query charger status directly Paul Fertser
2009-11-04 21:46 ` [PATCH 5/6] power: pcf50633: properly reenable charging when the supply conditions change Pavel Machek
2009-11-04 22:24 ` Paul Fertser
2009-11-04 23:16 ` Pavel Machek
2009-11-04 23:45 ` Anton Vorontsov
2009-11-04 23:56 ` Pavel Machek
2009-11-11 13:48 ` [PATCH 3/6] gta02: set pcf50633 charger_reference_current_ma Paul Fertser
2009-11-11 15:31 ` Anton Vorontsov
2009-11-12 7:40 ` Pavel Machek
2009-11-12 21:59 ` Russell King - ARM Linux
2009-11-13 18:26 ` Pavel Machek
2009-11-16 1:00 ` Anton Vorontsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1257369899-325-4-git-send-email-fercerpav@gmail.com \
--to=fercerpav@gmail.com \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox