summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.26/0143-fix-reduce-wake-reasons-in-pcf50633.patch.patch
blob: 73cdb830dfe299850c60f4c0da590606bae8821c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
From 84a38fd3678b3473c890f7e1b1d7b697afb142a7 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 25 Jul 2008 23:06:10 +0100
Subject: [PATCH] fix-reduce-wake-reasons-in-pcf50633.patch

Currently we are willing to wake from sleep from
pcf50633 interrupts we don't actually do anything about
even when we wake (somewhat puzzled).

Let's disable some of these wake sources.

Signed-off-by: Andy Green <andy@openmoko.com>
---
 arch/arm/mach-s3c2440/mach-gta02.c |   20 +++++++++++++
 drivers/i2c/chips/pcf50633.c       |   28 ++++--------------
 drivers/i2c/chips/pcf50633.h       |   53 ----------------------------------
 include/linux/pcf50633.h           |   56 ++++++++++++++++++++++++++++++++++++
 4 files changed, 82 insertions(+), 75 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 90b62c1..601f7bc 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -462,6 +462,26 @@ static struct pcf50633_platform_data gta02_pcf_pdata = {
 	.r_fix_batt	= 10000,
 	.r_fix_batt_par	= 10000,
 	.r_sense_milli	= 220,
+	.resumers = {
+		[0] = /* PCF50633_INT1_ADPINS 	| */
+		  /* PCF50633_INT1_ADPREM	| */
+		  PCF50633_INT1_USBINS		|
+		  PCF50633_INT1_USBREM		|
+		  PCF50633_INT1_ALARM,
+		[1] = PCF50633_INT2_ONKEYF,
+		[2] =  /* PCF50633_INT3_BATFULL	| */
+		  /* PCF50633_INT3_CHGHALT	| */
+		  /* PCF50633_INT3_THLIMON	| */
+		  /* PCF50633_INT3_THLIMOFF	| */
+		  /* PCF50633_INT3_USBLIMON	| */
+		  /* PCF50633_INT3_USBLIMOFF	| */
+		  PCF50633_INT3_ONKEY1S ,
+		[3] = 0				/* |
+		     PCF50633_INT4_LOWSYS	| */
+		  /* PCF50633_INT4_LOWBAT	| */
+		  /* PCF50633_INT4_HIGHTMP */,
+		[4] = 0
+	},
 	.rails	= {
 		[PCF50633_REGULATOR_AUTO] = {
 			.name		= "io_3v3",
diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index d2ff2c1..8ba81d2 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -1935,23 +1935,7 @@ int pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf)
 
 
 #ifdef CONFIG_PM
-#define INT1M_RESUMERS	(PCF50633_INT1_ADPINS		| \
-			 PCF50633_INT1_ADPREM		| \
-			 PCF50633_INT1_USBINS		| \
-			 PCF50633_INT1_USBREM		| \
-			 PCF50633_INT1_ALARM)
-#define INT2M_RESUMERS	(PCF50633_INT2_ONKEYF)
-#define INT3M_RESUMERS	(PCF50633_INT3_BATFULL		| \
-			 PCF50633_INT3_CHGHALT		| \
-			 PCF50633_INT3_THLIMON		| \
-			 PCF50633_INT3_THLIMOFF		| \
-			 PCF50633_INT3_USBLIMON		| \
-			 PCF50633_INT3_USBLIMOFF	| \
-			 PCF50633_INT3_ONKEY1S)
-#define INT4M_RESUMERS	(PCF50633_INT4_LOWSYS		| \
-			 PCF50633_INT4_LOWBAT		| \
-			 PCF50633_INT4_HIGHTMP)
-#define INT5M_RESUMERS	(0)
+
 
 static int pcf50633_suspend(struct device *dev, pm_message_t state)
 {
@@ -2010,11 +1994,11 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
 	pcf->standby_regs.int3m = __reg_read(pcf, PCF50633_REG_INT3M);
 	pcf->standby_regs.int4m = __reg_read(pcf, PCF50633_REG_INT4M);
 	pcf->standby_regs.int5m = __reg_read(pcf, PCF50633_REG_INT5M);
-	__reg_write(pcf, PCF50633_REG_INT1M, ~INT1M_RESUMERS & 0xff);
-	__reg_write(pcf, PCF50633_REG_INT2M, ~INT2M_RESUMERS & 0xff);
-	__reg_write(pcf, PCF50633_REG_INT3M, ~INT3M_RESUMERS & 0xff);
-	__reg_write(pcf, PCF50633_REG_INT4M, ~INT4M_RESUMERS & 0xff);
-	__reg_write(pcf, PCF50633_REG_INT5M, ~INT5M_RESUMERS & 0xff);
+	__reg_write(pcf, PCF50633_REG_INT1M, ~pcf->pdata->resumers[0]);
+	__reg_write(pcf, PCF50633_REG_INT2M, ~pcf->pdata->resumers[1]);
+	__reg_write(pcf, PCF50633_REG_INT3M, ~pcf->pdata->resumers[2]);
+	__reg_write(pcf, PCF50633_REG_INT4M, ~pcf->pdata->resumers[3]);
+	__reg_write(pcf, PCF50633_REG_INT5M, ~pcf->pdata->resumers[4]);
 
 	pcf->have_been_suspended = 1;
 
diff --git a/drivers/i2c/chips/pcf50633.h b/drivers/i2c/chips/pcf50633.h
index 93dfd99..5d54131 100644
--- a/drivers/i2c/chips/pcf50633.h
+++ b/drivers/i2c/chips/pcf50633.h
@@ -125,59 +125,6 @@ enum pfc50633_regs {
 	__NUM_PCF50633_REGS
 };
 
-enum pcf50633_reg_int1 {
-	PCF50633_INT1_ADPINS	= 0x01,	/* Adapter inserted */
-	PCF50633_INT1_ADPREM	= 0x02,	/* Adapter removed */
-	PCF50633_INT1_USBINS	= 0x04,	/* USB inserted */
-	PCF50633_INT1_USBREM	= 0x08,	/* USB removed */
-	/* reserved */
-	PCF50633_INT1_ALARM	= 0x40, /* RTC alarm time is reached */
-	PCF50633_INT1_SECOND	= 0x80,	/* RTC periodic second interrupt */
-};
-
-enum pcf50633_reg_int2 {
-	PCF50633_INT2_ONKEYR	= 0x01, /* ONKEY rising edge */
-	PCF50633_INT2_ONKEYF	= 0x02, /* ONKEY falling edge */
-	PCF50633_INT2_EXTON1R	= 0x04, /* EXTON1 rising edge */
-	PCF50633_INT2_EXTON1F	= 0x08, /* EXTON1 falling edge */
-	PCF50633_INT2_EXTON2R	= 0x10, /* EXTON2 rising edge */
-	PCF50633_INT2_EXTON2F	= 0x20, /* EXTON2 falling edge */
-	PCF50633_INT2_EXTON3R	= 0x40, /* EXTON3 rising edge */
-	PCF50633_INT2_EXTON3F	= 0x80, /* EXTON3 falling edge */
-};
-
-enum pcf50633_reg_int3 {
-	PCF50633_INT3_BATFULL	= 0x01, /* Battery full */
-	PCF50633_INT3_CHGHALT	= 0x02,	/* Charger halt */
-	PCF50633_INT3_THLIMON	= 0x04,
-	PCF50633_INT3_THLIMOFF	= 0x08,
-	PCF50633_INT3_USBLIMON	= 0x10,
-	PCF50633_INT3_USBLIMOFF	= 0x20,
-	PCF50633_INT3_ADCRDY	= 0x40,	/* ADC conversion finished */
-	PCF50633_INT3_ONKEY1S	= 0x80,	/* ONKEY pressed 1 second */
-};
-
-enum pcf50633_reg_int4 {
-	PCF50633_INT4_LOWSYS		= 0x01,
-	PCF50633_INT4_LOWBAT		= 0x02,
-	PCF50633_INT4_HIGHTMP		= 0x04,
-	PCF50633_INT4_AUTOPWRFAIL	= 0x08,
-	PCF50633_INT4_DWN1PWRFAIL	= 0x10,
-	PCF50633_INT4_DWN2PWRFAIL	= 0x20,
-	PCF50633_INT4_LEDPWRFAIL	= 0x40,
-	PCF50633_INT4_LEDOVP		= 0x80,
-};
-
-enum pcf50633_reg_int5 {
-	PCF50633_INT5_LDO1PWRFAIL	= 0x01,
-	PCF50633_INT5_LDO2PWRFAIL	= 0x02,
-	PCF50633_INT5_LDO3PWRFAIL	= 0x04,
-	PCF50633_INT5_LDO4PWRFAIL	= 0x08,
-	PCF50633_INT5_LDO5PWRFAIL	= 0x10,
-	PCF50633_INT5_LDO6PWRFAIL	= 0x20,
-	PCF50633_INT5_HCLDOPWRFAIL	= 0x40,
-	PCF50633_INT5_HCLDOOVL		= 0x80,
-};
 
 enum pcf50633_reg_oocshdwn {
 	PCF50633_OOCSHDWN_GOSTDBY	= 0x01,
diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
index 39d919d..c0fdbe8 100644
--- a/include/linux/pcf50633.h
+++ b/include/linux/pcf50633.h
@@ -20,6 +20,60 @@ enum pcf50633_regulator_id {
 	__NUM_PCF50633_REGULATORS
 };
 
+enum pcf50633_reg_int1 {
+	PCF50633_INT1_ADPINS	= 0x01,	/* Adapter inserted */
+	PCF50633_INT1_ADPREM	= 0x02,	/* Adapter removed */
+	PCF50633_INT1_USBINS	= 0x04,	/* USB inserted */
+	PCF50633_INT1_USBREM	= 0x08,	/* USB removed */
+	/* reserved */
+	PCF50633_INT1_ALARM	= 0x40, /* RTC alarm time is reached */
+	PCF50633_INT1_SECOND	= 0x80,	/* RTC periodic second interrupt */
+};
+
+enum pcf50633_reg_int2 {
+	PCF50633_INT2_ONKEYR	= 0x01, /* ONKEY rising edge */
+	PCF50633_INT2_ONKEYF	= 0x02, /* ONKEY falling edge */
+	PCF50633_INT2_EXTON1R	= 0x04, /* EXTON1 rising edge */
+	PCF50633_INT2_EXTON1F	= 0x08, /* EXTON1 falling edge */
+	PCF50633_INT2_EXTON2R	= 0x10, /* EXTON2 rising edge */
+	PCF50633_INT2_EXTON2F	= 0x20, /* EXTON2 falling edge */
+	PCF50633_INT2_EXTON3R	= 0x40, /* EXTON3 rising edge */
+	PCF50633_INT2_EXTON3F	= 0x80, /* EXTON3 falling edge */
+};
+
+enum pcf50633_reg_int3 {
+	PCF50633_INT3_BATFULL	= 0x01, /* Battery full */
+	PCF50633_INT3_CHGHALT	= 0x02,	/* Charger halt */
+	PCF50633_INT3_THLIMON	= 0x04,
+	PCF50633_INT3_THLIMOFF	= 0x08,
+	PCF50633_INT3_USBLIMON	= 0x10,
+	PCF50633_INT3_USBLIMOFF	= 0x20,
+	PCF50633_INT3_ADCRDY	= 0x40,	/* ADC conversion finished */
+	PCF50633_INT3_ONKEY1S	= 0x80,	/* ONKEY pressed 1 second */
+};
+
+enum pcf50633_reg_int4 {
+	PCF50633_INT4_LOWSYS		= 0x01,
+	PCF50633_INT4_LOWBAT		= 0x02,
+	PCF50633_INT4_HIGHTMP		= 0x04,
+	PCF50633_INT4_AUTOPWRFAIL	= 0x08,
+	PCF50633_INT4_DWN1PWRFAIL	= 0x10,
+	PCF50633_INT4_DWN2PWRFAIL	= 0x20,
+	PCF50633_INT4_LEDPWRFAIL	= 0x40,
+	PCF50633_INT4_LEDOVP		= 0x80,
+};
+
+enum pcf50633_reg_int5 {
+	PCF50633_INT5_LDO1PWRFAIL	= 0x01,
+	PCF50633_INT5_LDO2PWRFAIL	= 0x02,
+	PCF50633_INT5_LDO3PWRFAIL	= 0x04,
+	PCF50633_INT5_LDO4PWRFAIL	= 0x08,
+	PCF50633_INT5_LDO5PWRFAIL	= 0x10,
+	PCF50633_INT5_LDO6PWRFAIL	= 0x20,
+	PCF50633_INT5_HCLDOPWRFAIL	= 0x40,
+	PCF50633_INT5_HCLDOOVL		= 0x80,
+};
+
 struct pcf50633_data;
 extern struct pcf50633_data *pcf50633_global;
 
@@ -94,6 +148,8 @@ struct pcf50633_platform_data {
 	unsigned int r_fix_batt_par;
 	unsigned int r_sense_milli;
 
+	unsigned char resumers[5];
+
 	struct {
 		u_int8_t mbcc3; /* charger voltage / current */
 	} charger;
-- 
1.5.6.3