[adm5120] add USB drivers for the NFS-101U/WU profiles
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1245-fix-pcf50633-only-do-platform-callback-once-per-even.patch
1 From be0f111b3d1570dec174ff301d08bad995ccf1e6 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Tue, 22 Jul 2008 22:17:15 +0100
4 Subject: [PATCH] fix-pcf50633-only-do-platform-callback-once-per-event.patch
5 Reported-by: Holger Freyther <zecke@openmoko.org>
6
7 We harmlessly repeated PMU platform callbacks about charging state twice.
8 Clean it up and leave it to pcf50633_charge_enable() to report once.
9
10 Also tidies the sequencing so we set current limit before we enable
11 charger now.
12
13 Signed-off-by: Andy Green <andy@openmoko.com>
14 ---
15 drivers/i2c/chips/pcf50633.c | 35 ++++++++++++++++-------------------
16 1 files changed, 16 insertions(+), 19 deletions(-)
17
18 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
19 index bd47ebc..98c254c 100644
20 --- a/drivers/i2c/chips/pcf50633.c
21 +++ b/drivers/i2c/chips/pcf50633.c
22 @@ -1392,6 +1392,7 @@ static DEVICE_ATTR(voltage_hcldo, S_IRUGO | S_IWUSR, show_vreg, set_vreg);
23 static void pcf50633_usb_curlim_set(struct pcf50633_data *pcf, int ma)
24 {
25 u_int8_t bits;
26 + int active = 0;
27
28 pcf->last_curlim_set = ma;
29
30 @@ -1407,30 +1408,26 @@ static void pcf50633_usb_curlim_set(struct pcf50633_data *pcf, int ma)
31 else
32 bits = PCF50633_MBCC7_USB_SUSPEND;
33
34 - DEBUGPC("pcf50633_usb_curlim_set -> %dmA\n", ma);
35 -
36 - if (!pcf->pdata->cb)
37 - goto set_it;
38 + /* set the nearest charging limit */
39 + reg_set_bit_mask(pcf, PCF50633_REG_MBCC7, PCF56033_MBCC7_USB_MASK,
40 + bits);
41
42 + /* with this charging limit, is charging actually meaningful? */
43 switch (bits) {
44 - case PCF50633_MBCC7_USB_100mA:
45 - case PCF50633_MBCC7_USB_SUSPEND:
46 - /* no charging is gonna be happening */
47 - pcf->pdata->cb(&pcf->client.dev,
48 - PCF50633_FEAT_MBC, PMU_EVT_CHARGER_IDLE);
49 - pcf50633_charge_enable(pcf50633_global, 0);
50 + case PCF50633_MBCC7_USB_500mA:
51 + case PCF50633_MBCC7_USB_1000mA:
52 + /* yes with this charging limit, we can do real charging */
53 + active = 1;
54 break;
55 - default: /* right charging context that if there is power, we charge */
56 - if (pcf->flags & PCF50633_F_USB_PRESENT)
57 - pcf->pdata->cb(&pcf->client.dev,
58 - PCF50633_FEAT_MBC, PMU_EVT_CHARGER_ACTIVE);
59 - pcf50633_charge_enable(pcf50633_global, 1);
60 + default:
61 + /* no charging is gonna be happening */
62 break;
63 }
64 -
65 -set_it:
66 - reg_set_bit_mask(pcf, PCF50633_REG_MBCC7, PCF56033_MBCC7_USB_MASK,
67 - bits);
68 + /*
69 + * enable or disable charging according to current limit -- this will
70 + * also throw a platform notification callback about it
71 + */
72 + pcf50633_charge_enable(pcf50633_global, active);
73
74 /* clear batfull */
75 reg_set_bit_mask(pcf, PCF50633_REG_MBCC1,
76 --
77 1.5.6.5
78
This page took 0.047194 seconds and 5 git commands to generate.