aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-12-05 16:33:04 -0500
committerLen Brown <len.brown@intel.com>2005-12-05 16:37:16 -0500
commit02b28a33aae93a3b53068e0858d62f8bcaef60a3 (patch)
tree209d0d60c16aca4be49534e2a23eb24adad3b11f /drivers
parent06a2a3855e20ed3df380d69b37130ba86bec8001 (diff)
[ACPI] Embedded Controller (EC) driver syntax update
"intr" largely replaces "burst" for syntax to follow semantics "poll" largely replaces "polling" for economy of expression append "interrupt mode" or "polling mode" to dmesg line no functional changes Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ec.c233
1 files changed, 117 insertions, 116 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 6edfbe6f187c..bb3963b49a98 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -60,20 +60,20 @@ ACPI_MODULE_NAME("acpi_ec")
60#define ACPI_EC_BURST_ENABLE 0x82 60#define ACPI_EC_BURST_ENABLE 0x82
61#define ACPI_EC_BURST_DISABLE 0x83 61#define ACPI_EC_BURST_DISABLE 0x83
62#define ACPI_EC_COMMAND_QUERY 0x84 62#define ACPI_EC_COMMAND_QUERY 0x84
63#define EC_POLLING 0xFF 63#define EC_POLL 0xFF
64#define EC_BURST 0x00 64#define EC_INTR 0x00
65static int acpi_ec_remove(struct acpi_device *device, int type); 65static int acpi_ec_remove(struct acpi_device *device, int type);
66static int acpi_ec_start(struct acpi_device *device); 66static int acpi_ec_start(struct acpi_device *device);
67static int acpi_ec_stop(struct acpi_device *device, int type); 67static int acpi_ec_stop(struct acpi_device *device, int type);
68static int acpi_ec_burst_add(struct acpi_device *device); 68static int acpi_ec_intr_add(struct acpi_device *device);
69static int acpi_ec_polling_add(struct acpi_device *device); 69static int acpi_ec_poll_add(struct acpi_device *device);
70 70
71static struct acpi_driver acpi_ec_driver = { 71static struct acpi_driver acpi_ec_driver = {
72 .name = ACPI_EC_DRIVER_NAME, 72 .name = ACPI_EC_DRIVER_NAME,
73 .class = ACPI_EC_CLASS, 73 .class = ACPI_EC_CLASS,
74 .ids = ACPI_EC_HID, 74 .ids = ACPI_EC_HID,
75 .ops = { 75 .ops = {
76 .add = acpi_ec_polling_add, 76 .add = acpi_ec_poll_add,
77 .remove = acpi_ec_remove, 77 .remove = acpi_ec_remove,
78 .start = acpi_ec_start, 78 .start = acpi_ec_start,
79 .stop = acpi_ec_stop, 79 .stop = acpi_ec_stop,
@@ -105,7 +105,7 @@ union acpi_ec {
105 atomic_t pending_gpe; 105 atomic_t pending_gpe;
106 struct semaphore sem; 106 struct semaphore sem;
107 wait_queue_head_t wait; 107 wait_queue_head_t wait;
108 } burst; 108 } intr;
109 109
110 struct { 110 struct {
111 u32 mode; 111 u32 mode;
@@ -117,37 +117,37 @@ union acpi_ec {
117 struct acpi_generic_address data_addr; 117 struct acpi_generic_address data_addr;
118 unsigned long global_lock; 118 unsigned long global_lock;
119 spinlock_t lock; 119 spinlock_t lock;
120 } polling; 120 } poll;
121}; 121};
122 122
123static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); 123static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event);
124static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); 124static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event);
125static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); 125static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data);
126static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); 126static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data);
127static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); 127static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data);
128static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); 128static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data);
129static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); 129static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data);
130static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); 130static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data);
131static void acpi_ec_gpe_polling_query(void *ec_cxt); 131static void acpi_ec_gpe_poll_query(void *ec_cxt);
132static void acpi_ec_gpe_burst_query(void *ec_cxt); 132static void acpi_ec_gpe_intr_query(void *ec_cxt);
133static u32 acpi_ec_gpe_polling_handler(void *data); 133static u32 acpi_ec_gpe_poll_handler(void *data);
134static u32 acpi_ec_gpe_burst_handler(void *data); 134static u32 acpi_ec_gpe_intr_handler(void *data);
135static acpi_status __init 135static acpi_status __init
136acpi_fake_ecdt_polling_callback(acpi_handle handle, 136acpi_fake_ecdt_poll_callback(acpi_handle handle,
137 u32 Level, void *context, void **retval); 137 u32 Level, void *context, void **retval);
138 138
139static acpi_status __init 139static acpi_status __init
140acpi_fake_ecdt_burst_callback(acpi_handle handle, 140acpi_fake_ecdt_intr_callback(acpi_handle handle,
141 u32 Level, void *context, void **retval); 141 u32 Level, void *context, void **retval);
142 142
143static int __init acpi_ec_polling_get_real_ecdt(void); 143static int __init acpi_ec_poll_get_real_ecdt(void);
144static int __init acpi_ec_burst_get_real_ecdt(void); 144static int __init acpi_ec_intr_get_real_ecdt(void);
145/* 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 */
146static union acpi_ec *ec_ecdt; 146static union acpi_ec *ec_ecdt;
147 147
148/* External interfaces use first EC only, so remember */ 148/* External interfaces use first EC only, so remember */
149static struct acpi_device *first_ec; 149static struct acpi_device *first_ec;
150static int acpi_ec_polling_mode = EC_POLLING; 150static int acpi_ec_poll_mode = EC_POLL;
151 151
152/* -------------------------------------------------------------------------- 152/* --------------------------------------------------------------------------
153 Transaction Management 153 Transaction Management
@@ -163,13 +163,13 @@ static inline u32 acpi_ec_read_status(union acpi_ec *ec)
163 163
164static int acpi_ec_wait(union acpi_ec *ec, u8 event) 164static int acpi_ec_wait(union acpi_ec *ec, u8 event)
165{ 165{
166 if (acpi_ec_polling_mode) 166 if (acpi_ec_poll_mode)
167 return acpi_ec_polling_wait(ec, event); 167 return acpi_ec_poll_wait(ec, event);
168 else 168 else
169 return acpi_ec_burst_wait(ec, event); 169 return acpi_ec_intr_wait(ec, event);
170} 170}
171 171
172static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) 172static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event)
173{ 173{
174 u32 acpi_ec_status = 0; 174 u32 acpi_ec_status = 0;
175 u32 i = ACPI_EC_UDELAY_COUNT; 175 u32 i = ACPI_EC_UDELAY_COUNT;
@@ -203,19 +203,19 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
203 203
204 return -ETIME; 204 return -ETIME;
205} 205}
206static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) 206static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
207{ 207{
208 int result = 0; 208 int result = 0;
209 209
210 ACPI_FUNCTION_TRACE("acpi_ec_wait"); 210 ACPI_FUNCTION_TRACE("acpi_ec_wait");
211 211
212 ec->burst.expect_event = event; 212 ec->intr.expect_event = event;
213 smp_mb(); 213 smp_mb();
214 214
215 switch (event) { 215 switch (event) {
216 case ACPI_EC_EVENT_IBE: 216 case ACPI_EC_EVENT_IBE:
217 if (~acpi_ec_read_status(ec) & event) { 217 if (~acpi_ec_read_status(ec) & event) {
218 ec->burst.expect_event = 0; 218 ec->intr.expect_event = 0;
219 return_VALUE(0); 219 return_VALUE(0);
220 } 220 }
221 break; 221 break;
@@ -223,11 +223,11 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
223 break; 223 break;
224 } 224 }
225 225
226 result = wait_event_timeout(ec->burst.wait, 226 result = wait_event_timeout(ec->intr.wait,
227 !ec->burst.expect_event, 227 !ec->intr.expect_event,
228 msecs_to_jiffies(ACPI_EC_DELAY)); 228 msecs_to_jiffies(ACPI_EC_DELAY));
229 229
230 ec->burst.expect_event = 0; 230 ec->intr.expect_event = 0;
231 smp_mb(); 231 smp_mb();
232 232
233 /* 233 /*
@@ -250,6 +250,7 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
250 return_VALUE(-ETIME); 250 return_VALUE(-ETIME);
251} 251}
252 252
253#ifdef ACPI_FUTURE_USAGE
253/* 254/*
254 * Note: samsung nv5000 doesn't work with ec burst mode. 255 * Note: samsung nv5000 doesn't work with ec burst mode.
255 * http://bugzilla.kernel.org/show_bug.cgi?id=4980 256 * http://bugzilla.kernel.org/show_bug.cgi?id=4980
@@ -275,7 +276,7 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec)
275 } 276 }
276 } 277 }
277 278
278 atomic_set(&ec->burst.leaving_burst, 0); 279 atomic_set(&ec->intr.leaving_burst, 0);
279 return_VALUE(0); 280 return_VALUE(0);
280 end: 281 end:
281 printk("Error in acpi_ec_wait\n"); 282 printk("Error in acpi_ec_wait\n");
@@ -296,28 +297,29 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec)
296 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); 297 acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
297 acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); 298 acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
298 } 299 }
299 atomic_set(&ec->burst.leaving_burst, 1); 300 atomic_set(&ec->intr.leaving_burst, 1);
300 return_VALUE(0); 301 return_VALUE(0);
301end: 302end:
302 printk("leave burst_mode:error \n"); 303 printk("leave burst_mode:error \n");
303 return_VALUE(-1); 304 return_VALUE(-1);
304} 305}
306#endif /* ACPI_FUTURE_USAGE */
305 307
306static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) 308static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
307{ 309{
308 if (acpi_ec_polling_mode) 310 if (acpi_ec_poll_mode)
309 return acpi_ec_polling_read(ec, address, data); 311 return acpi_ec_poll_read(ec, address, data);
310 else 312 else
311 return acpi_ec_burst_read(ec, address, data); 313 return acpi_ec_intr_read(ec, address, data);
312} 314}
313static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) 315static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
314{ 316{
315 if (acpi_ec_polling_mode) 317 if (acpi_ec_poll_mode)
316 return acpi_ec_polling_write(ec, address, data); 318 return acpi_ec_poll_write(ec, address, data);
317 else 319 else
318 return acpi_ec_burst_write(ec, address, data); 320 return acpi_ec_intr_write(ec, address, data);
319} 321}
320static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) 322static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
321{ 323{
322 acpi_status status = AE_OK; 324 acpi_status status = AE_OK;
323 int result = 0; 325 int result = 0;
@@ -337,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
337 return_VALUE(-ENODEV); 339 return_VALUE(-ENODEV);
338 } 340 }
339 341
340 spin_lock_irqsave(&ec->polling.lock, flags); 342 spin_lock_irqsave(&ec->poll.lock, flags);
341 343
342 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, 344 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
343 &ec->common.command_addr); 345 &ec->common.command_addr);
@@ -356,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
356 *data, address)); 358 *data, address));
357 359
358 end: 360 end:
359 spin_unlock_irqrestore(&ec->polling.lock, flags); 361 spin_unlock_irqrestore(&ec->poll.lock, flags);
360 362
361 if (ec->common.global_lock) 363 if (ec->common.global_lock)
362 acpi_release_global_lock(glk); 364 acpi_release_global_lock(glk);
@@ -364,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
364 return_VALUE(result); 366 return_VALUE(result);
365} 367}
366 368
367static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) 369static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
368{ 370{
369 int result = 0; 371 int result = 0;
370 acpi_status status = AE_OK; 372 acpi_status status = AE_OK;
@@ -382,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
382 return_VALUE(-ENODEV); 384 return_VALUE(-ENODEV);
383 } 385 }
384 386
385 spin_lock_irqsave(&ec->polling.lock, flags); 387 spin_lock_irqsave(&ec->poll.lock, flags);
386 388
387 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, 389 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
388 &ec->common.command_addr); 390 &ec->common.command_addr);
@@ -404,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
404 data, address)); 406 data, address));
405 407
406 end: 408 end:
407 spin_unlock_irqrestore(&ec->polling.lock, flags); 409 spin_unlock_irqrestore(&ec->poll.lock, flags);
408 410
409 if (ec->common.global_lock) 411 if (ec->common.global_lock)
410 acpi_release_global_lock(glk); 412 acpi_release_global_lock(glk);
@@ -412,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
412 return_VALUE(result); 414 return_VALUE(result);
413} 415}
414 416
415static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) 417static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
416{ 418{
417 int status = 0; 419 int status = 0;
418 u32 glk; 420 u32 glk;
@@ -431,7 +433,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
431 } 433 }
432 434
433 WARN_ON(in_interrupt()); 435 WARN_ON(in_interrupt());
434 down(&ec->burst.sem); 436 down(&ec->intr.sem);
435 437
436 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 438 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
437 if (status) { 439 if (status) {
@@ -456,7 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
456 *data, address)); 458 *data, address));
457 459
458 end: 460 end:
459 up(&ec->burst.sem); 461 up(&ec->intr.sem);
460 462
461 if (ec->common.global_lock) 463 if (ec->common.global_lock)
462 acpi_release_global_lock(glk); 464 acpi_release_global_lock(glk);
@@ -464,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
464 return_VALUE(status); 466 return_VALUE(status);
465} 467}
466 468
467static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) 469static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
468{ 470{
469 int status = 0; 471 int status = 0;
470 u32 glk; 472 u32 glk;
@@ -481,7 +483,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
481 } 483 }
482 484
483 WARN_ON(in_interrupt()); 485 WARN_ON(in_interrupt());
484 down(&ec->burst.sem); 486 down(&ec->intr.sem);
485 487
486 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 488 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
487 if (status) { 489 if (status) {
@@ -505,7 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
505 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", 507 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
506 data, address)); 508 data, address));
507 509
508 up(&ec->burst.sem); 510 up(&ec->intr.sem);
509 511
510 if (ec->common.global_lock) 512 if (ec->common.global_lock)
511 acpi_release_global_lock(glk); 513 acpi_release_global_lock(glk);
@@ -557,12 +559,12 @@ EXPORT_SYMBOL(ec_write);
557 559
558static int acpi_ec_query(union acpi_ec *ec, u32 * data) 560static int acpi_ec_query(union acpi_ec *ec, u32 * data)
559{ 561{
560 if (acpi_ec_polling_mode) 562 if (acpi_ec_poll_mode)
561 return acpi_ec_polling_query(ec, data); 563 return acpi_ec_poll_query(ec, data);
562 else 564 else
563 return acpi_ec_burst_query(ec, data); 565 return acpi_ec_intr_query(ec, data);
564} 566}
565static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) 567static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
566{ 568{
567 int result = 0; 569 int result = 0;
568 acpi_status status = AE_OK; 570 acpi_status status = AE_OK;
@@ -587,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
587 * Note that successful completion of the query causes the ACPI_EC_SCI 589 * Note that successful completion of the query causes the ACPI_EC_SCI
588 * bit to be cleared (and thus clearing the interrupt source). 590 * bit to be cleared (and thus clearing the interrupt source).
589 */ 591 */
590 spin_lock_irqsave(&ec->polling.lock, flags); 592 spin_lock_irqsave(&ec->poll.lock, flags);
591 593
592 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, 594 acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
593 &ec->common.command_addr); 595 &ec->common.command_addr);
@@ -600,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
600 result = -ENODATA; 602 result = -ENODATA;
601 603
602 end: 604 end:
603 spin_unlock_irqrestore(&ec->polling.lock, flags); 605 spin_unlock_irqrestore(&ec->poll.lock, flags);
604 606
605 if (ec->common.global_lock) 607 if (ec->common.global_lock)
606 acpi_release_global_lock(glk); 608 acpi_release_global_lock(glk);
607 609
608 return_VALUE(result); 610 return_VALUE(result);
609} 611}
610static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) 612static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
611{ 613{
612 int status = 0; 614 int status = 0;
613 u32 glk; 615 u32 glk;
@@ -624,7 +626,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
624 return_VALUE(-ENODEV); 626 return_VALUE(-ENODEV);
625 } 627 }
626 628
627 down(&ec->burst.sem); 629 down(&ec->intr.sem);
628 630
629 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); 631 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
630 if (status) { 632 if (status) {
@@ -649,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
649 status = -ENODATA; 651 status = -ENODATA;
650 652
651 end: 653 end:
652 up(&ec->burst.sem); 654 up(&ec->intr.sem);
653 655
654 if (ec->common.global_lock) 656 if (ec->common.global_lock)
655 acpi_release_global_lock(glk); 657 acpi_release_global_lock(glk);
@@ -668,13 +670,13 @@ union acpi_ec_query_data {
668 670
669static void acpi_ec_gpe_query(void *ec_cxt) 671static void acpi_ec_gpe_query(void *ec_cxt)
670{ 672{
671 if (acpi_ec_polling_mode) 673 if (acpi_ec_poll_mode)
672 acpi_ec_gpe_polling_query(ec_cxt); 674 acpi_ec_gpe_poll_query(ec_cxt);
673 else 675 else
674 acpi_ec_gpe_burst_query(ec_cxt); 676 acpi_ec_gpe_intr_query(ec_cxt);
675} 677}
676 678
677static void acpi_ec_gpe_polling_query(void *ec_cxt) 679static void acpi_ec_gpe_poll_query(void *ec_cxt)
678{ 680{
679 union acpi_ec *ec = (union acpi_ec *)ec_cxt; 681 union acpi_ec *ec = (union acpi_ec *)ec_cxt;
680 u32 value = 0; 682 u32 value = 0;
@@ -689,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
689 if (!ec_cxt) 691 if (!ec_cxt)
690 goto end; 692 goto end;
691 693
692 spin_lock_irqsave(&ec->polling.lock, flags); 694 spin_lock_irqsave(&ec->poll.lock, flags);
693 acpi_hw_low_level_read(8, &value, &ec->common.command_addr); 695 acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
694 spin_unlock_irqrestore(&ec->polling.lock, flags); 696 spin_unlock_irqrestore(&ec->poll.lock, flags);
695 697
696 /* TBD: Implement asynch events! 698 /* TBD: Implement asynch events!
697 * NOTE: All we care about are EC-SCI's. Other EC events are 699 * NOTE: All we care about are EC-SCI's. Other EC events are
@@ -715,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
715 end: 717 end:
716 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); 718 acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
717} 719}
718static void acpi_ec_gpe_burst_query(void *ec_cxt) 720static void acpi_ec_gpe_intr_query(void *ec_cxt)
719{ 721{
720 union acpi_ec *ec = (union acpi_ec *)ec_cxt; 722 union acpi_ec *ec = (union acpi_ec *)ec_cxt;
721 u32 value; 723 u32 value;
@@ -740,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt)
740 742
741 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); 743 acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
742 end: 744 end:
743 atomic_dec(&ec->burst.pending_gpe); 745 atomic_dec(&ec->intr.pending_gpe);
744 return; 746 return;
745} 747}
746 748
747static u32 acpi_ec_gpe_handler(void *data) 749static u32 acpi_ec_gpe_handler(void *data)
748{ 750{
749 if (acpi_ec_polling_mode) 751 if (acpi_ec_poll_mode)
750 return acpi_ec_gpe_polling_handler(data); 752 return acpi_ec_gpe_poll_handler(data);
751 else 753 else
752 return acpi_ec_gpe_burst_handler(data); 754 return acpi_ec_gpe_intr_handler(data);
753} 755}
754static u32 acpi_ec_gpe_polling_handler(void *data) 756static u32 acpi_ec_gpe_poll_handler(void *data)
755{ 757{
756 acpi_status status = AE_OK; 758 acpi_status status = AE_OK;
757 union acpi_ec *ec = (union acpi_ec *)data; 759 union acpi_ec *ec = (union acpi_ec *)data;
@@ -769,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data)
769 else 771 else
770 return ACPI_INTERRUPT_NOT_HANDLED; 772 return ACPI_INTERRUPT_NOT_HANDLED;
771} 773}
772static u32 acpi_ec_gpe_burst_handler(void *data) 774static u32 acpi_ec_gpe_intr_handler(void *data)
773{ 775{
774 acpi_status status = AE_OK; 776 acpi_status status = AE_OK;
775 u32 value; 777 u32 value;
@@ -781,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data)
781 acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); 783 acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
782 value = acpi_ec_read_status(ec); 784 value = acpi_ec_read_status(ec);
783 785
784 switch (ec->burst.expect_event) { 786 switch (ec->intr.expect_event) {
785 case ACPI_EC_EVENT_OBF: 787 case ACPI_EC_EVENT_OBF:
786 if (!(value & ACPI_EC_FLAG_OBF)) 788 if (!(value & ACPI_EC_FLAG_OBF))
787 break; 789 break;
788 case ACPI_EC_EVENT_IBE: 790 case ACPI_EC_EVENT_IBE:
789 if ((value & ACPI_EC_FLAG_IBF)) 791 if ((value & ACPI_EC_FLAG_IBF))
790 break; 792 break;
791 ec->burst.expect_event = 0; 793 ec->intr.expect_event = 0;
792 wake_up(&ec->burst.wait); 794 wake_up(&ec->intr.wait);
793 return ACPI_INTERRUPT_HANDLED; 795 return ACPI_INTERRUPT_HANDLED;
794 default: 796 default:
795 break; 797 break;
796 } 798 }
797 799
798 if (value & ACPI_EC_FLAG_SCI) { 800 if (value & ACPI_EC_FLAG_SCI) {
799 atomic_add(1, &ec->burst.pending_gpe); 801 atomic_add(1, &ec->intr.pending_gpe);
800 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, 802 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
801 acpi_ec_gpe_query, ec); 803 acpi_ec_gpe_query, ec);
802 return status == AE_OK ? 804 return status == AE_OK ?
@@ -984,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device)
984 Driver Interface 986 Driver Interface
985 -------------------------------------------------------------------------- */ 987 -------------------------------------------------------------------------- */
986 988
987static int acpi_ec_polling_add(struct acpi_device *device) 989static int acpi_ec_poll_add(struct acpi_device *device)
988{ 990{
989 int result = 0; 991 int result = 0;
990 acpi_status status = AE_OK; 992 acpi_status status = AE_OK;
@@ -1003,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
1003 1005
1004 ec->common.handle = device->handle; 1006 ec->common.handle = device->handle;
1005 ec->common.uid = -1; 1007 ec->common.uid = -1;
1006 spin_lock_init(&ec->polling.lock); 1008 spin_lock_init(&ec->poll.lock);
1007 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1009 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
1008 strcpy(acpi_device_class(device), ACPI_EC_CLASS); 1010 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
1009 acpi_driver_data(device) = ec; 1011 acpi_driver_data(device) = ec;
@@ -1042,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
1042 if (result) 1044 if (result)
1043 goto end; 1045 goto end;
1044 1046
1045 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", 1047 printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n",
1046 acpi_device_name(device), acpi_device_bid(device), 1048 acpi_device_name(device), acpi_device_bid(device),
1047 (u32) ec->common.gpe_bit); 1049 (u32) ec->common.gpe_bit);
1048 1050
@@ -1055,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
1055 1057
1056 return_VALUE(result); 1058 return_VALUE(result);
1057} 1059}
1058static int acpi_ec_burst_add(struct acpi_device *device) 1060static int acpi_ec_intr_add(struct acpi_device *device)
1059{ 1061{
1060 int result = 0; 1062 int result = 0;
1061 acpi_status status = AE_OK; 1063 acpi_status status = AE_OK;
@@ -1074,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device)
1074 1076
1075 ec->common.handle = device->handle; 1077 ec->common.handle = device->handle;
1076 ec->common.uid = -1; 1078 ec->common.uid = -1;
1077 atomic_set(&ec->burst.pending_gpe, 0); 1079 atomic_set(&ec->intr.pending_gpe, 0);
1078 atomic_set(&ec->burst.leaving_burst, 1); 1080 atomic_set(&ec->intr.leaving_burst, 1);
1079 init_MUTEX(&ec->burst.sem); 1081 init_MUTEX(&ec->intr.sem);
1080 init_waitqueue_head(&ec->burst.wait); 1082 init_waitqueue_head(&ec->intr.wait);
1081 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 1083 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
1082 strcpy(acpi_device_class(device), ACPI_EC_CLASS); 1084 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
1083 acpi_driver_data(device) = ec; 1085 acpi_driver_data(device) = ec;
@@ -1116,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device)
1116 if (result) 1118 if (result)
1117 goto end; 1119 goto end;
1118 1120
1119 printk("burst-mode-ec-10-Aug\n"); 1121 printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n",
1120 printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
1121 acpi_device_name(device), acpi_device_bid(device), 1122 acpi_device_name(device), acpi_device_bid(device),
1122 (u32) ec->common.gpe_bit); 1123 (u32) ec->common.gpe_bit);
1123 1124
@@ -1271,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle,
1271 u32 Level, void *context, void **retval) 1272 u32 Level, void *context, void **retval)
1272{ 1273{
1273 1274
1274 if (acpi_ec_polling_mode) 1275 if (acpi_ec_poll_mode)
1275 return acpi_fake_ecdt_polling_callback(handle, 1276 return acpi_fake_ecdt_poll_callback(handle,
1276 Level, context, retval); 1277 Level, context, retval);
1277 else 1278 else
1278 return acpi_fake_ecdt_burst_callback(handle, 1279 return acpi_fake_ecdt_intr_callback(handle,
1279 Level, context, retval); 1280 Level, context, retval);
1280} 1281}
1281 1282
1282static acpi_status __init 1283static acpi_status __init
1283acpi_fake_ecdt_polling_callback(acpi_handle handle, 1284acpi_fake_ecdt_poll_callback(acpi_handle handle,
1284 u32 Level, void *context, void **retval) 1285 u32 Level, void *context, void **retval)
1285{ 1286{
1286 acpi_status status; 1287 acpi_status status;
@@ -1299,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
1299 &ec_ecdt->common.gpe_bit); 1300 &ec_ecdt->common.gpe_bit);
1300 if (ACPI_FAILURE(status)) 1301 if (ACPI_FAILURE(status))
1301 return status; 1302 return status;
1302 spin_lock_init(&ec_ecdt->polling.lock); 1303 spin_lock_init(&ec_ecdt->poll.lock);
1303 ec_ecdt->common.global_lock = TRUE; 1304 ec_ecdt->common.global_lock = TRUE;
1304 ec_ecdt->common.handle = handle; 1305 ec_ecdt->common.handle = handle;
1305 1306
@@ -1312,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
1312} 1313}
1313 1314
1314static acpi_status __init 1315static acpi_status __init
1315acpi_fake_ecdt_burst_callback(acpi_handle handle, 1316acpi_fake_ecdt_intr_callback(acpi_handle handle,
1316 u32 Level, void *context, void **retval) 1317 u32 Level, void *context, void **retval)
1317{ 1318{
1318 acpi_status status; 1319 acpi_status status;
1319 1320
1320 init_MUTEX(&ec_ecdt->burst.sem); 1321 init_MUTEX(&ec_ecdt->intr.sem);
1321 init_waitqueue_head(&ec_ecdt->burst.wait); 1322 init_waitqueue_head(&ec_ecdt->intr.wait);
1322 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 1323 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
1323 acpi_ec_io_ports, ec_ecdt); 1324 acpi_ec_io_ports, ec_ecdt);
1324 if (ACPI_FAILURE(status)) 1325 if (ACPI_FAILURE(status))
@@ -1384,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void)
1384 1385
1385static int __init acpi_ec_get_real_ecdt(void) 1386static int __init acpi_ec_get_real_ecdt(void)
1386{ 1387{
1387 if (acpi_ec_polling_mode) 1388 if (acpi_ec_poll_mode)
1388 return acpi_ec_polling_get_real_ecdt(); 1389 return acpi_ec_poll_get_real_ecdt();
1389 else 1390 else
1390 return acpi_ec_burst_get_real_ecdt(); 1391 return acpi_ec_intr_get_real_ecdt();
1391} 1392}
1392 1393
1393static int __init acpi_ec_polling_get_real_ecdt(void) 1394static int __init acpi_ec_poll_get_real_ecdt(void)
1394{ 1395{
1395 acpi_status status; 1396 acpi_status status;
1396 struct acpi_table_ecdt *ecdt_ptr; 1397 struct acpi_table_ecdt *ecdt_ptr;
@@ -1415,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
1415 ec_ecdt->common.status_addr = ecdt_ptr->ec_control; 1416 ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
1416 ec_ecdt->common.data_addr = ecdt_ptr->ec_data; 1417 ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
1417 ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; 1418 ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;
1418 spin_lock_init(&ec_ecdt->polling.lock); 1419 spin_lock_init(&ec_ecdt->poll.lock);
1419 /* use the GL just to be safe */ 1420 /* use the GL just to be safe */
1420 ec_ecdt->common.global_lock = TRUE; 1421 ec_ecdt->common.global_lock = TRUE;
1421 ec_ecdt->common.uid = ecdt_ptr->uid; 1422 ec_ecdt->common.uid = ecdt_ptr->uid;
@@ -1435,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
1435 return -ENODEV; 1436 return -ENODEV;
1436} 1437}
1437 1438
1438static int __init acpi_ec_burst_get_real_ecdt(void) 1439static int __init acpi_ec_intr_get_real_ecdt(void)
1439{ 1440{
1440 acpi_status status; 1441 acpi_status status;
1441 struct acpi_table_ecdt *ecdt_ptr; 1442 struct acpi_table_ecdt *ecdt_ptr;
@@ -1456,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void)
1456 return -ENOMEM; 1457 return -ENOMEM;
1457 memset(ec_ecdt, 0, sizeof(union acpi_ec)); 1458 memset(ec_ecdt, 0, sizeof(union acpi_ec));
1458 1459
1459 init_MUTEX(&ec_ecdt->burst.sem); 1460 init_MUTEX(&ec_ecdt->intr.sem);
1460 init_waitqueue_head(&ec_ecdt->burst.wait); 1461 init_waitqueue_head(&ec_ecdt->intr.wait);
1461 ec_ecdt->common.command_addr = ecdt_ptr->ec_control; 1462 ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
1462 ec_ecdt->common.status_addr = ecdt_ptr->ec_control; 1463 ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
1463 ec_ecdt->common.data_addr = ecdt_ptr->ec_data; 1464 ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
@@ -1575,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str)
1575} 1576}
1576 1577
1577__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); 1578__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);
1578static int __init acpi_ec_set_polling_mode(char *str) 1579static int __init acpi_ec_set_intr_mode(char *str)
1579{ 1580{
1580 int burst; 1581 int intr;
1581 1582
1582 if (!get_option(&str, &burst)) 1583 if (!get_option(&str, &intr))
1583 return 0; 1584 return 0;
1584 1585
1585 if (burst) { 1586 if (intr) {
1586 acpi_ec_polling_mode = EC_BURST; 1587 acpi_ec_poll_mode = EC_INTR;
1587 acpi_ec_driver.ops.add = acpi_ec_burst_add; 1588 acpi_ec_driver.ops.add = acpi_ec_intr_add;
1588 } else { 1589 } else {
1589 acpi_ec_polling_mode = EC_POLLING; 1590 acpi_ec_poll_mode = EC_POLL;
1590 acpi_ec_driver.ops.add = acpi_ec_polling_add; 1591 acpi_ec_driver.ops.add = acpi_ec_poll_add;
1591 } 1592 }
1592 printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); 1593 printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling");
1593 return 0; 1594 return 0;
1594} 1595}
1595 1596
1596__setup("ec_burst=", acpi_ec_set_polling_mode); 1597__setup("ec_burst=", acpi_ec_set_intr_mode);