[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1162-fix-reduce-wake-reasons-in-pcf50633.patch.patch
1 From 57351c5a1f03e9ae884b094ddbde27b1ad6ed8e0 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Mon, 26 May 2008 12:39:29 +0100
4 Subject: [PATCH] fix-reduce-wake-reasons-in-pcf50633.patch
5
6 Currently we are willing to wake from sleep from
7 pcf50633 interrupts we don't actually do anything about
8 even when we wake (somewhat puzzled).
9
10 Let's disable some of these wake sources.
11
12 Signed-off-by: Andy Green <andy@openmoko.com>
13 ---
14 arch/arm/mach-s3c2440/mach-gta02.c | 20 +++++++++++++
15 drivers/i2c/chips/pcf50633.c | 28 ++++--------------
16 drivers/i2c/chips/pcf50633.h | 53 ----------------------------------
17 include/linux/pcf50633.h | 56 ++++++++++++++++++++++++++++++++++++
18 4 files changed, 82 insertions(+), 75 deletions(-)
19
20 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
21 index 90b62c1..601f7bc 100644
22 --- a/arch/arm/mach-s3c2440/mach-gta02.c
23 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
24 @@ -462,6 +462,26 @@ static struct pcf50633_platform_data gta02_pcf_pdata = {
25 .r_fix_batt = 10000,
26 .r_fix_batt_par = 10000,
27 .r_sense_milli = 220,
28 + .resumers = {
29 + [0] = /* PCF50633_INT1_ADPINS | */
30 + /* PCF50633_INT1_ADPREM | */
31 + PCF50633_INT1_USBINS |
32 + PCF50633_INT1_USBREM |
33 + PCF50633_INT1_ALARM,
34 + [1] = PCF50633_INT2_ONKEYF,
35 + [2] = /* PCF50633_INT3_BATFULL | */
36 + /* PCF50633_INT3_CHGHALT | */
37 + /* PCF50633_INT3_THLIMON | */
38 + /* PCF50633_INT3_THLIMOFF | */
39 + /* PCF50633_INT3_USBLIMON | */
40 + /* PCF50633_INT3_USBLIMOFF | */
41 + PCF50633_INT3_ONKEY1S ,
42 + [3] = 0 /* |
43 + PCF50633_INT4_LOWSYS | */
44 + /* PCF50633_INT4_LOWBAT | */
45 + /* PCF50633_INT4_HIGHTMP */,
46 + [4] = 0
47 + },
48 .rails = {
49 [PCF50633_REGULATOR_AUTO] = {
50 .name = "io_3v3",
51 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
52 index 6d07aa5..2878baa 100644
53 --- a/drivers/i2c/chips/pcf50633.c
54 +++ b/drivers/i2c/chips/pcf50633.c
55 @@ -1945,23 +1945,7 @@ int pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf)
56
57
58 #ifdef CONFIG_PM
59 -#define INT1M_RESUMERS (PCF50633_INT1_ADPINS | \
60 - PCF50633_INT1_ADPREM | \
61 - PCF50633_INT1_USBINS | \
62 - PCF50633_INT1_USBREM | \
63 - PCF50633_INT1_ALARM)
64 -#define INT2M_RESUMERS (PCF50633_INT2_ONKEYF)
65 -#define INT3M_RESUMERS (PCF50633_INT3_BATFULL | \
66 - PCF50633_INT3_CHGHALT | \
67 - PCF50633_INT3_THLIMON | \
68 - PCF50633_INT3_THLIMOFF | \
69 - PCF50633_INT3_USBLIMON | \
70 - PCF50633_INT3_USBLIMOFF | \
71 - PCF50633_INT3_ONKEY1S)
72 -#define INT4M_RESUMERS (PCF50633_INT4_LOWSYS | \
73 - PCF50633_INT4_LOWBAT | \
74 - PCF50633_INT4_HIGHTMP)
75 -#define INT5M_RESUMERS (0)
76 +
77
78 static int pcf50633_suspend(struct device *dev, pm_message_t state)
79 {
80 @@ -2020,11 +2004,11 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
81 pcf->standby_regs.int3m = __reg_read(pcf, PCF50633_REG_INT3M);
82 pcf->standby_regs.int4m = __reg_read(pcf, PCF50633_REG_INT4M);
83 pcf->standby_regs.int5m = __reg_read(pcf, PCF50633_REG_INT5M);
84 - __reg_write(pcf, PCF50633_REG_INT1M, ~INT1M_RESUMERS & 0xff);
85 - __reg_write(pcf, PCF50633_REG_INT2M, ~INT2M_RESUMERS & 0xff);
86 - __reg_write(pcf, PCF50633_REG_INT3M, ~INT3M_RESUMERS & 0xff);
87 - __reg_write(pcf, PCF50633_REG_INT4M, ~INT4M_RESUMERS & 0xff);
88 - __reg_write(pcf, PCF50633_REG_INT5M, ~INT5M_RESUMERS & 0xff);
89 + __reg_write(pcf, PCF50633_REG_INT1M, ~pcf->pdata->resumers[0]);
90 + __reg_write(pcf, PCF50633_REG_INT2M, ~pcf->pdata->resumers[1]);
91 + __reg_write(pcf, PCF50633_REG_INT3M, ~pcf->pdata->resumers[2]);
92 + __reg_write(pcf, PCF50633_REG_INT4M, ~pcf->pdata->resumers[3]);
93 + __reg_write(pcf, PCF50633_REG_INT5M, ~pcf->pdata->resumers[4]);
94
95 pcf->have_been_suspended = 1;
96
97 diff --git a/drivers/i2c/chips/pcf50633.h b/drivers/i2c/chips/pcf50633.h
98 index 93dfd99..5d54131 100644
99 --- a/drivers/i2c/chips/pcf50633.h
100 +++ b/drivers/i2c/chips/pcf50633.h
101 @@ -125,59 +125,6 @@ enum pfc50633_regs {
102 __NUM_PCF50633_REGS
103 };
104
105 -enum pcf50633_reg_int1 {
106 - PCF50633_INT1_ADPINS = 0x01, /* Adapter inserted */
107 - PCF50633_INT1_ADPREM = 0x02, /* Adapter removed */
108 - PCF50633_INT1_USBINS = 0x04, /* USB inserted */
109 - PCF50633_INT1_USBREM = 0x08, /* USB removed */
110 - /* reserved */
111 - PCF50633_INT1_ALARM = 0x40, /* RTC alarm time is reached */
112 - PCF50633_INT1_SECOND = 0x80, /* RTC periodic second interrupt */
113 -};
114 -
115 -enum pcf50633_reg_int2 {
116 - PCF50633_INT2_ONKEYR = 0x01, /* ONKEY rising edge */
117 - PCF50633_INT2_ONKEYF = 0x02, /* ONKEY falling edge */
118 - PCF50633_INT2_EXTON1R = 0x04, /* EXTON1 rising edge */
119 - PCF50633_INT2_EXTON1F = 0x08, /* EXTON1 falling edge */
120 - PCF50633_INT2_EXTON2R = 0x10, /* EXTON2 rising edge */
121 - PCF50633_INT2_EXTON2F = 0x20, /* EXTON2 falling edge */
122 - PCF50633_INT2_EXTON3R = 0x40, /* EXTON3 rising edge */
123 - PCF50633_INT2_EXTON3F = 0x80, /* EXTON3 falling edge */
124 -};
125 -
126 -enum pcf50633_reg_int3 {
127 - PCF50633_INT3_BATFULL = 0x01, /* Battery full */
128 - PCF50633_INT3_CHGHALT = 0x02, /* Charger halt */
129 - PCF50633_INT3_THLIMON = 0x04,
130 - PCF50633_INT3_THLIMOFF = 0x08,
131 - PCF50633_INT3_USBLIMON = 0x10,
132 - PCF50633_INT3_USBLIMOFF = 0x20,
133 - PCF50633_INT3_ADCRDY = 0x40, /* ADC conversion finished */
134 - PCF50633_INT3_ONKEY1S = 0x80, /* ONKEY pressed 1 second */
135 -};
136 -
137 -enum pcf50633_reg_int4 {
138 - PCF50633_INT4_LOWSYS = 0x01,
139 - PCF50633_INT4_LOWBAT = 0x02,
140 - PCF50633_INT4_HIGHTMP = 0x04,
141 - PCF50633_INT4_AUTOPWRFAIL = 0x08,
142 - PCF50633_INT4_DWN1PWRFAIL = 0x10,
143 - PCF50633_INT4_DWN2PWRFAIL = 0x20,
144 - PCF50633_INT4_LEDPWRFAIL = 0x40,
145 - PCF50633_INT4_LEDOVP = 0x80,
146 -};
147 -
148 -enum pcf50633_reg_int5 {
149 - PCF50633_INT5_LDO1PWRFAIL = 0x01,
150 - PCF50633_INT5_LDO2PWRFAIL = 0x02,
151 - PCF50633_INT5_LDO3PWRFAIL = 0x04,
152 - PCF50633_INT5_LDO4PWRFAIL = 0x08,
153 - PCF50633_INT5_LDO5PWRFAIL = 0x10,
154 - PCF50633_INT5_LDO6PWRFAIL = 0x20,
155 - PCF50633_INT5_HCLDOPWRFAIL = 0x40,
156 - PCF50633_INT5_HCLDOOVL = 0x80,
157 -};
158
159 enum pcf50633_reg_oocshdwn {
160 PCF50633_OOCSHDWN_GOSTDBY = 0x01,
161 diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
162 index be3957f..837037e 100644
163 --- a/include/linux/pcf50633.h
164 +++ b/include/linux/pcf50633.h
165 @@ -20,6 +20,60 @@ enum pcf50633_regulator_id {
166 __NUM_PCF50633_REGULATORS
167 };
168
169 +enum pcf50633_reg_int1 {
170 + PCF50633_INT1_ADPINS = 0x01, /* Adapter inserted */
171 + PCF50633_INT1_ADPREM = 0x02, /* Adapter removed */
172 + PCF50633_INT1_USBINS = 0x04, /* USB inserted */
173 + PCF50633_INT1_USBREM = 0x08, /* USB removed */
174 + /* reserved */
175 + PCF50633_INT1_ALARM = 0x40, /* RTC alarm time is reached */
176 + PCF50633_INT1_SECOND = 0x80, /* RTC periodic second interrupt */
177 +};
178 +
179 +enum pcf50633_reg_int2 {
180 + PCF50633_INT2_ONKEYR = 0x01, /* ONKEY rising edge */
181 + PCF50633_INT2_ONKEYF = 0x02, /* ONKEY falling edge */
182 + PCF50633_INT2_EXTON1R = 0x04, /* EXTON1 rising edge */
183 + PCF50633_INT2_EXTON1F = 0x08, /* EXTON1 falling edge */
184 + PCF50633_INT2_EXTON2R = 0x10, /* EXTON2 rising edge */
185 + PCF50633_INT2_EXTON2F = 0x20, /* EXTON2 falling edge */
186 + PCF50633_INT2_EXTON3R = 0x40, /* EXTON3 rising edge */
187 + PCF50633_INT2_EXTON3F = 0x80, /* EXTON3 falling edge */
188 +};
189 +
190 +enum pcf50633_reg_int3 {
191 + PCF50633_INT3_BATFULL = 0x01, /* Battery full */
192 + PCF50633_INT3_CHGHALT = 0x02, /* Charger halt */
193 + PCF50633_INT3_THLIMON = 0x04,
194 + PCF50633_INT3_THLIMOFF = 0x08,
195 + PCF50633_INT3_USBLIMON = 0x10,
196 + PCF50633_INT3_USBLIMOFF = 0x20,
197 + PCF50633_INT3_ADCRDY = 0x40, /* ADC conversion finished */
198 + PCF50633_INT3_ONKEY1S = 0x80, /* ONKEY pressed 1 second */
199 +};
200 +
201 +enum pcf50633_reg_int4 {
202 + PCF50633_INT4_LOWSYS = 0x01,
203 + PCF50633_INT4_LOWBAT = 0x02,
204 + PCF50633_INT4_HIGHTMP = 0x04,
205 + PCF50633_INT4_AUTOPWRFAIL = 0x08,
206 + PCF50633_INT4_DWN1PWRFAIL = 0x10,
207 + PCF50633_INT4_DWN2PWRFAIL = 0x20,
208 + PCF50633_INT4_LEDPWRFAIL = 0x40,
209 + PCF50633_INT4_LEDOVP = 0x80,
210 +};
211 +
212 +enum pcf50633_reg_int5 {
213 + PCF50633_INT5_LDO1PWRFAIL = 0x01,
214 + PCF50633_INT5_LDO2PWRFAIL = 0x02,
215 + PCF50633_INT5_LDO3PWRFAIL = 0x04,
216 + PCF50633_INT5_LDO4PWRFAIL = 0x08,
217 + PCF50633_INT5_LDO5PWRFAIL = 0x10,
218 + PCF50633_INT5_LDO6PWRFAIL = 0x20,
219 + PCF50633_INT5_HCLDOPWRFAIL = 0x40,
220 + PCF50633_INT5_HCLDOOVL = 0x80,
221 +};
222 +
223 struct pcf50633_data;
224 extern struct pcf50633_data *pcf50633_global;
225
226 @@ -95,6 +149,8 @@ struct pcf50633_platform_data {
227 unsigned int r_fix_batt_par;
228 unsigned int r_sense_milli;
229
230 + unsigned char resumers[5];
231 +
232 struct {
233 u_int8_t mbcc3; /* charger voltage / current */
234 } charger;
235 --
236 1.5.6.5
237
This page took 0.052066 seconds and 5 git commands to generate.