aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c957
1 files changed, 434 insertions, 523 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1ac5731d45e5..b15f5ec81d05 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -38,130 +38,112 @@
38#include <acpi/actypes.h> 38#include <acpi/actypes.h>
39 39
40#define _COMPONENT ACPI_EC_COMPONENT 40#define _COMPONENT ACPI_EC_COMPONENT
41ACPI_MODULE_NAME ("acpi_ec") 41ACPI_MODULE_NAME("acpi_ec")
42
43#define ACPI_EC_COMPONENT 0x00100000 42#define ACPI_EC_COMPONENT 0x00100000
44#define ACPI_EC_CLASS "embedded_controller" 43#define ACPI_EC_CLASS "embedded_controller"
45#define ACPI_EC_HID "PNP0C09" 44#define ACPI_EC_HID "PNP0C09"
46#define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" 45#define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver"
47#define ACPI_EC_DEVICE_NAME "Embedded Controller" 46#define ACPI_EC_DEVICE_NAME "Embedded Controller"
48#define ACPI_EC_FILE_INFO "info" 47#define ACPI_EC_FILE_INFO "info"
49
50
51#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 48#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
52#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 49#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
53#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ 50#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
54#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ 51#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
55
56#define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ 52#define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */
57#define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ 53#define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */
58
59#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ 54#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */
60#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 55#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
61 56#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */
62#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ 57#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */
63#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */
64
65#define ACPI_EC_COMMAND_READ 0x80 58#define ACPI_EC_COMMAND_READ 0x80
66#define ACPI_EC_COMMAND_WRITE 0x81 59#define ACPI_EC_COMMAND_WRITE 0x81
67#define ACPI_EC_BURST_ENABLE 0x82 60#define ACPI_EC_BURST_ENABLE 0x82
68#define ACPI_EC_BURST_DISABLE 0x83 61#define ACPI_EC_BURST_DISABLE 0x83
69#define ACPI_EC_COMMAND_QUERY 0x84 62#define ACPI_EC_COMMAND_QUERY 0x84
70
71#define EC_POLLING 0xFF 63#define EC_POLLING 0xFF
72#define EC_BURST 0x00 64#define EC_BURST 0x00
73 65static int acpi_ec_remove(struct acpi_device *device, int type);
74 66static int acpi_ec_start(struct acpi_device *device);
75static int acpi_ec_remove (struct acpi_device *device, int type); 67static int acpi_ec_stop(struct acpi_device *device, int type);
76static int acpi_ec_start (struct acpi_device *device); 68static int acpi_ec_burst_add(struct acpi_device *device);
77static int acpi_ec_stop (struct acpi_device *device, int type); 69static int acpi_ec_polling_add(struct acpi_device *device);
78static int acpi_ec_burst_add ( struct acpi_device *device);
79static int acpi_ec_polling_add ( struct acpi_device *device);
80 70
81static struct acpi_driver acpi_ec_driver = { 71static struct acpi_driver acpi_ec_driver = {
82 .name = ACPI_EC_DRIVER_NAME, 72 .name = ACPI_EC_DRIVER_NAME,
83 .class = ACPI_EC_CLASS, 73 .class = ACPI_EC_CLASS,
84 .ids = ACPI_EC_HID, 74 .ids = ACPI_EC_HID,
85 .ops = { 75 .ops = {
86 .add = acpi_ec_polling_add, 76 .add = acpi_ec_polling_add,
87 .remove = acpi_ec_remove, 77 .remove = acpi_ec_remove,
88 .start = acpi_ec_start, 78 .start = acpi_ec_start,
89 .stop = acpi_ec_stop, 79 .stop = acpi_ec_stop,
90 }, 80 },
91}; 81};
92union acpi_ec { 82union acpi_ec {
93 struct { 83 struct {
94 u32 mode; 84 u32 mode;
95 acpi_handle handle; 85 acpi_handle handle;
96 unsigned long uid; 86 unsigned long uid;
97 unsigned long gpe_bit; 87 unsigned long gpe_bit;
98 struct acpi_generic_address status_addr; 88 struct acpi_generic_address status_addr;
99 struct acpi_generic_address command_addr; 89 struct acpi_generic_address command_addr;
100 struct acpi_generic_address data_addr; 90 struct acpi_generic_address data_addr;
101 unsigned long global_lock; 91 unsigned long global_lock;
102 } common; 92 } common;
103 93
104 struct { 94 struct {
105 u32 mode; 95 u32 mode;
106 acpi_handle handle; 96 acpi_handle handle;
107 unsigned long uid; 97 unsigned long uid;
108 unsigned long gpe_bit; 98 unsigned long gpe_bit;
109 struct acpi_generic_address status_addr; 99 struct acpi_generic_address status_addr;
110 struct acpi_generic_address command_addr; 100 struct acpi_generic_address command_addr;
111 struct acpi_generic_address data_addr; 101 struct acpi_generic_address data_addr;
112 unsigned long global_lock; 102 unsigned long global_lock;
113 unsigned int expect_event; 103 unsigned int expect_event;
114 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ 104 atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */
115 atomic_t pending_gpe; 105 atomic_t pending_gpe;
116 struct semaphore sem; 106 struct semaphore sem;
117 wait_queue_head_t wait; 107 wait_queue_head_t wait;
118 }burst; 108 } burst;
119 109
120 struct { 110 struct {
121 u32 mode; 111 u32 mode;
122 acpi_handle handle; 112 acpi_handle handle;
123 unsigned long uid; 113 unsigned long uid;
124 unsigned long gpe_bit; 114 unsigned long gpe_bit;
125 struct acpi_generic_address status_addr; 115 struct acpi_generic_address status_addr;
126 struct acpi_generic_address command_addr; 116 struct acpi_generic_address command_addr;
127 struct acpi_generic_address data_addr; 117 struct acpi_generic_address data_addr;
128 unsigned long global_lock; 118 unsigned long global_lock;
129 spinlock_t lock; 119 spinlock_t lock;
130 }polling; 120 } polling;
131}; 121};
132 122
133static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); 123static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event);
134static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); 124static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event);
135static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data); 125static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data);
136static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data); 126static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data);
137static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data); 127static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data);
138static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data); 128static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data);
139static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data); 129static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data);
140static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data); 130static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data);
141static void acpi_ec_gpe_polling_query ( void *ec_cxt); 131static void acpi_ec_gpe_polling_query(void *ec_cxt);
142static void acpi_ec_gpe_burst_query ( void *ec_cxt); 132static void acpi_ec_gpe_burst_query(void *ec_cxt);
143static u32 acpi_ec_gpe_polling_handler ( void *data); 133static u32 acpi_ec_gpe_polling_handler(void *data);
144static u32 acpi_ec_gpe_burst_handler ( void *data); 134static u32 acpi_ec_gpe_burst_handler(void *data);
145static acpi_status __init 135static acpi_status __init
146acpi_fake_ecdt_polling_callback ( 136acpi_fake_ecdt_polling_callback(acpi_handle handle,
147 acpi_handle handle, 137 u32 Level, void *context, void **retval);
148 u32 Level,
149 void *context,
150 void **retval);
151 138
152static acpi_status __init 139static acpi_status __init
153acpi_fake_ecdt_burst_callback ( 140acpi_fake_ecdt_burst_callback(acpi_handle handle,
154 acpi_handle handle, 141 u32 Level, void *context, void **retval);
155 u32 Level, 142
156 void *context, 143static int __init acpi_ec_polling_get_real_ecdt(void);
157 void **retval); 144static int __init acpi_ec_burst_get_real_ecdt(void);
158
159static int __init
160acpi_ec_polling_get_real_ecdt(void);
161static int __init
162acpi_ec_burst_get_real_ecdt(void);
163/* If we find an EC via the ECDT, we need to keep a ptr to its context */ 145/* If we find an EC via the ECDT, we need to keep a ptr to its context */
164static union acpi_ec *ec_ecdt; 146static union acpi_ec *ec_ecdt;
165 147
166/* External interfaces use first EC only, so remember */ 148/* External interfaces use first EC only, so remember */
167static struct acpi_device *first_ec; 149static struct acpi_device *first_ec;
@@ -173,30 +155,24 @@ static int acpi_ec_polling_mode = EC_POLLING;
173 155
174static inline u32 acpi_ec_read_status(union acpi_ec *ec) 156static inline u32 acpi_ec_read_status(union acpi_ec *ec)
175{ 157{
176 u32 status = 0; 158 u32 status = 0;
177 159
178 acpi_hw_low_level_read(8, &status, &ec->common.status_addr); 160 acpi_hw_low_level_read(8, &status, &ec->common.status_addr);
179 return status; 161 return status;
180} 162}
181 163
182static int 164static int acpi_ec_wait(union acpi_ec *ec, u8 event)
183acpi_ec_wait (
184 union acpi_ec *ec,
185 u8 event)
186{ 165{
187 if (acpi_ec_polling_mode) 166 if (acpi_ec_polling_mode)
188 return acpi_ec_polling_wait (ec, event); 167 return acpi_ec_polling_wait(ec, event);
189 else 168 else
190 return acpi_ec_burst_wait (ec, event); 169 return acpi_ec_burst_wait(ec, event);
191} 170}
192 171
193static int 172static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
194acpi_ec_polling_wait (
195 union acpi_ec *ec,
196 u8 event)
197{ 173{
198 u32 acpi_ec_status = 0; 174 u32 acpi_ec_status = 0;
199 u32 i = ACPI_EC_UDELAY_COUNT; 175 u32 i = ACPI_EC_UDELAY_COUNT;
200 176
201 if (!ec) 177 if (!ec)
202 return -EINVAL; 178 return -EINVAL;
@@ -205,19 +181,21 @@ acpi_ec_polling_wait (
205 switch (event) { 181 switch (event) {
206 case ACPI_EC_EVENT_OBF: 182 case ACPI_EC_EVENT_OBF:
207 do { 183 do {
208 acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); 184 acpi_hw_low_level_read(8, &acpi_ec_status,
185 &ec->common.status_addr);
209 if (acpi_ec_status & ACPI_EC_FLAG_OBF) 186 if (acpi_ec_status & ACPI_EC_FLAG_OBF)
210 return 0; 187 return 0;
211 udelay(ACPI_EC_UDELAY); 188 udelay(ACPI_EC_UDELAY);
212 } while (--i>0); 189 } while (--i > 0);
213 break; 190 break;
214 case ACPI_EC_EVENT_IBE: 191 case ACPI_EC_EVENT_IBE:
215 do { 192 do {
216 acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); 193 acpi_hw_low_level_read(8, &acpi_ec_status,
194 &ec->common.status_addr);
217 if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) 195 if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
218 return 0; 196 return 0;
219 udelay(ACPI_EC_UDELAY); 197 udelay(ACPI_EC_UDELAY);
220 } while (--i>0); 198 } while (--i > 0);
221 break; 199 break;
222 default: 200 default:
223 return -EINVAL; 201 return -EINVAL;
@@ -227,7 +205,7 @@ acpi_ec_polling_wait (
227} 205}
228static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) 206static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
229{ 207{
230 int result = 0; 208 int result = 0;
231 209
232 ACPI_FUNCTION_TRACE("acpi_ec_wait"); 210 ACPI_FUNCTION_TRACE("acpi_ec_wait");
233 211
@@ -235,14 +213,15 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
235 smp_mb(); 213 smp_mb();
236 214
237 result = wait_event_interruptible_timeout(ec->burst.wait, 215 result = wait_event_interruptible_timeout(ec->burst.wait,
238 !ec->burst.expect_event, 216 !ec->burst.expect_event,
239 msecs_to_jiffies(ACPI_EC_DELAY)); 217 msecs_to_jiffies
240 218 (ACPI_EC_DELAY));
219
241 ec->burst.expect_event = 0; 220 ec->burst.expect_event = 0;
242 smp_mb(); 221 smp_mb();
243 222
244 if (result < 0){ 223 if (result < 0) {
245 ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result = %d ", result)); 224 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, " result = %d ", result));
246 return_VALUE(result); 225 return_VALUE(result);
247 } 226 }
248 227
@@ -266,54 +245,49 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
266 return_VALUE(-ETIME); 245 return_VALUE(-ETIME);
267} 246}
268 247
269 248static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
270
271static int
272acpi_ec_enter_burst_mode (
273 union acpi_ec *ec)
274{ 249{
275 u32 tmp = 0; 250 u32 tmp = 0;
276 int status = 0; 251 int status = 0;
277 252
278 ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); 253 ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
279 254
280 status = acpi_ec_read_status(ec); 255 status = acpi_ec_read_status(ec);
281 if (status != -EINVAL && 256 if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
282 !(status & ACPI_EC_FLAG_BURST)){ 257 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
283 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); 258 &ec->common.command_addr);
284 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 259 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
285 if (status){ 260 if (status) {
286 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 261 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
287 return_VALUE(-EINVAL); 262 return_VALUE(-EINVAL);
288 } 263 }
289 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); 264 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
290 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 265 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
291 if(tmp != 0x90 ) {/* Burst ACK byte*/ 266 if (tmp != 0x90) { /* Burst ACK byte */
292 return_VALUE(-EINVAL); 267 return_VALUE(-EINVAL);
293 } 268 }
294 } 269 }
295 270
296 atomic_set(&ec->burst.leaving_burst , 0); 271 atomic_set(&ec->burst.leaving_burst, 0);
297 return_VALUE(0); 272 return_VALUE(0);
298} 273}
299 274
300static int 275static int acpi_ec_leave_burst_mode(union acpi_ec *ec)
301acpi_ec_leave_burst_mode (
302 union acpi_ec *ec)
303{ 276{
304 int status =0; 277 int status = 0;
305 278
306 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); 279 ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
307 280
308 atomic_set(&ec->burst.leaving_burst , 1); 281 atomic_set(&ec->burst.leaving_burst, 1);
309 status = acpi_ec_read_status(ec); 282 status = acpi_ec_read_status(ec);
310 if (status != -EINVAL && 283 if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) {
311 (status & ACPI_EC_FLAG_BURST)){ 284 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE,
312 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); 285 &ec->common.command_addr);
313 status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); 286 status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
314 if (status){ 287 if (status) {
315 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 288 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
316 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); 289 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
290 "------->wait fail\n"));
317 return_VALUE(-EINVAL); 291 return_VALUE(-EINVAL);
318 } 292 }
319 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 293 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -323,38 +297,26 @@ acpi_ec_leave_burst_mode (
323 return_VALUE(0); 297 return_VALUE(0);
324} 298}
325 299
326static int 300static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
327acpi_ec_read (
328 union acpi_ec *ec,
329 u8 address,
330 u32 *data)
331{ 301{
332 if (acpi_ec_polling_mode) 302 if (acpi_ec_polling_mode)
333 return acpi_ec_polling_read(ec, address, data); 303 return acpi_ec_polling_read(ec, address, data);
334 else 304 else
335 return acpi_ec_burst_read(ec, address, data); 305 return acpi_ec_burst_read(ec, address, data);
336} 306}
337static int 307static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
338acpi_ec_write (
339 union acpi_ec *ec,
340 u8 address,
341 u8 data)
342{ 308{
343 if (acpi_ec_polling_mode) 309 if (acpi_ec_polling_mode)
344 return acpi_ec_polling_write(ec, address, data); 310 return acpi_ec_polling_write(ec, address, data);
345 else 311 else
346 return acpi_ec_burst_write(ec, address, data); 312 return acpi_ec_burst_write(ec, address, data);
347} 313}
348static int 314static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
349acpi_ec_polling_read (
350 union acpi_ec *ec,
351 u8 address,
352 u32 *data)
353{ 315{
354 acpi_status status = AE_OK; 316 acpi_status status = AE_OK;
355 int result = 0; 317 int result = 0;
356 unsigned long flags = 0; 318 unsigned long flags = 0;
357 u32 glk = 0; 319 u32 glk = 0;
358 320
359 ACPI_FUNCTION_TRACE("acpi_ec_read"); 321 ACPI_FUNCTION_TRACE("acpi_ec_read");
360 322
@@ -371,7 +333,8 @@ acpi_ec_polling_read (
371 333
372 spin_lock_irqsave(&ec->polling.lock, flags); 334 spin_lock_irqsave(&ec->polling.lock, flags);
373 335
374 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); 336 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
337 &ec->common.command_addr);
375 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 338 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
376 if (result) 339 if (result)
377 goto end; 340 goto end;
@@ -384,9 +347,9 @@ acpi_ec_polling_read (
384 acpi_hw_low_level_read(8, data, &ec->common.data_addr); 347 acpi_hw_low_level_read(8, data, &ec->common.data_addr);
385 348
386 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", 349 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
387 *data, address)); 350 *data, address));
388 351
389end: 352 end:
390 spin_unlock_irqrestore(&ec->polling.lock, flags); 353 spin_unlock_irqrestore(&ec->polling.lock, flags);
391 354
392 if (ec->common.global_lock) 355 if (ec->common.global_lock)
@@ -395,17 +358,12 @@ end:
395 return_VALUE(result); 358 return_VALUE(result);
396} 359}
397 360
398 361static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
399static int
400acpi_ec_polling_write (
401 union acpi_ec *ec,
402 u8 address,
403 u8 data)
404{ 362{
405 int result = 0; 363 int result = 0;
406 acpi_status status = AE_OK; 364 acpi_status status = AE_OK;
407 unsigned long flags = 0; 365 unsigned long flags = 0;
408 u32 glk = 0; 366 u32 glk = 0;
409 367
410 ACPI_FUNCTION_TRACE("acpi_ec_write"); 368 ACPI_FUNCTION_TRACE("acpi_ec_write");
411 369
@@ -420,7 +378,8 @@ acpi_ec_polling_write (
420 378
421 spin_lock_irqsave(&ec->polling.lock, flags); 379 spin_lock_irqsave(&ec->polling.lock, flags);
422 380
423 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); 381 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
382 &ec->common.command_addr);
424 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 383 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
425 if (result) 384 if (result)
426 goto end; 385 goto end;
@@ -436,9 +395,9 @@ acpi_ec_polling_write (
436 goto end; 395 goto end;
437 396
438 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", 397 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
439 data, address)); 398 data, address));
440 399
441end: 400 end:
442 spin_unlock_irqrestore(&ec->polling.lock, flags); 401 spin_unlock_irqrestore(&ec->polling.lock, flags);
443 402
444 if (ec->common.global_lock) 403 if (ec->common.global_lock)
@@ -447,21 +406,17 @@ end:
447 return_VALUE(result); 406 return_VALUE(result);
448} 407}
449 408
450static int 409static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
451acpi_ec_burst_read (
452 union acpi_ec *ec,
453 u8 address,
454 u32 *data)
455{ 410{
456 int status = 0; 411 int status = 0;
457 u32 glk; 412 u32 glk;
458 413
459 ACPI_FUNCTION_TRACE("acpi_ec_read"); 414 ACPI_FUNCTION_TRACE("acpi_ec_read");
460 415
461 if (!ec || !data) 416 if (!ec || !data)
462 return_VALUE(-EINVAL); 417 return_VALUE(-EINVAL);
463 418
464retry: 419 retry:
465 *data = 0; 420 *data = 0;
466 421
467 if (ec->common.global_lock) { 422 if (ec->common.global_lock) {
@@ -473,10 +428,11 @@ retry:
473 WARN_ON(in_interrupt()); 428 WARN_ON(in_interrupt());
474 down(&ec->burst.sem); 429 down(&ec->burst.sem);
475 430
476 if(acpi_ec_enter_burst_mode(ec)) 431 if (acpi_ec_enter_burst_mode(ec))
477 goto end; 432 goto end;
478 433
479 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); 434 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
435 &ec->common.command_addr);
480 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 436 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
481 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 437 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
482 if (status) { 438 if (status) {
@@ -484,8 +440,8 @@ retry:
484 } 440 }
485 441
486 acpi_hw_low_level_write(8, address, &ec->common.data_addr); 442 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
487 status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 443 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
488 if (status){ 444 if (status) {
489 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 445 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
490 goto end; 446 goto end;
491 } 447 }
@@ -494,19 +450,19 @@ retry:
494 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 450 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
495 451
496 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", 452 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
497 *data, address)); 453 *data, address));
498 454
499end: 455 end:
500 acpi_ec_leave_burst_mode(ec); 456 acpi_ec_leave_burst_mode(ec);
501 up(&ec->burst.sem); 457 up(&ec->burst.sem);
502 458
503 if (ec->common.global_lock) 459 if (ec->common.global_lock)
504 acpi_release_global_lock(glk); 460 acpi_release_global_lock(glk);
505 461
506 if(atomic_read(&ec->burst.leaving_burst) == 2){ 462 if (atomic_read(&ec->burst.leaving_burst) == 2) {
507 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 463 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n"));
508 while(atomic_read(&ec->burst.pending_gpe)){ 464 while (atomic_read(&ec->burst.pending_gpe)) {
509 msleep(1); 465 msleep(1);
510 } 466 }
511 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 467 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
512 goto retry; 468 goto retry;
@@ -515,22 +471,17 @@ end:
515 return_VALUE(status); 471 return_VALUE(status);
516} 472}
517 473
518 474static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
519static int
520acpi_ec_burst_write (
521 union acpi_ec *ec,
522 u8 address,
523 u8 data)
524{ 475{
525 int status = 0; 476 int status = 0;
526 u32 glk; 477 u32 glk;
527 u32 tmp; 478 u32 tmp;
528 479
529 ACPI_FUNCTION_TRACE("acpi_ec_write"); 480 ACPI_FUNCTION_TRACE("acpi_ec_write");
530 481
531 if (!ec) 482 if (!ec)
532 return_VALUE(-EINVAL); 483 return_VALUE(-EINVAL);
533retry: 484 retry:
534 if (ec->common.global_lock) { 485 if (ec->common.global_lock) {
535 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); 486 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
536 if (ACPI_FAILURE(status)) 487 if (ACPI_FAILURE(status))
@@ -540,32 +491,33 @@ retry:
540 WARN_ON(in_interrupt()); 491 WARN_ON(in_interrupt());
541 down(&ec->burst.sem); 492 down(&ec->burst.sem);
542 493
543 if(acpi_ec_enter_burst_mode(ec)) 494 if (acpi_ec_enter_burst_mode(ec))
544 goto end; 495 goto end;
545 496
546 status = acpi_ec_read_status(ec); 497 status = acpi_ec_read_status(ec);
547 if (status != -EINVAL && 498 if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
548 !(status & ACPI_EC_FLAG_BURST)){ 499 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
549 acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); 500 &ec->common.command_addr);
550 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 501 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
551 if (status) 502 if (status)
552 goto end; 503 goto end;
553 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); 504 acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
554 if(tmp != 0x90 ) /* Burst ACK byte*/ 505 if (tmp != 0x90) /* Burst ACK byte */
555 goto end; 506 goto end;
556 } 507 }
557 /*Now we are in burst mode*/ 508 /*Now we are in burst mode */
558 509
559 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); 510 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
511 &ec->common.command_addr);
560 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 512 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
561 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 513 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
562 if (status){ 514 if (status) {
563 goto end; 515 goto end;
564 } 516 }
565 517
566 acpi_hw_low_level_write(8, address, &ec->common.data_addr); 518 acpi_hw_low_level_write(8, address, &ec->common.data_addr);
567 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 519 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
568 if (status){ 520 if (status) {
569 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 521 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
570 goto end; 522 goto end;
571 } 523 }
@@ -577,19 +529,19 @@ retry:
577 goto end; 529 goto end;
578 530
579 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", 531 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
580 data, address)); 532 data, address));
581 533
582end: 534 end:
583 acpi_ec_leave_burst_mode(ec); 535 acpi_ec_leave_burst_mode(ec);
584 up(&ec->burst.sem); 536 up(&ec->burst.sem);
585 537
586 if (ec->common.global_lock) 538 if (ec->common.global_lock)
587 acpi_release_global_lock(glk); 539 acpi_release_global_lock(glk);
588 540
589 if(atomic_read(&ec->burst.leaving_burst) == 2){ 541 if (atomic_read(&ec->burst.leaving_burst) == 2) {
590 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 542 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n"));
591 while(atomic_read(&ec->burst.pending_gpe)){ 543 while (atomic_read(&ec->burst.pending_gpe)) {
592 msleep(1); 544 msleep(1);
593 } 545 }
594 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 546 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
595 goto retry; 547 goto retry;
@@ -601,8 +553,7 @@ end:
601/* 553/*
602 * Externally callable EC access functions. For now, assume 1 EC only 554 * Externally callable EC access functions. For now, assume 1 EC only
603 */ 555 */
604int 556int ec_read(u8 addr, u8 * val)
605ec_read(u8 addr, u8 *val)
606{ 557{
607 union acpi_ec *ec; 558 union acpi_ec *ec;
608 int err; 559 int err;
@@ -618,14 +569,13 @@ ec_read(u8 addr, u8 *val)
618 if (!err) { 569 if (!err) {
619 *val = temp_data; 570 *val = temp_data;
620 return 0; 571 return 0;
621 } 572 } else
622 else
623 return err; 573 return err;
624} 574}
575
625EXPORT_SYMBOL(ec_read); 576EXPORT_SYMBOL(ec_read);
626 577
627int 578int ec_write(u8 addr, u8 val)
628ec_write(u8 addr, u8 val)
629{ 579{
630 union acpi_ec *ec; 580 union acpi_ec *ec;
631 int err; 581 int err;
@@ -639,27 +589,22 @@ ec_write(u8 addr, u8 val)
639 589
640 return err; 590 return err;
641} 591}
592
642EXPORT_SYMBOL(ec_write); 593EXPORT_SYMBOL(ec_write);
643 594
644static int 595static int acpi_ec_query(union acpi_ec *ec, u32 * data)
645acpi_ec_query (
646 union acpi_ec *ec,
647 u32 *data)
648{ 596{
649 if (acpi_ec_polling_mode) 597 if (acpi_ec_polling_mode)
650 return acpi_ec_polling_query(ec, data); 598 return acpi_ec_polling_query(ec, data);
651 else 599 else
652 return acpi_ec_burst_query(ec, data); 600 return acpi_ec_burst_query(ec, data);
653} 601}
654static int 602static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
655acpi_ec_polling_query (
656 union acpi_ec *ec,
657 u32 *data)
658{ 603{
659 int result = 0; 604 int result = 0;
660 acpi_status status = AE_OK; 605 acpi_status status = AE_OK;
661 unsigned long flags = 0; 606 unsigned long flags = 0;
662 u32 glk = 0; 607 u32 glk = 0;
663 608
664 ACPI_FUNCTION_TRACE("acpi_ec_query"); 609 ACPI_FUNCTION_TRACE("acpi_ec_query");
665 610
@@ -681,7 +626,8 @@ acpi_ec_polling_query (
681 */ 626 */
682 spin_lock_irqsave(&ec->polling.lock, flags); 627 spin_lock_irqsave(&ec->polling.lock, flags);
683 628
684 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); 629 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
630 &ec->common.command_addr);
685 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 631 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
686 if (result) 632 if (result)
687 goto end; 633 goto end;
@@ -690,7 +636,7 @@ acpi_ec_polling_query (
690 if (!*data) 636 if (!*data)
691 result = -ENODATA; 637 result = -ENODATA;
692 638
693end: 639 end:
694 spin_unlock_irqrestore(&ec->polling.lock, flags); 640 spin_unlock_irqrestore(&ec->polling.lock, flags);
695 641
696 if (ec->common.global_lock) 642 if (ec->common.global_lock)
@@ -698,13 +644,10 @@ end:
698 644
699 return_VALUE(result); 645 return_VALUE(result);
700} 646}
701static int 647static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
702acpi_ec_burst_query (
703 union acpi_ec *ec,
704 u32 *data)
705{ 648{
706 int status = 0; 649 int status = 0;
707 u32 glk; 650 u32 glk;
708 651
709 ACPI_FUNCTION_TRACE("acpi_ec_query"); 652 ACPI_FUNCTION_TRACE("acpi_ec_query");
710 653
@@ -719,16 +662,17 @@ acpi_ec_burst_query (
719 } 662 }
720 663
721 down(&ec->burst.sem); 664 down(&ec->burst.sem);
722 if(acpi_ec_enter_burst_mode(ec)) 665 if (acpi_ec_enter_burst_mode(ec))
723 goto end; 666 goto end;
724 /* 667 /*
725 * Query the EC to find out which _Qxx method we need to evaluate. 668 * Query the EC to find out which _Qxx method we need to evaluate.
726 * Note that successful completion of the query causes the ACPI_EC_SCI 669 * Note that successful completion of the query causes the ACPI_EC_SCI
727 * bit to be cleared (and thus clearing the interrupt source). 670 * bit to be cleared (and thus clearing the interrupt source).
728 */ 671 */
729 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); 672 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
673 &ec->common.command_addr);
730 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); 674 status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
731 if (status){ 675 if (status) {
732 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 676 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
733 goto end; 677 goto end;
734 } 678 }
@@ -738,51 +682,47 @@ acpi_ec_burst_query (
738 if (!*data) 682 if (!*data)
739 status = -ENODATA; 683 status = -ENODATA;
740 684
741end: 685 end:
742 acpi_ec_leave_burst_mode(ec); 686 acpi_ec_leave_burst_mode(ec);
743 up(&ec->burst.sem); 687 up(&ec->burst.sem);
744 688
745 if (ec->common.global_lock) 689 if (ec->common.global_lock)
746 acpi_release_global_lock(glk); 690 acpi_release_global_lock(glk);
747 691
748 if(atomic_read(&ec->burst.leaving_burst) == 2){ 692 if (atomic_read(&ec->burst.leaving_burst) == 2) {
749 ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); 693 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aborted, retry ...\n"));
750 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 694 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
751 status = -ENODATA; 695 status = -ENODATA;
752 } 696 }
753 return_VALUE(status); 697 return_VALUE(status);
754} 698}
755 699
756
757/* -------------------------------------------------------------------------- 700/* --------------------------------------------------------------------------
758 Event Management 701 Event Management
759 -------------------------------------------------------------------------- */ 702 -------------------------------------------------------------------------- */
760 703
761union acpi_ec_query_data { 704union acpi_ec_query_data {
762 acpi_handle handle; 705 acpi_handle handle;
763 u8 data; 706 u8 data;
764}; 707};
765 708
766static void 709static void acpi_ec_gpe_query(void *ec_cxt)
767acpi_ec_gpe_query (
768 void *ec_cxt)
769{ 710{
770 if (acpi_ec_polling_mode) 711 if (acpi_ec_polling_mode)
771 acpi_ec_gpe_polling_query(ec_cxt); 712 acpi_ec_gpe_polling_query(ec_cxt);
772 else 713 else
773 acpi_ec_gpe_burst_query(ec_cxt); 714 acpi_ec_gpe_burst_query(ec_cxt);
774} 715}
775 716
776static void 717static void acpi_ec_gpe_polling_query(void *ec_cxt)
777acpi_ec_gpe_polling_query (
778 void *ec_cxt)
779{ 718{
780 union acpi_ec *ec = (union acpi_ec *) ec_cxt; 719 union acpi_ec *ec = (union acpi_ec *)ec_cxt;
781 u32 value = 0; 720 u32 value = 0;
782 unsigned long flags = 0; 721 unsigned long flags = 0;
783 static char object_name[5] = {'_','Q','0','0','\0'}; 722 static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
784 const char hex[] = {'0','1','2','3','4','5','6','7', 723 const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
785 '8','9','A','B','C','D','E','F'}; 724 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
725 };
786 726
787 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); 727 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
788 728
@@ -812,19 +752,18 @@ acpi_ec_gpe_polling_query (
812 752
813 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); 753 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
814 754
815end: 755 end:
816 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 756 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
817} 757}
818static void 758static void acpi_ec_gpe_burst_query(void *ec_cxt)
819acpi_ec_gpe_burst_query (
820 void *ec_cxt)
821{ 759{
822 union acpi_ec *ec = (union acpi_ec *) ec_cxt; 760 union acpi_ec *ec = (union acpi_ec *)ec_cxt;
823 u32 value; 761 u32 value;
824 int result = -ENODATA; 762 int result = -ENODATA;
825 static char object_name[5] = {'_','Q','0','0','\0'}; 763 static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
826 const char hex[] = {'0','1','2','3','4','5','6','7', 764 const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
827 '8','9','A','B','C','D','E','F'}; 765 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
766 };
828 767
829 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); 768 ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
830 769
@@ -840,26 +779,22 @@ acpi_ec_gpe_burst_query (
840 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); 779 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
841 780
842 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); 781 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
843end: 782 end:
844 atomic_dec(&ec->burst.pending_gpe); 783 atomic_dec(&ec->burst.pending_gpe);
845 return; 784 return;
846} 785}
847 786
848static u32 787static u32 acpi_ec_gpe_handler(void *data)
849acpi_ec_gpe_handler (
850 void *data)
851{ 788{
852 if (acpi_ec_polling_mode) 789 if (acpi_ec_polling_mode)
853 return acpi_ec_gpe_polling_handler(data); 790 return acpi_ec_gpe_polling_handler(data);
854 else 791 else
855 return acpi_ec_gpe_burst_handler(data); 792 return acpi_ec_gpe_burst_handler(data);
856} 793}
857static u32 794static u32 acpi_ec_gpe_polling_handler(void *data)
858acpi_ec_gpe_polling_handler (
859 void *data)
860{ 795{
861 acpi_status status = AE_OK; 796 acpi_status status = AE_OK;
862 union acpi_ec *ec = (union acpi_ec *) data; 797 union acpi_ec *ec = (union acpi_ec *)data;
863 798
864 if (!ec) 799 if (!ec)
865 return ACPI_INTERRUPT_NOT_HANDLED; 800 return ACPI_INTERRUPT_NOT_HANDLED;
@@ -867,20 +802,18 @@ acpi_ec_gpe_polling_handler (
867 acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); 802 acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
868 803
869 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, 804 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
870 acpi_ec_gpe_query, ec); 805 acpi_ec_gpe_query, ec);
871 806
872 if (status == AE_OK) 807 if (status == AE_OK)
873 return ACPI_INTERRUPT_HANDLED; 808 return ACPI_INTERRUPT_HANDLED;
874 else 809 else
875 return ACPI_INTERRUPT_NOT_HANDLED; 810 return ACPI_INTERRUPT_NOT_HANDLED;
876} 811}
877static u32 812static u32 acpi_ec_gpe_burst_handler(void *data)
878acpi_ec_gpe_burst_handler (
879 void *data)
880{ 813{
881 acpi_status status = AE_OK; 814 acpi_status status = AE_OK;
882 u32 value; 815 u32 value;
883 union acpi_ec *ec = (union acpi_ec *) data; 816 union acpi_ec *ec = (union acpi_ec *)data;
884 817
885 if (!ec) 818 if (!ec)
886 return ACPI_INTERRUPT_NOT_HANDLED; 819 return ACPI_INTERRUPT_NOT_HANDLED;
@@ -889,39 +822,39 @@ acpi_ec_gpe_burst_handler (
889 822
890 value = acpi_ec_read_status(ec); 823 value = acpi_ec_read_status(ec);
891 824
892 if((value & ACPI_EC_FLAG_IBF) && 825 if ((value & ACPI_EC_FLAG_IBF) &&
893 !(value & ACPI_EC_FLAG_BURST) && 826 !(value & ACPI_EC_FLAG_BURST) &&
894 (atomic_read(&ec->burst.leaving_burst) == 0)) { 827 (atomic_read(&ec->burst.leaving_burst) == 0)) {
895 /* 828 /*
896 * the embedded controller disables 829 * the embedded controller disables
897 * burst mode for any reason other 830 * burst mode for any reason other
898 * than the burst disable command 831 * than the burst disable command
899 * to process critical event. 832 * to process critical event.
900 */ 833 */
901 atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction 834 atomic_set(&ec->burst.leaving_burst, 2); /* block current pending transaction
902 and retry */ 835 and retry */
903 wake_up(&ec->burst.wait); 836 wake_up(&ec->burst.wait);
904 }else { 837 } else {
905 if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF && 838 if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF &&
906 (value & ACPI_EC_FLAG_OBF)) || 839 (value & ACPI_EC_FLAG_OBF)) ||
907 (ec->burst.expect_event == ACPI_EC_EVENT_IBE && 840 (ec->burst.expect_event == ACPI_EC_EVENT_IBE &&
908 !(value & ACPI_EC_FLAG_IBF))) { 841 !(value & ACPI_EC_FLAG_IBF))) {
909 ec->burst.expect_event = 0; 842 ec->burst.expect_event = 0;
910 wake_up(&ec->burst.wait); 843 wake_up(&ec->burst.wait);
911 return ACPI_INTERRUPT_HANDLED; 844 return ACPI_INTERRUPT_HANDLED;
912 } 845 }
913 } 846 }
914 847
915 if (value & ACPI_EC_FLAG_SCI){ 848 if (value & ACPI_EC_FLAG_SCI) {
916 atomic_add(1, &ec->burst.pending_gpe) ; 849 atomic_add(1, &ec->burst.pending_gpe);
917 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, 850 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
918 acpi_ec_gpe_query, ec); 851 acpi_ec_gpe_query, ec);
919 return status == AE_OK ? 852 return status == AE_OK ?
920 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 853 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
921 } 854 }
922 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); 855 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
923 return status == AE_OK ? 856 return status == AE_OK ?
924 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; 857 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
925} 858}
926 859
927/* -------------------------------------------------------------------------- 860/* --------------------------------------------------------------------------
@@ -929,37 +862,31 @@ acpi_ec_gpe_burst_handler (
929 -------------------------------------------------------------------------- */ 862 -------------------------------------------------------------------------- */
930 863
931static acpi_status 864static acpi_status
932acpi_ec_space_setup ( 865acpi_ec_space_setup(acpi_handle region_handle,
933 acpi_handle region_handle, 866 u32 function, void *handler_context, void **return_context)
934 u32 function,
935 void *handler_context,
936 void **return_context)
937{ 867{
938 /* 868 /*
939 * The EC object is in the handler context and is needed 869 * The EC object is in the handler context and is needed
940 * when calling the acpi_ec_space_handler. 870 * when calling the acpi_ec_space_handler.
941 */ 871 */
942 *return_context = (function != ACPI_REGION_DEACTIVATE) ? 872 *return_context = (function != ACPI_REGION_DEACTIVATE) ?
943 handler_context : NULL; 873 handler_context : NULL;
944 874
945 return AE_OK; 875 return AE_OK;
946} 876}
947 877
948
949static acpi_status 878static acpi_status
950acpi_ec_space_handler ( 879acpi_ec_space_handler(u32 function,
951 u32 function, 880 acpi_physical_address address,
952 acpi_physical_address address, 881 u32 bit_width,
953 u32 bit_width, 882 acpi_integer * value,
954 acpi_integer *value, 883 void *handler_context, void *region_context)
955 void *handler_context,
956 void *region_context)
957{ 884{
958 int result = 0; 885 int result = 0;
959 union acpi_ec *ec = NULL; 886 union acpi_ec *ec = NULL;
960 u64 temp = *value; 887 u64 temp = *value;
961 acpi_integer f_v = 0; 888 acpi_integer f_v = 0;
962 int i = 0; 889 int i = 0;
963 890
964 ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); 891 ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
965 892
@@ -967,17 +894,18 @@ acpi_ec_space_handler (
967 return_VALUE(AE_BAD_PARAMETER); 894 return_VALUE(AE_BAD_PARAMETER);
968 895
969 if (bit_width != 8 && acpi_strict) { 896 if (bit_width != 8 && acpi_strict) {
970 printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); 897 printk(KERN_WARNING PREFIX
898 "acpi_ec_space_handler: bit_width should be 8\n");
971 return_VALUE(AE_BAD_PARAMETER); 899 return_VALUE(AE_BAD_PARAMETER);
972 } 900 }
973 901
974 ec = (union acpi_ec *) handler_context; 902 ec = (union acpi_ec *)handler_context;
975 903
976next_byte: 904 next_byte:
977 switch (function) { 905 switch (function) {
978 case ACPI_READ: 906 case ACPI_READ:
979 temp = 0; 907 temp = 0;
980 result = acpi_ec_read(ec, (u8) address, (u32 *)&temp); 908 result = acpi_ec_read(ec, (u8) address, (u32 *) & temp);
981 break; 909 break;
982 case ACPI_WRITE: 910 case ACPI_WRITE:
983 result = acpi_ec_write(ec, (u8) address, (u8) temp); 911 result = acpi_ec_write(ec, (u8) address, (u8) temp);
@@ -1004,8 +932,7 @@ next_byte:
1004 *value = f_v; 932 *value = f_v;
1005 } 933 }
1006 934
1007 935 out:
1008out:
1009 switch (result) { 936 switch (result) {
1010 case -EINVAL: 937 case -EINVAL:
1011 return_VALUE(AE_BAD_PARAMETER); 938 return_VALUE(AE_BAD_PARAMETER);
@@ -1021,18 +948,15 @@ out:
1021 } 948 }
1022} 949}
1023 950
1024
1025/* -------------------------------------------------------------------------- 951/* --------------------------------------------------------------------------
1026 FS Interface (/proc) 952 FS Interface (/proc)
1027 -------------------------------------------------------------------------- */ 953 -------------------------------------------------------------------------- */
1028 954
1029static struct proc_dir_entry *acpi_ec_dir; 955static struct proc_dir_entry *acpi_ec_dir;
1030 956
1031 957static int acpi_ec_read_info(struct seq_file *seq, void *offset)
1032static int
1033acpi_ec_read_info (struct seq_file *seq, void *offset)
1034{ 958{
1035 union acpi_ec *ec = (union acpi_ec *) seq->private; 959 union acpi_ec *ec = (union acpi_ec *)seq->private;
1036 960
1037 ACPI_FUNCTION_TRACE("acpi_ec_read_info"); 961 ACPI_FUNCTION_TRACE("acpi_ec_read_info");
1038 962
@@ -1040,14 +964,15 @@ acpi_ec_read_info (struct seq_file *seq, void *offset)
1040 goto end; 964 goto end;
1041 965
1042 seq_printf(seq, "gpe bit: 0x%02x\n", 966 seq_printf(seq, "gpe bit: 0x%02x\n",
1043 (u32) ec->common.gpe_bit); 967 (u32) ec->common.gpe_bit);
1044 seq_printf(seq, "ports: 0x%02x, 0x%02x\n", 968 seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
1045 (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address); 969 (u32) ec->common.status_addr.address,
970 (u32) ec->common.data_addr.address);
1046 seq_printf(seq, "use global lock: %s\n", 971 seq_printf(seq, "use global lock: %s\n",
1047 ec->common.global_lock?"yes":"no"); 972 ec->common.global_lock ? "yes" : "no");
1048 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 973 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
1049 974
1050end: 975 end:
1051 return_VALUE(0); 976 return_VALUE(0);
1052} 977}
1053 978
@@ -1057,34 +982,32 @@ static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
1057} 982}
1058 983
1059static struct file_operations acpi_ec_info_ops = { 984static struct file_operations acpi_ec_info_ops = {
1060 .open = acpi_ec_info_open_fs, 985 .open = acpi_ec_info_open_fs,
1061 .read = seq_read, 986 .read = seq_read,
1062 .llseek = seq_lseek, 987 .llseek = seq_lseek,
1063 .release = single_release, 988 .release = single_release,
1064 .owner = THIS_MODULE, 989 .owner = THIS_MODULE,
1065}; 990};
1066 991
1067static int 992static int acpi_ec_add_fs(struct acpi_device *device)
1068acpi_ec_add_fs (
1069 struct acpi_device *device)
1070{ 993{
1071 struct proc_dir_entry *entry = NULL; 994 struct proc_dir_entry *entry = NULL;
1072 995
1073 ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); 996 ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
1074 997
1075 if (!acpi_device_dir(device)) { 998 if (!acpi_device_dir(device)) {
1076 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), 999 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1077 acpi_ec_dir); 1000 acpi_ec_dir);
1078 if (!acpi_device_dir(device)) 1001 if (!acpi_device_dir(device))
1079 return_VALUE(-ENODEV); 1002 return_VALUE(-ENODEV);
1080 } 1003 }
1081 1004
1082 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, 1005 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
1083 acpi_device_dir(device)); 1006 acpi_device_dir(device));
1084 if (!entry) 1007 if (!entry)
1085 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 1008 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
1086 "Unable to create '%s' fs entry\n", 1009 "Unable to create '%s' fs entry\n",
1087 ACPI_EC_FILE_INFO)); 1010 ACPI_EC_FILE_INFO));
1088 else { 1011 else {
1089 entry->proc_fops = &acpi_ec_info_ops; 1012 entry->proc_fops = &acpi_ec_info_ops;
1090 entry->data = acpi_driver_data(device); 1013 entry->data = acpi_driver_data(device);
@@ -1094,10 +1017,7 @@ acpi_ec_add_fs (
1094 return_VALUE(0); 1017 return_VALUE(0);
1095} 1018}
1096 1019
1097 1020static int acpi_ec_remove_fs(struct acpi_device *device)
1098static int
1099acpi_ec_remove_fs (
1100 struct acpi_device *device)
1101{ 1021{
1102 ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); 1022 ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
1103 1023
@@ -1110,20 +1030,16 @@ acpi_ec_remove_fs (
1110 return_VALUE(0); 1030 return_VALUE(0);
1111} 1031}
1112 1032
1113
1114/* -------------------------------------------------------------------------- 1033/* --------------------------------------------------------------------------
1115 Driver Interface 1034 Driver Interface
1116 -------------------------------------------------------------------------- */ 1035 -------------------------------------------------------------------------- */
1117 1036
1118 1037static int acpi_ec_polling_add(struct acpi_device *device)
1119static int
1120acpi_ec_polling_add (
1121 struct acpi_device *device)
1122{ 1038{
1123 int result = 0; 1039 int result = 0;
1124 acpi_status status = AE_OK; 1040 acpi_status status = AE_OK;
1125 union acpi_ec *ec = NULL; 1041 union acpi_ec *ec = NULL;
1126 unsigned long uid; 1042 unsigned long uid;
1127 1043
1128 ACPI_FUNCTION_TRACE("acpi_ec_add"); 1044 ACPI_FUNCTION_TRACE("acpi_ec_add");
1129 1045
@@ -1143,26 +1059,31 @@ acpi_ec_polling_add (
1143 acpi_driver_data(device) = ec; 1059 acpi_driver_data(device) = ec;
1144 1060
1145 /* Use the global lock for all EC transactions? */ 1061 /* Use the global lock for all EC transactions? */
1146 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); 1062 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
1063 &ec->common.global_lock);
1147 1064
1148 /* If our UID matches the UID for the ECDT-enumerated EC, 1065 /* If our UID matches the UID for the ECDT-enumerated EC,
1149 we now have the *real* EC info, so kill the makeshift one.*/ 1066 we now have the *real* EC info, so kill the makeshift one. */
1150 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); 1067 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
1151 if (ec_ecdt && ec_ecdt->common.uid == uid) { 1068 if (ec_ecdt && ec_ecdt->common.uid == uid) {
1152 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, 1069 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
1153 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); 1070 ACPI_ADR_SPACE_EC,
1154 1071 &acpi_ec_space_handler);
1155 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); 1072
1073 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1074 &acpi_ec_gpe_handler);
1156 1075
1157 kfree(ec_ecdt); 1076 kfree(ec_ecdt);
1158 } 1077 }
1159 1078
1160 /* Get GPE bit assignment (EC events). */ 1079 /* Get GPE bit assignment (EC events). */
1161 /* TODO: Add support for _GPE returning a package */ 1080 /* TODO: Add support for _GPE returning a package */
1162 status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); 1081 status =
1082 acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
1083 &ec->common.gpe_bit);
1163 if (ACPI_FAILURE(status)) { 1084 if (ACPI_FAILURE(status)) {
1164 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1085 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1165 "Error obtaining GPE bit assignment\n")); 1086 "Error obtaining GPE bit assignment\n"));
1166 result = -ENODEV; 1087 result = -ENODEV;
1167 goto end; 1088 goto end;
1168 } 1089 }
@@ -1172,26 +1093,24 @@ acpi_ec_polling_add (
1172 goto end; 1093 goto end;
1173 1094
1174 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", 1095 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
1175 acpi_device_name(device), acpi_device_bid(device), 1096 acpi_device_name(device), acpi_device_bid(device),
1176 (u32) ec->common.gpe_bit); 1097 (u32) ec->common.gpe_bit);
1177 1098
1178 if (!first_ec) 1099 if (!first_ec)
1179 first_ec = device; 1100 first_ec = device;
1180 1101
1181end: 1102 end:
1182 if (result) 1103 if (result)
1183 kfree(ec); 1104 kfree(ec);
1184 1105
1185 return_VALUE(result); 1106 return_VALUE(result);
1186} 1107}
1187static int 1108static int acpi_ec_burst_add(struct acpi_device *device)
1188acpi_ec_burst_add (
1189 struct acpi_device *device)
1190{ 1109{
1191 int result = 0; 1110 int result = 0;
1192 acpi_status status = AE_OK; 1111 acpi_status status = AE_OK;
1193 union acpi_ec *ec = NULL; 1112 union acpi_ec *ec = NULL;
1194 unsigned long uid; 1113 unsigned long uid;
1195 1114
1196 ACPI_FUNCTION_TRACE("acpi_ec_add"); 1115 ACPI_FUNCTION_TRACE("acpi_ec_add");
1197 1116
@@ -1205,35 +1124,40 @@ acpi_ec_burst_add (
1205 1124
1206 ec->common.handle = device->handle; 1125 ec->common.handle = device->handle;
1207 ec->common.uid = -1; 1126 ec->common.uid = -1;
1208 atomic_set(&ec->burst.pending_gpe, 0); 1127 atomic_set(&ec->burst.pending_gpe, 0);
1209 atomic_set(&ec->burst.leaving_burst , 1); 1128 atomic_set(&ec->burst.leaving_burst, 1);
1210 init_MUTEX(&ec->burst.sem); 1129 init_MUTEX(&ec->burst.sem);
1211 init_waitqueue_head(&ec->burst.wait); 1130 init_waitqueue_head(&ec->burst.wait);
1212 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1131 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
1213 strcpy(acpi_device_class(device), ACPI_EC_CLASS); 1132 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
1214 acpi_driver_data(device) = ec; 1133 acpi_driver_data(device) = ec;
1215 1134
1216 /* Use the global lock for all EC transactions? */ 1135 /* Use the global lock for all EC transactions? */
1217 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); 1136 acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
1137 &ec->common.global_lock);
1218 1138
1219 /* If our UID matches the UID for the ECDT-enumerated EC, 1139 /* If our UID matches the UID for the ECDT-enumerated EC,
1220 we now have the *real* EC info, so kill the makeshift one.*/ 1140 we now have the *real* EC info, so kill the makeshift one. */
1221 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); 1141 acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
1222 if (ec_ecdt && ec_ecdt->common.uid == uid) { 1142 if (ec_ecdt && ec_ecdt->common.uid == uid) {
1223 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, 1143 acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
1224 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); 1144 ACPI_ADR_SPACE_EC,
1145 &acpi_ec_space_handler);
1225 1146
1226 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); 1147 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1148 &acpi_ec_gpe_handler);
1227 1149
1228 kfree(ec_ecdt); 1150 kfree(ec_ecdt);
1229 } 1151 }
1230 1152
1231 /* Get GPE bit assignment (EC events). */ 1153 /* Get GPE bit assignment (EC events). */
1232 /* TODO: Add support for _GPE returning a package */ 1154 /* TODO: Add support for _GPE returning a package */
1233 status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); 1155 status =
1156 acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
1157 &ec->common.gpe_bit);
1234 if (ACPI_FAILURE(status)) { 1158 if (ACPI_FAILURE(status)) {
1235 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1159 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1236 "Error obtaining GPE bit assignment\n")); 1160 "Error obtaining GPE bit assignment\n"));
1237 result = -ENODEV; 1161 result = -ENODEV;
1238 goto end; 1162 goto end;
1239 } 1163 }
@@ -1243,26 +1167,22 @@ acpi_ec_burst_add (
1243 goto end; 1167 goto end;
1244 1168
1245 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", 1169 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
1246 acpi_device_name(device), acpi_device_bid(device), 1170 acpi_device_name(device), acpi_device_bid(device),
1247 (u32) ec->common.gpe_bit); 1171 (u32) ec->common.gpe_bit);
1248 1172
1249 if (!first_ec) 1173 if (!first_ec)
1250 first_ec = device; 1174 first_ec = device;
1251 1175
1252end: 1176 end:
1253 if (result) 1177 if (result)
1254 kfree(ec); 1178 kfree(ec);
1255 1179
1256 return_VALUE(result); 1180 return_VALUE(result);
1257} 1181}
1258 1182
1259 1183static int acpi_ec_remove(struct acpi_device *device, int type)
1260static int
1261acpi_ec_remove (
1262 struct acpi_device *device,
1263 int type)
1264{ 1184{
1265 union acpi_ec *ec = NULL; 1185 union acpi_ec *ec = NULL;
1266 1186
1267 ACPI_FUNCTION_TRACE("acpi_ec_remove"); 1187 ACPI_FUNCTION_TRACE("acpi_ec_remove");
1268 1188
@@ -1278,13 +1198,10 @@ acpi_ec_remove (
1278 return_VALUE(0); 1198 return_VALUE(0);
1279} 1199}
1280 1200
1281
1282static acpi_status 1201static acpi_status
1283acpi_ec_io_ports ( 1202acpi_ec_io_ports(struct acpi_resource *resource, void *context)
1284 struct acpi_resource *resource,
1285 void *context)
1286{ 1203{
1287 union acpi_ec *ec = (union acpi_ec *) context; 1204 union acpi_ec *ec = (union acpi_ec *)context;
1288 struct acpi_generic_address *addr; 1205 struct acpi_generic_address *addr;
1289 1206
1290 if (resource->id != ACPI_RSTYPE_IO) { 1207 if (resource->id != ACPI_RSTYPE_IO) {
@@ -1312,13 +1229,10 @@ acpi_ec_io_ports (
1312 return AE_OK; 1229 return AE_OK;
1313} 1230}
1314 1231
1315 1232static int acpi_ec_start(struct acpi_device *device)
1316static int
1317acpi_ec_start (
1318 struct acpi_device *device)
1319{ 1233{
1320 acpi_status status = AE_OK; 1234 acpi_status status = AE_OK;
1321 union acpi_ec *ec = NULL; 1235 union acpi_ec *ec = NULL;
1322 1236
1323 ACPI_FUNCTION_TRACE("acpi_ec_start"); 1237 ACPI_FUNCTION_TRACE("acpi_ec_start");
1324 1238
@@ -1334,49 +1248,50 @@ acpi_ec_start (
1334 * Get I/O port addresses. Convert to GAS format. 1248 * Get I/O port addresses. Convert to GAS format.
1335 */ 1249 */
1336 status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, 1250 status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS,
1337 acpi_ec_io_ports, ec); 1251 acpi_ec_io_ports, ec);
1338 if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { 1252 if (ACPI_FAILURE(status)
1339 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); 1253 || ec->common.command_addr.register_bit_width == 0) {
1254 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1255 "Error getting I/O port addresses"));
1340 return_VALUE(-ENODEV); 1256 return_VALUE(-ENODEV);
1341 } 1257 }
1342 1258
1343 ec->common.status_addr = ec->common.command_addr; 1259 ec->common.status_addr = ec->common.command_addr;
1344 1260
1345 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", 1261 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",
1346 (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address, 1262 (u32) ec->common.gpe_bit,
1347 (u32) ec->common.data_addr.address)); 1263 (u32) ec->common.command_addr.address,
1348 1264 (u32) ec->common.data_addr.address));
1349 1265
1350 /* 1266 /*
1351 * Install GPE handler 1267 * Install GPE handler
1352 */ 1268 */
1353 status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, 1269 status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit,
1354 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); 1270 ACPI_GPE_EDGE_TRIGGERED,
1271 &acpi_ec_gpe_handler, ec);
1355 if (ACPI_FAILURE(status)) { 1272 if (ACPI_FAILURE(status)) {
1356 return_VALUE(-ENODEV); 1273 return_VALUE(-ENODEV);
1357 } 1274 }
1358 acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); 1275 acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
1359 acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 1276 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
1360 1277
1361 status = acpi_install_address_space_handler (ec->common.handle, 1278 status = acpi_install_address_space_handler(ec->common.handle,
1362 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, 1279 ACPI_ADR_SPACE_EC,
1363 &acpi_ec_space_setup, ec); 1280 &acpi_ec_space_handler,
1281 &acpi_ec_space_setup, ec);
1364 if (ACPI_FAILURE(status)) { 1282 if (ACPI_FAILURE(status)) {
1365 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); 1283 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
1284 &acpi_ec_gpe_handler);
1366 return_VALUE(-ENODEV); 1285 return_VALUE(-ENODEV);
1367 } 1286 }
1368 1287
1369 return_VALUE(AE_OK); 1288 return_VALUE(AE_OK);
1370} 1289}
1371 1290
1372 1291static int acpi_ec_stop(struct acpi_device *device, int type)
1373static int
1374acpi_ec_stop (
1375 struct acpi_device *device,
1376 int type)
1377{ 1292{
1378 acpi_status status = AE_OK; 1293 acpi_status status = AE_OK;
1379 union acpi_ec *ec = NULL; 1294 union acpi_ec *ec = NULL;
1380 1295
1381 ACPI_FUNCTION_TRACE("acpi_ec_stop"); 1296 ACPI_FUNCTION_TRACE("acpi_ec_stop");
1382 1297
@@ -1386,11 +1301,14 @@ acpi_ec_stop (
1386 ec = acpi_driver_data(device); 1301 ec = acpi_driver_data(device);
1387 1302
1388 status = acpi_remove_address_space_handler(ec->common.handle, 1303 status = acpi_remove_address_space_handler(ec->common.handle,
1389 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); 1304 ACPI_ADR_SPACE_EC,
1305 &acpi_ec_space_handler);
1390 if (ACPI_FAILURE(status)) 1306 if (ACPI_FAILURE(status))
1391 return_VALUE(-ENODEV); 1307 return_VALUE(-ENODEV);
1392 1308
1393 status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); 1309 status =
1310 acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
1311 &acpi_ec_gpe_handler);
1394 if (ACPI_FAILURE(status)) 1312 if (ACPI_FAILURE(status))
1395 return_VALUE(-ENODEV); 1313 return_VALUE(-ENODEV);
1396 1314
@@ -1398,32 +1316,26 @@ acpi_ec_stop (
1398} 1316}
1399 1317
1400static acpi_status __init 1318static acpi_status __init
1401acpi_fake_ecdt_callback ( 1319acpi_fake_ecdt_callback(acpi_handle handle,
1402 acpi_handle handle, 1320 u32 Level, void *context, void **retval)
1403 u32 Level,
1404 void *context,
1405 void **retval)
1406{ 1321{
1407 1322
1408 if (acpi_ec_polling_mode) 1323 if (acpi_ec_polling_mode)
1409 return acpi_fake_ecdt_polling_callback(handle, 1324 return acpi_fake_ecdt_polling_callback(handle,
1410 Level, context, retval); 1325 Level, context, retval);
1411 else 1326 else
1412 return acpi_fake_ecdt_burst_callback(handle, 1327 return acpi_fake_ecdt_burst_callback(handle,
1413 Level, context, retval); 1328 Level, context, retval);
1414} 1329}
1415 1330
1416static acpi_status __init 1331static acpi_status __init
1417acpi_fake_ecdt_polling_callback ( 1332acpi_fake_ecdt_polling_callback(acpi_handle handle,
1418 acpi_handle handle, 1333 u32 Level, void *context, void **retval)
1419 u32 Level,
1420 void *context,
1421 void **retval)
1422{ 1334{
1423 acpi_status status; 1335 acpi_status status;
1424 1336
1425 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 1337 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
1426 acpi_ec_io_ports, ec_ecdt); 1338 acpi_ec_io_ports, ec_ecdt);
1427 if (ACPI_FAILURE(status)) 1339 if (ACPI_FAILURE(status))
1428 return status; 1340 return status;
1429 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; 1341 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
@@ -1431,33 +1343,33 @@ acpi_fake_ecdt_polling_callback (
1431 ec_ecdt->common.uid = -1; 1343 ec_ecdt->common.uid = -1;
1432 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); 1344 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
1433 1345
1434 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); 1346 status =
1347 acpi_evaluate_integer(handle, "_GPE", NULL,
1348 &ec_ecdt->common.gpe_bit);
1435 if (ACPI_FAILURE(status)) 1349 if (ACPI_FAILURE(status))
1436 return status; 1350 return status;
1437 spin_lock_init(&ec_ecdt->polling.lock); 1351 spin_lock_init(&ec_ecdt->polling.lock);
1438 ec_ecdt->common.global_lock = TRUE; 1352 ec_ecdt->common.global_lock = TRUE;
1439 ec_ecdt->common.handle = handle; 1353 ec_ecdt->common.handle = handle;
1440 1354
1441 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", 1355 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
1442 (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, 1356 (u32) ec_ecdt->common.gpe_bit,
1443 (u32) ec_ecdt->common.data_addr.address); 1357 (u32) ec_ecdt->common.command_addr.address,
1358 (u32) ec_ecdt->common.data_addr.address);
1444 1359
1445 return AE_CTRL_TERMINATE; 1360 return AE_CTRL_TERMINATE;
1446} 1361}
1447 1362
1448static acpi_status __init 1363static acpi_status __init
1449acpi_fake_ecdt_burst_callback ( 1364acpi_fake_ecdt_burst_callback(acpi_handle handle,
1450 acpi_handle handle, 1365 u32 Level, void *context, void **retval)
1451 u32 Level,
1452 void *context,
1453 void **retval)
1454{ 1366{
1455 acpi_status status; 1367 acpi_status status;
1456 1368
1457 init_MUTEX(&ec_ecdt->burst.sem); 1369 init_MUTEX(&ec_ecdt->burst.sem);
1458 init_waitqueue_head(&ec_ecdt->burst.wait); 1370 init_waitqueue_head(&ec_ecdt->burst.wait);
1459 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 1371 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
1460 acpi_ec_io_ports, ec_ecdt); 1372 acpi_ec_io_ports, ec_ecdt);
1461 if (ACPI_FAILURE(status)) 1373 if (ACPI_FAILURE(status))
1462 return status; 1374 return status;
1463 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; 1375 ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
@@ -1465,15 +1377,18 @@ acpi_fake_ecdt_burst_callback (
1465 ec_ecdt->common.uid = -1; 1377 ec_ecdt->common.uid = -1;
1466 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); 1378 acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
1467 1379
1468 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); 1380 status =
1381 acpi_evaluate_integer(handle, "_GPE", NULL,
1382 &ec_ecdt->common.gpe_bit);
1469 if (ACPI_FAILURE(status)) 1383 if (ACPI_FAILURE(status))
1470 return status; 1384 return status;
1471 ec_ecdt->common.global_lock = TRUE; 1385 ec_ecdt->common.global_lock = TRUE;
1472 ec_ecdt->common.handle = handle; 1386 ec_ecdt->common.handle = handle;
1473 1387
1474 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", 1388 printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
1475 (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, 1389 (u32) ec_ecdt->common.gpe_bit,
1476 (u32) ec_ecdt->common.data_addr.address); 1390 (u32) ec_ecdt->common.command_addr.address,
1391 (u32) ec_ecdt->common.data_addr.address);
1477 1392
1478 return AE_CTRL_TERMINATE; 1393 return AE_CTRL_TERMINATE;
1479} 1394}
@@ -1488,11 +1403,10 @@ acpi_fake_ecdt_burst_callback (
1488 * op region (since _REG isn't invoked yet). The assumption is true for 1403 * op region (since _REG isn't invoked yet). The assumption is true for
1489 * all systems found. 1404 * all systems found.
1490 */ 1405 */
1491static int __init 1406static int __init acpi_ec_fake_ecdt(void)
1492acpi_ec_fake_ecdt(void)
1493{ 1407{
1494 acpi_status status; 1408 acpi_status status;
1495 int ret = 0; 1409 int ret = 0;
1496 1410
1497 printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); 1411 printk(KERN_INFO PREFIX "Try to make an fake ECDT\n");
1498 1412
@@ -1503,10 +1417,8 @@ acpi_ec_fake_ecdt(void)
1503 } 1417 }
1504 memset(ec_ecdt, 0, sizeof(union acpi_ec)); 1418 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1505 1419
1506 status = acpi_get_devices (ACPI_EC_HID, 1420 status = acpi_get_devices(ACPI_EC_HID,
1507 acpi_fake_ecdt_callback, 1421 acpi_fake_ecdt_callback, NULL, NULL);
1508 NULL,
1509 NULL);
1510 if (ACPI_FAILURE(status)) { 1422 if (ACPI_FAILURE(status)) {
1511 kfree(ec_ecdt); 1423 kfree(ec_ecdt);
1512 ec_ecdt = NULL; 1424 ec_ecdt = NULL;
@@ -1514,13 +1426,12 @@ acpi_ec_fake_ecdt(void)
1514 goto error; 1426 goto error;
1515 } 1427 }
1516 return 0; 1428 return 0;
1517error: 1429 error:
1518 printk(KERN_ERR PREFIX "Can't make an fake ECDT\n"); 1430 printk(KERN_ERR PREFIX "Can't make an fake ECDT\n");
1519 return ret; 1431 return ret;
1520} 1432}
1521 1433
1522static int __init 1434static int __init acpi_ec_get_real_ecdt(void)
1523acpi_ec_get_real_ecdt(void)
1524{ 1435{
1525 if (acpi_ec_polling_mode) 1436 if (acpi_ec_polling_mode)
1526 return acpi_ec_polling_get_real_ecdt(); 1437 return acpi_ec_polling_get_real_ecdt();
@@ -1528,14 +1439,14 @@ acpi_ec_get_real_ecdt(void)
1528 return acpi_ec_burst_get_real_ecdt(); 1439 return acpi_ec_burst_get_real_ecdt();
1529} 1440}
1530 1441
1531static int __init 1442static int __init acpi_ec_polling_get_real_ecdt(void)
1532acpi_ec_polling_get_real_ecdt(void)
1533{ 1443{
1534 acpi_status status; 1444 acpi_status status;
1535 struct acpi_table_ecdt *ecdt_ptr; 1445 struct acpi_table_ecdt *ecdt_ptr;
1536 1446
1537 status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, 1447 status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
1538 (struct acpi_table_header **) &ecdt_ptr); 1448 (struct acpi_table_header **)
1449 &ecdt_ptr);
1539 if (ACPI_FAILURE(status)) 1450 if (ACPI_FAILURE(status))
1540 return -ENODEV; 1451 return -ENODEV;
1541 1452
@@ -1558,13 +1469,14 @@ acpi_ec_polling_get_real_ecdt(void)
1558 ec_ecdt->common.global_lock = TRUE; 1469 ec_ecdt->common.global_lock = TRUE;
1559 ec_ecdt->common.uid = ecdt_ptr->uid; 1470 ec_ecdt->common.uid = ecdt_ptr->uid;
1560 1471
1561 status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); 1472 status =
1473 acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
1562 if (ACPI_FAILURE(status)) { 1474 if (ACPI_FAILURE(status)) {
1563 goto error; 1475 goto error;
1564 } 1476 }
1565 1477
1566 return 0; 1478 return 0;
1567error: 1479 error:
1568 printk(KERN_ERR PREFIX "Could not use ECDT\n"); 1480 printk(KERN_ERR PREFIX "Could not use ECDT\n");
1569 kfree(ec_ecdt); 1481 kfree(ec_ecdt);
1570 ec_ecdt = NULL; 1482 ec_ecdt = NULL;
@@ -1572,15 +1484,14 @@ error:
1572 return -ENODEV; 1484 return -ENODEV;
1573} 1485}
1574 1486
1575 1487static int __init acpi_ec_burst_get_real_ecdt(void)
1576static int __init
1577acpi_ec_burst_get_real_ecdt(void)
1578{ 1488{
1579 acpi_status status; 1489 acpi_status status;
1580 struct acpi_table_ecdt *ecdt_ptr; 1490 struct acpi_table_ecdt *ecdt_ptr;
1581 1491
1582 status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, 1492 status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
1583 (struct acpi_table_header **) &ecdt_ptr); 1493 (struct acpi_table_header **)
1494 &ecdt_ptr);
1584 if (ACPI_FAILURE(status)) 1495 if (ACPI_FAILURE(status))
1585 return -ENODEV; 1496 return -ENODEV;
1586 1497
@@ -1594,8 +1505,8 @@ acpi_ec_burst_get_real_ecdt(void)
1594 return -ENOMEM; 1505 return -ENOMEM;
1595 memset(ec_ecdt, 0, sizeof(union acpi_ec)); 1506 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1596 1507
1597 init_MUTEX(&ec_ecdt->burst.sem); 1508 init_MUTEX(&ec_ecdt->burst.sem);
1598 init_waitqueue_head(&ec_ecdt->burst.wait); 1509 init_waitqueue_head(&ec_ecdt->burst.wait);
1599 ec_ecdt->common.command_addr = ecdt_ptr->ec_control; 1510 ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
1600 ec_ecdt->common.status_addr = ecdt_ptr->ec_control; 1511 ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
1601 ec_ecdt->common.data_addr = ecdt_ptr->ec_data; 1512 ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
@@ -1604,13 +1515,14 @@ acpi_ec_burst_get_real_ecdt(void)
1604 ec_ecdt->common.global_lock = TRUE; 1515 ec_ecdt->common.global_lock = TRUE;
1605 ec_ecdt->common.uid = ecdt_ptr->uid; 1516 ec_ecdt->common.uid = ecdt_ptr->uid;
1606 1517
1607 status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); 1518 status =
1519 acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
1608 if (ACPI_FAILURE(status)) { 1520 if (ACPI_FAILURE(status)) {
1609 goto error; 1521 goto error;
1610 } 1522 }
1611 1523
1612 return 0; 1524 return 0;
1613error: 1525 error:
1614 printk(KERN_ERR PREFIX "Could not use ECDT\n"); 1526 printk(KERN_ERR PREFIX "Could not use ECDT\n");
1615 kfree(ec_ecdt); 1527 kfree(ec_ecdt);
1616 ec_ecdt = NULL; 1528 ec_ecdt = NULL;
@@ -1619,11 +1531,10 @@ error:
1619} 1531}
1620 1532
1621static int __initdata acpi_fake_ecdt_enabled; 1533static int __initdata acpi_fake_ecdt_enabled;
1622int __init 1534int __init acpi_ec_ecdt_probe(void)
1623acpi_ec_ecdt_probe (void)
1624{ 1535{
1625 acpi_status status; 1536 acpi_status status;
1626 int ret; 1537 int ret;
1627 1538
1628 ret = acpi_ec_get_real_ecdt(); 1539 ret = acpi_ec_get_real_ecdt();
1629 /* Try to make a fake ECDT */ 1540 /* Try to make a fake ECDT */
@@ -1638,26 +1549,28 @@ acpi_ec_ecdt_probe (void)
1638 * Install GPE handler 1549 * Install GPE handler
1639 */ 1550 */
1640 status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, 1551 status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1641 ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, 1552 ACPI_GPE_EDGE_TRIGGERED,
1642 ec_ecdt); 1553 &acpi_ec_gpe_handler, ec_ecdt);
1643 if (ACPI_FAILURE(status)) { 1554 if (ACPI_FAILURE(status)) {
1644 goto error; 1555 goto error;
1645 } 1556 }
1646 acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); 1557 acpi_set_gpe_type(NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
1647 acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); 1558 acpi_enable_gpe(NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);
1648 1559
1649 status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, 1560 status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
1650 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, 1561 ACPI_ADR_SPACE_EC,
1651 &acpi_ec_space_setup, ec_ecdt); 1562 &acpi_ec_space_handler,
1563 &acpi_ec_space_setup,
1564 ec_ecdt);
1652 if (ACPI_FAILURE(status)) { 1565 if (ACPI_FAILURE(status)) {
1653 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, 1566 acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
1654 &acpi_ec_gpe_handler); 1567 &acpi_ec_gpe_handler);
1655 goto error; 1568 goto error;
1656 } 1569 }
1657 1570
1658 return 0; 1571 return 0;
1659 1572
1660error: 1573 error:
1661 printk(KERN_ERR PREFIX "Could not use ECDT\n"); 1574 printk(KERN_ERR PREFIX "Could not use ECDT\n");
1662 kfree(ec_ecdt); 1575 kfree(ec_ecdt);
1663 ec_ecdt = NULL; 1576 ec_ecdt = NULL;
@@ -1665,10 +1578,9 @@ error:
1665 return -ENODEV; 1578 return -ENODEV;
1666} 1579}
1667 1580
1668 1581static int __init acpi_ec_init(void)
1669static int __init acpi_ec_init (void)
1670{ 1582{
1671 int result = 0; 1583 int result = 0;
1672 1584
1673 ACPI_FUNCTION_TRACE("acpi_ec_init"); 1585 ACPI_FUNCTION_TRACE("acpi_ec_init");
1674 1586
@@ -1693,8 +1605,7 @@ subsys_initcall(acpi_ec_init);
1693 1605
1694/* EC driver currently not unloadable */ 1606/* EC driver currently not unloadable */
1695#if 0 1607#if 0
1696static void __exit 1608static void __exit acpi_ec_exit(void)
1697acpi_ec_exit (void)
1698{ 1609{
1699 ACPI_FUNCTION_TRACE("acpi_ec_exit"); 1610 ACPI_FUNCTION_TRACE("acpi_ec_exit");
1700 1611
@@ -1704,7 +1615,7 @@ acpi_ec_exit (void)
1704 1615
1705 return_VOID; 1616 return_VOID;
1706} 1617}
1707#endif /* 0 */ 1618#endif /* 0 */
1708 1619
1709static int __init acpi_fake_ecdt_setup(char *str) 1620static int __init acpi_fake_ecdt_setup(char *str)
1710{ 1621{
@@ -1727,8 +1638,8 @@ static int __init acpi_ec_set_polling_mode(char *str)
1727 acpi_ec_polling_mode = EC_POLLING; 1638 acpi_ec_polling_mode = EC_POLLING;
1728 acpi_ec_driver.ops.add = acpi_ec_polling_add; 1639 acpi_ec_driver.ops.add = acpi_ec_polling_add;
1729 } 1640 }
1730 printk(KERN_INFO PREFIX "EC %s mode.\n", 1641 printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling");
1731 burst ? "burst": "polling");
1732 return 0; 1642 return 0;
1733} 1643}
1644
1734__setup("ec_burst=", acpi_ec_set_polling_mode); 1645__setup("ec_burst=", acpi_ec_set_polling_mode);