1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-27 15:12:25 +02:00
openwrt-xburst/target/linux/s3c24xx/patches-2.6.24/1241-fix-pcf50633-move-charger-enable-decision-to-pcf5063.patch
mirko fc54b9bf15 changed Makefile and profiles, added patches for kernel 2.6.24
(stable-branch of Openmoko)


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13613 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-12-12 11:58:53 +00:00

70 lines
2.4 KiB
Diff

From 2eab6880861e27126d059251f88de92ac3e75eb1 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Tue, 22 Jul 2008 13:16:07 +0100
Subject: [PATCH] fix-pcf50633-move-charger-enable-decision-to-pcf50633_usb_curlim_set.patch
At the moment we ended up enabling and disabling the charger
at the time we service USBINS and USBREM events in the ISR.
We did that in machine specific code, but really it is PMU
specific decision, so this patch moves it into PMU code.
We enabled and disabled the charge immediately we saw the
interrupt event from PMU, yet we deferred setting charging
state based on ID and USB enumeration until at least after a
PMU ADC read that was handled in a second interrupt later.
Now the timing is unified to after we determined the charger
type and we enable and disable right there.
Signed-off-by: Andy Green <andy@openmoko.com>
---
arch/arm/mach-s3c2440/mach-gta02.c | 8 ++------
drivers/i2c/chips/pcf50633.c | 2 ++
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index f30abb6..59ba890 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -481,16 +481,12 @@ static int pmu_callback(struct device *dev, unsigned int feature,
switch (feature) {
case PCF50633_FEAT_MBC:
switch (event) {
- case PMU_EVT_INSERT:
case PMU_EVT_USB_INSERT:
- pcf50633_charge_enable(pcf50633_global, 1);
- break;
- case PMU_EVT_REMOVE:
case PMU_EVT_USB_REMOVE:
- pcf50633_charge_enable(pcf50633_global, 0);
- break;
case PMU_EVT_CHARGER_IDLE:
case PMU_EVT_CHARGER_ACTIVE:
+ case PMU_EVT_INSERT: /* adapter */
+ case PMU_EVT_REMOVE: /* adapter */
break;
default:
break;
diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index af36e33..d9b78d8 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -1414,11 +1414,13 @@ void pcf50633_usb_curlim_set(struct pcf50633_data *pcf, int ma)
/* no charging is gonna be happening */
pcf->pdata->cb(&pcf->client.dev,
PCF50633_FEAT_MBC, PMU_EVT_CHARGER_IDLE);
+ pcf50633_charge_enable(pcf50633_global, 0);
break;
default: /* right charging context that if there is power, we charge */
if (pcf->flags & PCF50633_F_USB_PRESENT)
pcf->pdata->cb(&pcf->client.dev,
PCF50633_FEAT_MBC, PMU_EVT_CHARGER_ACTIVE);
+ pcf50633_charge_enable(pcf50633_global, 1);
break;
}
--
1.5.6.5