changed Makefile and profiles, added patches for kernel 2.6.24
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1241-fix-pcf50633-move-charger-enable-decision-to-pcf5063.patch
1 From 2eab6880861e27126d059251f88de92ac3e75eb1 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Tue, 22 Jul 2008 13:16:07 +0100
4 Subject: [PATCH] fix-pcf50633-move-charger-enable-decision-to-pcf50633_usb_curlim_set.patch
5
6 At the moment we ended up enabling and disabling the charger
7 at the time we service USBINS and USBREM events in the ISR.
8
9 We did that in machine specific code, but really it is PMU
10 specific decision, so this patch moves it into PMU code.
11
12 We enabled and disabled the charge immediately we saw the
13 interrupt event from PMU, yet we deferred setting charging
14 state based on ID and USB enumeration until at least after a
15 PMU ADC read that was handled in a second interrupt later.
16
17 Now the timing is unified to after we determined the charger
18 type and we enable and disable right there.
19
20 Signed-off-by: Andy Green <andy@openmoko.com>
21 ---
22  arch/arm/mach-s3c2440/mach-gta02.c |    8 ++------
23  drivers/i2c/chips/pcf50633.c       |    2 ++
24  2 files changed, 4 insertions(+), 6 deletions(-)
25
26 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
27 index f30abb6..59ba890 100644
28 --- a/arch/arm/mach-s3c2440/mach-gta02.c
29 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
30 @@ -481,16 +481,12 @@ static int pmu_callback(struct device *dev, unsigned int feature,
31         switch (feature) {
32         case PCF50633_FEAT_MBC:
33                 switch (event) {
34 -               case PMU_EVT_INSERT:
35                 case PMU_EVT_USB_INSERT:
36 -                       pcf50633_charge_enable(pcf50633_global, 1);
37 -                       break;
38 -               case PMU_EVT_REMOVE:
39                 case PMU_EVT_USB_REMOVE:
40 -                       pcf50633_charge_enable(pcf50633_global, 0);
41 -                       break;
42                 case PMU_EVT_CHARGER_IDLE:
43                 case PMU_EVT_CHARGER_ACTIVE:
44 +               case PMU_EVT_INSERT: /* adapter */
45 +               case PMU_EVT_REMOVE: /* adapter */
46                         break;
47                 default:
48                         break;
49 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
50 index af36e33..d9b78d8 100644
51 --- a/drivers/i2c/chips/pcf50633.c
52 +++ b/drivers/i2c/chips/pcf50633.c
53 @@ -1414,11 +1414,13 @@ void pcf50633_usb_curlim_set(struct pcf50633_data *pcf, int ma)
54                  /* no charging is gonna be happening */
55                 pcf->pdata->cb(&pcf->client.dev,
56                                PCF50633_FEAT_MBC, PMU_EVT_CHARGER_IDLE);
57 +               pcf50633_charge_enable(pcf50633_global, 0);
58                 break;
59         default: /* right charging context that if there is power, we charge */
60                 if (pcf->flags & PCF50633_F_USB_PRESENT)
61                         pcf->pdata->cb(&pcf->client.dev,
62                                PCF50633_FEAT_MBC, PMU_EVT_CHARGER_ACTIVE);
63 +               pcf50633_charge_enable(pcf50633_global, 1);
64                 break;
65         }
66  
67 -- 
68 1.5.6.5
69