diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 293 |
1 files changed, 149 insertions, 144 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7e1a445955bc..79b09d76c180 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 |
65 | static int acpi_ec_remove(struct acpi_device *device, int type); | 65 | static int acpi_ec_remove(struct acpi_device *device, int type); |
66 | static int acpi_ec_start(struct acpi_device *device); | 66 | static int acpi_ec_start(struct acpi_device *device); |
67 | static int acpi_ec_stop(struct acpi_device *device, int type); | 67 | static int acpi_ec_stop(struct acpi_device *device, int type); |
68 | static int acpi_ec_burst_add(struct acpi_device *device); | 68 | static int acpi_ec_intr_add(struct acpi_device *device); |
69 | static int acpi_ec_polling_add(struct acpi_device *device); | 69 | static int acpi_ec_poll_add(struct acpi_device *device); |
70 | 70 | ||
71 | static struct acpi_driver acpi_ec_driver = { | 71 | static 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_intr_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,43 +117,43 @@ 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 | ||
123 | static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); | 123 | static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event); |
124 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); | 124 | static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event); |
125 | static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); | 125 | static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data); |
126 | static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); | 126 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data); |
127 | static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); | 127 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data); |
128 | static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); | 128 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data); |
129 | static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); | 129 | static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data); |
130 | static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); | 130 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data); |
131 | static void acpi_ec_gpe_polling_query(void *ec_cxt); | 131 | static void acpi_ec_gpe_poll_query(void *ec_cxt); |
132 | static void acpi_ec_gpe_burst_query(void *ec_cxt); | 132 | static void acpi_ec_gpe_intr_query(void *ec_cxt); |
133 | static u32 acpi_ec_gpe_polling_handler(void *data); | 133 | static u32 acpi_ec_gpe_poll_handler(void *data); |
134 | static u32 acpi_ec_gpe_burst_handler(void *data); | 134 | static u32 acpi_ec_gpe_intr_handler(void *data); |
135 | static acpi_status __init | 135 | static acpi_status __init |
136 | acpi_fake_ecdt_polling_callback(acpi_handle handle, | 136 | acpi_fake_ecdt_poll_callback(acpi_handle handle, |
137 | u32 Level, void *context, void **retval); | 137 | u32 Level, void *context, void **retval); |
138 | 138 | ||
139 | static acpi_status __init | 139 | static acpi_status __init |
140 | acpi_fake_ecdt_burst_callback(acpi_handle handle, | 140 | acpi_fake_ecdt_intr_callback(acpi_handle handle, |
141 | u32 Level, void *context, void **retval); | 141 | u32 Level, void *context, void **retval); |
142 | 142 | ||
143 | static int __init acpi_ec_polling_get_real_ecdt(void); | 143 | static int __init acpi_ec_poll_get_real_ecdt(void); |
144 | static int __init acpi_ec_burst_get_real_ecdt(void); | 144 | static 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 */ |
146 | static union acpi_ec *ec_ecdt; | 146 | static 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 */ |
149 | static struct acpi_device *first_ec; | 149 | static struct acpi_device *first_ec; |
150 | static int acpi_ec_polling_mode = EC_POLLING; | 150 | static int acpi_ec_poll_mode = EC_INTR; |
151 | 151 | ||
152 | /* -------------------------------------------------------------------------- | 152 | /* -------------------------------------------------------------------------- |
153 | Transaction Management | 153 | Transaction Management |
154 | -------------------------------------------------------------------------- */ | 154 | -------------------------------------------------------------------------- */ |
155 | 155 | ||
156 | static inline u32 acpi_ec_read_status(union acpi_ec *ec) | 156 | static u32 acpi_ec_read_status(union acpi_ec *ec) |
157 | { | 157 | { |
158 | u32 status = 0; | 158 | u32 status = 0; |
159 | 159 | ||
@@ -163,13 +163,13 @@ static inline u32 acpi_ec_read_status(union acpi_ec *ec) | |||
163 | 163 | ||
164 | static int acpi_ec_wait(union acpi_ec *ec, u8 event) | 164 | static 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 | ||
172 | static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) | 172 | static 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,36 +203,31 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) | |||
203 | 203 | ||
204 | return -ETIME; | 204 | return -ETIME; |
205 | } | 205 | } |
206 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | 206 | static 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_OBF: | ||
217 | if (acpi_ec_read_status(ec) & event) { | ||
218 | ec->burst.expect_event = 0; | ||
219 | return_VALUE(0); | ||
220 | } | ||
221 | break; | ||
222 | |||
223 | case ACPI_EC_EVENT_IBE: | 216 | case ACPI_EC_EVENT_IBE: |
224 | if (~acpi_ec_read_status(ec) & event) { | 217 | if (~acpi_ec_read_status(ec) & event) { |
225 | ec->burst.expect_event = 0; | 218 | ec->intr.expect_event = 0; |
226 | return_VALUE(0); | 219 | return_VALUE(0); |
227 | } | 220 | } |
228 | break; | 221 | break; |
222 | default: | ||
223 | break; | ||
229 | } | 224 | } |
230 | 225 | ||
231 | result = wait_event_timeout(ec->burst.wait, | 226 | result = wait_event_timeout(ec->intr.wait, |
232 | !ec->burst.expect_event, | 227 | !ec->intr.expect_event, |
233 | msecs_to_jiffies(ACPI_EC_DELAY)); | 228 | msecs_to_jiffies(ACPI_EC_DELAY)); |
234 | 229 | ||
235 | ec->burst.expect_event = 0; | 230 | ec->intr.expect_event = 0; |
236 | smp_mb(); | 231 | smp_mb(); |
237 | 232 | ||
238 | /* | 233 | /* |
@@ -255,7 +250,12 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | |||
255 | return_VALUE(-ETIME); | 250 | return_VALUE(-ETIME); |
256 | } | 251 | } |
257 | 252 | ||
258 | static int acpi_ec_enter_burst_mode(union acpi_ec *ec) | 253 | #ifdef ACPI_FUTURE_USAGE |
254 | /* | ||
255 | * Note: samsung nv5000 doesn't work with ec burst mode. | ||
256 | * http://bugzilla.kernel.org/show_bug.cgi?id=4980 | ||
257 | */ | ||
258 | int acpi_ec_enter_burst_mode(union acpi_ec *ec) | ||
259 | { | 259 | { |
260 | u32 tmp = 0; | 260 | u32 tmp = 0; |
261 | int status = 0; | 261 | int status = 0; |
@@ -270,45 +270,56 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec) | |||
270 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, | 270 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, |
271 | &ec->common.command_addr); | 271 | &ec->common.command_addr); |
272 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 272 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
273 | if (status) | ||
274 | return_VALUE(-EINVAL); | ||
275 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); | 273 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); |
276 | if (tmp != 0x90) { /* Burst ACK byte */ | 274 | if (tmp != 0x90) { /* Burst ACK byte */ |
277 | return_VALUE(-EINVAL); | 275 | return_VALUE(-EINVAL); |
278 | } | 276 | } |
279 | } | 277 | } |
280 | 278 | ||
281 | atomic_set(&ec->burst.leaving_burst, 0); | 279 | atomic_set(&ec->intr.leaving_burst, 0); |
282 | return_VALUE(0); | 280 | return_VALUE(0); |
283 | end: | 281 | end: |
284 | printk("Error in acpi_ec_wait\n"); | 282 | printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); |
285 | return_VALUE(-1); | 283 | return_VALUE(-1); |
286 | } | 284 | } |
287 | 285 | ||
288 | static int acpi_ec_leave_burst_mode(union acpi_ec *ec) | 286 | int acpi_ec_leave_burst_mode(union acpi_ec *ec) |
289 | { | 287 | { |
288 | int status = 0; | ||
290 | 289 | ||
291 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | 290 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); |
292 | 291 | ||
293 | atomic_set(&ec->burst.leaving_burst, 1); | 292 | status = acpi_ec_read_status(ec); |
293 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ | ||
294 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
295 | if(status) | ||
296 | goto end; | ||
297 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); | ||
298 | acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
299 | } | ||
300 | atomic_set(&ec->intr.leaving_burst, 1); | ||
294 | return_VALUE(0); | 301 | return_VALUE(0); |
302 | end: | ||
303 | printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); | ||
304 | return_VALUE(-1); | ||
295 | } | 305 | } |
306 | #endif /* ACPI_FUTURE_USAGE */ | ||
296 | 307 | ||
297 | static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) | 308 | static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) |
298 | { | 309 | { |
299 | if (acpi_ec_polling_mode) | 310 | if (acpi_ec_poll_mode) |
300 | return acpi_ec_polling_read(ec, address, data); | 311 | return acpi_ec_poll_read(ec, address, data); |
301 | else | 312 | else |
302 | return acpi_ec_burst_read(ec, address, data); | 313 | return acpi_ec_intr_read(ec, address, data); |
303 | } | 314 | } |
304 | static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) | 315 | static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) |
305 | { | 316 | { |
306 | if (acpi_ec_polling_mode) | 317 | if (acpi_ec_poll_mode) |
307 | return acpi_ec_polling_write(ec, address, data); | 318 | return acpi_ec_poll_write(ec, address, data); |
308 | else | 319 | else |
309 | return acpi_ec_burst_write(ec, address, data); | 320 | return acpi_ec_intr_write(ec, address, data); |
310 | } | 321 | } |
311 | static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | 322 | static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) |
312 | { | 323 | { |
313 | acpi_status status = AE_OK; | 324 | acpi_status status = AE_OK; |
314 | int result = 0; | 325 | int result = 0; |
@@ -328,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
328 | return_VALUE(-ENODEV); | 339 | return_VALUE(-ENODEV); |
329 | } | 340 | } |
330 | 341 | ||
331 | spin_lock_irqsave(&ec->polling.lock, flags); | 342 | spin_lock_irqsave(&ec->poll.lock, flags); |
332 | 343 | ||
333 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 344 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
334 | &ec->common.command_addr); | 345 | &ec->common.command_addr); |
@@ -347,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
347 | *data, address)); | 358 | *data, address)); |
348 | 359 | ||
349 | end: | 360 | end: |
350 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 361 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
351 | 362 | ||
352 | if (ec->common.global_lock) | 363 | if (ec->common.global_lock) |
353 | acpi_release_global_lock(glk); | 364 | acpi_release_global_lock(glk); |
@@ -355,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
355 | return_VALUE(result); | 366 | return_VALUE(result); |
356 | } | 367 | } |
357 | 368 | ||
358 | static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | 369 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) |
359 | { | 370 | { |
360 | int result = 0; | 371 | int result = 0; |
361 | acpi_status status = AE_OK; | 372 | acpi_status status = AE_OK; |
@@ -373,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
373 | return_VALUE(-ENODEV); | 384 | return_VALUE(-ENODEV); |
374 | } | 385 | } |
375 | 386 | ||
376 | spin_lock_irqsave(&ec->polling.lock, flags); | 387 | spin_lock_irqsave(&ec->poll.lock, flags); |
377 | 388 | ||
378 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 389 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
379 | &ec->common.command_addr); | 390 | &ec->common.command_addr); |
@@ -395,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
395 | data, address)); | 406 | data, address)); |
396 | 407 | ||
397 | end: | 408 | end: |
398 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 409 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
399 | 410 | ||
400 | if (ec->common.global_lock) | 411 | if (ec->common.global_lock) |
401 | acpi_release_global_lock(glk); | 412 | acpi_release_global_lock(glk); |
@@ -403,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
403 | return_VALUE(result); | 414 | return_VALUE(result); |
404 | } | 415 | } |
405 | 416 | ||
406 | static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | 417 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) |
407 | { | 418 | { |
408 | int status = 0; | 419 | int status = 0; |
409 | u32 glk; | 420 | u32 glk; |
@@ -422,25 +433,24 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
422 | } | 433 | } |
423 | 434 | ||
424 | WARN_ON(in_interrupt()); | 435 | WARN_ON(in_interrupt()); |
425 | down(&ec->burst.sem); | 436 | down(&ec->intr.sem); |
426 | 437 | ||
427 | acpi_ec_enter_burst_mode(ec); | ||
428 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 438 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
429 | if (status) { | 439 | if (status) { |
430 | printk("read EC, IB not empty\n"); | 440 | printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); |
431 | goto end; | 441 | goto end; |
432 | } | 442 | } |
433 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 443 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
434 | &ec->common.command_addr); | 444 | &ec->common.command_addr); |
435 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 445 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
436 | if (status) { | 446 | if (status) { |
437 | printk("read EC, IB not empty\n"); | 447 | printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); |
438 | } | 448 | } |
439 | 449 | ||
440 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | 450 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
441 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 451 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
442 | if (status) { | 452 | if (status) { |
443 | printk("read EC, OB not full\n"); | 453 | printk(KERN_DEBUG PREFIX "read EC, OB not full\n"); |
444 | goto end; | 454 | goto end; |
445 | } | 455 | } |
446 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | 456 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); |
@@ -448,8 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
448 | *data, address)); | 458 | *data, address)); |
449 | 459 | ||
450 | end: | 460 | end: |
451 | acpi_ec_leave_burst_mode(ec); | 461 | up(&ec->intr.sem); |
452 | up(&ec->burst.sem); | ||
453 | 462 | ||
454 | if (ec->common.global_lock) | 463 | if (ec->common.global_lock) |
455 | acpi_release_global_lock(glk); | 464 | acpi_release_global_lock(glk); |
@@ -457,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
457 | return_VALUE(status); | 466 | return_VALUE(status); |
458 | } | 467 | } |
459 | 468 | ||
460 | static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | 469 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) |
461 | { | 470 | { |
462 | int status = 0; | 471 | int status = 0; |
463 | u32 glk; | 472 | u32 glk; |
@@ -474,25 +483,23 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | |||
474 | } | 483 | } |
475 | 484 | ||
476 | WARN_ON(in_interrupt()); | 485 | WARN_ON(in_interrupt()); |
477 | down(&ec->burst.sem); | 486 | down(&ec->intr.sem); |
478 | |||
479 | acpi_ec_enter_burst_mode(ec); | ||
480 | 487 | ||
481 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 488 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
482 | if (status) { | 489 | if (status) { |
483 | printk("write EC, IB not empty\n"); | 490 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
484 | } | 491 | } |
485 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 492 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
486 | &ec->common.command_addr); | 493 | &ec->common.command_addr); |
487 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 494 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
488 | if (status) { | 495 | if (status) { |
489 | printk("write EC, IB not empty\n"); | 496 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
490 | } | 497 | } |
491 | 498 | ||
492 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | 499 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
493 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 500 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
494 | if (status) { | 501 | if (status) { |
495 | printk("write EC, IB not empty\n"); | 502 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
496 | } | 503 | } |
497 | 504 | ||
498 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); | 505 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); |
@@ -500,8 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | |||
500 | 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", |
501 | data, address)); | 508 | data, address)); |
502 | 509 | ||
503 | acpi_ec_leave_burst_mode(ec); | 510 | up(&ec->intr.sem); |
504 | up(&ec->burst.sem); | ||
505 | 511 | ||
506 | if (ec->common.global_lock) | 512 | if (ec->common.global_lock) |
507 | acpi_release_global_lock(glk); | 513 | acpi_release_global_lock(glk); |
@@ -553,12 +559,12 @@ EXPORT_SYMBOL(ec_write); | |||
553 | 559 | ||
554 | static int acpi_ec_query(union acpi_ec *ec, u32 * data) | 560 | static int acpi_ec_query(union acpi_ec *ec, u32 * data) |
555 | { | 561 | { |
556 | if (acpi_ec_polling_mode) | 562 | if (acpi_ec_poll_mode) |
557 | return acpi_ec_polling_query(ec, data); | 563 | return acpi_ec_poll_query(ec, data); |
558 | else | 564 | else |
559 | return acpi_ec_burst_query(ec, data); | 565 | return acpi_ec_intr_query(ec, data); |
560 | } | 566 | } |
561 | static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | 567 | static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) |
562 | { | 568 | { |
563 | int result = 0; | 569 | int result = 0; |
564 | acpi_status status = AE_OK; | 570 | acpi_status status = AE_OK; |
@@ -583,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | |||
583 | * 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 |
584 | * bit to be cleared (and thus clearing the interrupt source). | 590 | * bit to be cleared (and thus clearing the interrupt source). |
585 | */ | 591 | */ |
586 | spin_lock_irqsave(&ec->polling.lock, flags); | 592 | spin_lock_irqsave(&ec->poll.lock, flags); |
587 | 593 | ||
588 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, | 594 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, |
589 | &ec->common.command_addr); | 595 | &ec->common.command_addr); |
@@ -596,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | |||
596 | result = -ENODATA; | 602 | result = -ENODATA; |
597 | 603 | ||
598 | end: | 604 | end: |
599 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 605 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
600 | 606 | ||
601 | if (ec->common.global_lock) | 607 | if (ec->common.global_lock) |
602 | acpi_release_global_lock(glk); | 608 | acpi_release_global_lock(glk); |
603 | 609 | ||
604 | return_VALUE(result); | 610 | return_VALUE(result); |
605 | } | 611 | } |
606 | static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | 612 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) |
607 | { | 613 | { |
608 | int status = 0; | 614 | int status = 0; |
609 | u32 glk; | 615 | u32 glk; |
@@ -620,11 +626,11 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
620 | return_VALUE(-ENODEV); | 626 | return_VALUE(-ENODEV); |
621 | } | 627 | } |
622 | 628 | ||
623 | down(&ec->burst.sem); | 629 | down(&ec->intr.sem); |
624 | 630 | ||
625 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 631 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
626 | if (status) { | 632 | if (status) { |
627 | printk("query EC, IB not empty\n"); | 633 | printk(KERN_DEBUG PREFIX "query EC, IB not empty\n"); |
628 | goto end; | 634 | goto end; |
629 | } | 635 | } |
630 | /* | 636 | /* |
@@ -636,7 +642,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
636 | &ec->common.command_addr); | 642 | &ec->common.command_addr); |
637 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 643 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
638 | if (status) { | 644 | if (status) { |
639 | printk("query EC, OB not full\n"); | 645 | printk(KERN_DEBUG PREFIX "query EC, OB not full\n"); |
640 | goto end; | 646 | goto end; |
641 | } | 647 | } |
642 | 648 | ||
@@ -645,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
645 | status = -ENODATA; | 651 | status = -ENODATA; |
646 | 652 | ||
647 | end: | 653 | end: |
648 | up(&ec->burst.sem); | 654 | up(&ec->intr.sem); |
649 | 655 | ||
650 | if (ec->common.global_lock) | 656 | if (ec->common.global_lock) |
651 | acpi_release_global_lock(glk); | 657 | acpi_release_global_lock(glk); |
@@ -664,13 +670,13 @@ union acpi_ec_query_data { | |||
664 | 670 | ||
665 | static void acpi_ec_gpe_query(void *ec_cxt) | 671 | static void acpi_ec_gpe_query(void *ec_cxt) |
666 | { | 672 | { |
667 | if (acpi_ec_polling_mode) | 673 | if (acpi_ec_poll_mode) |
668 | acpi_ec_gpe_polling_query(ec_cxt); | 674 | acpi_ec_gpe_poll_query(ec_cxt); |
669 | else | 675 | else |
670 | acpi_ec_gpe_burst_query(ec_cxt); | 676 | acpi_ec_gpe_intr_query(ec_cxt); |
671 | } | 677 | } |
672 | 678 | ||
673 | static void acpi_ec_gpe_polling_query(void *ec_cxt) | 679 | static void acpi_ec_gpe_poll_query(void *ec_cxt) |
674 | { | 680 | { |
675 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 681 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
676 | u32 value = 0; | 682 | u32 value = 0; |
@@ -685,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) | |||
685 | if (!ec_cxt) | 691 | if (!ec_cxt) |
686 | goto end; | 692 | goto end; |
687 | 693 | ||
688 | spin_lock_irqsave(&ec->polling.lock, flags); | 694 | spin_lock_irqsave(&ec->poll.lock, flags); |
689 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | 695 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
690 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 696 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
691 | 697 | ||
692 | /* TBD: Implement asynch events! | 698 | /* TBD: Implement asynch events! |
693 | * 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 |
@@ -711,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) | |||
711 | end: | 717 | end: |
712 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | 718 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
713 | } | 719 | } |
714 | static void acpi_ec_gpe_burst_query(void *ec_cxt) | 720 | static void acpi_ec_gpe_intr_query(void *ec_cxt) |
715 | { | 721 | { |
716 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 722 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
717 | u32 value; | 723 | u32 value; |
@@ -736,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt) | |||
736 | 742 | ||
737 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); | 743 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); |
738 | end: | 744 | end: |
739 | atomic_dec(&ec->burst.pending_gpe); | 745 | atomic_dec(&ec->intr.pending_gpe); |
740 | return; | 746 | return; |
741 | } | 747 | } |
742 | 748 | ||
743 | static u32 acpi_ec_gpe_handler(void *data) | 749 | static u32 acpi_ec_gpe_handler(void *data) |
744 | { | 750 | { |
745 | if (acpi_ec_polling_mode) | 751 | if (acpi_ec_poll_mode) |
746 | return acpi_ec_gpe_polling_handler(data); | 752 | return acpi_ec_gpe_poll_handler(data); |
747 | else | 753 | else |
748 | return acpi_ec_gpe_burst_handler(data); | 754 | return acpi_ec_gpe_intr_handler(data); |
749 | } | 755 | } |
750 | static u32 acpi_ec_gpe_polling_handler(void *data) | 756 | static u32 acpi_ec_gpe_poll_handler(void *data) |
751 | { | 757 | { |
752 | acpi_status status = AE_OK; | 758 | acpi_status status = AE_OK; |
753 | union acpi_ec *ec = (union acpi_ec *)data; | 759 | union acpi_ec *ec = (union acpi_ec *)data; |
@@ -765,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data) | |||
765 | else | 771 | else |
766 | return ACPI_INTERRUPT_NOT_HANDLED; | 772 | return ACPI_INTERRUPT_NOT_HANDLED; |
767 | } | 773 | } |
768 | static u32 acpi_ec_gpe_burst_handler(void *data) | 774 | static u32 acpi_ec_gpe_intr_handler(void *data) |
769 | { | 775 | { |
770 | acpi_status status = AE_OK; | 776 | acpi_status status = AE_OK; |
771 | u32 value; | 777 | u32 value; |
@@ -777,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data) | |||
777 | acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 783 | acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
778 | value = acpi_ec_read_status(ec); | 784 | value = acpi_ec_read_status(ec); |
779 | 785 | ||
780 | switch (ec->burst.expect_event) { | 786 | switch (ec->intr.expect_event) { |
781 | case ACPI_EC_EVENT_OBF: | 787 | case ACPI_EC_EVENT_OBF: |
782 | if (!(value & ACPI_EC_FLAG_OBF)) | 788 | if (!(value & ACPI_EC_FLAG_OBF)) |
783 | break; | 789 | break; |
784 | case ACPI_EC_EVENT_IBE: | 790 | case ACPI_EC_EVENT_IBE: |
785 | if ((value & ACPI_EC_FLAG_IBF)) | 791 | if ((value & ACPI_EC_FLAG_IBF)) |
786 | break; | 792 | break; |
787 | ec->burst.expect_event = 0; | 793 | ec->intr.expect_event = 0; |
788 | wake_up(&ec->burst.wait); | 794 | wake_up(&ec->intr.wait); |
789 | return ACPI_INTERRUPT_HANDLED; | 795 | return ACPI_INTERRUPT_HANDLED; |
790 | default: | 796 | default: |
791 | break; | 797 | break; |
792 | } | 798 | } |
793 | 799 | ||
794 | if (value & ACPI_EC_FLAG_SCI) { | 800 | if (value & ACPI_EC_FLAG_SCI) { |
795 | atomic_add(1, &ec->burst.pending_gpe); | 801 | atomic_add(1, &ec->intr.pending_gpe); |
796 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, |
797 | acpi_ec_gpe_query, ec); | 803 | acpi_ec_gpe_query, ec); |
798 | return status == AE_OK ? | 804 | return status == AE_OK ? |
@@ -980,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) | |||
980 | Driver Interface | 986 | Driver Interface |
981 | -------------------------------------------------------------------------- */ | 987 | -------------------------------------------------------------------------- */ |
982 | 988 | ||
983 | static int acpi_ec_polling_add(struct acpi_device *device) | 989 | static int acpi_ec_poll_add(struct acpi_device *device) |
984 | { | 990 | { |
985 | int result = 0; | 991 | int result = 0; |
986 | acpi_status status = AE_OK; | 992 | acpi_status status = AE_OK; |
@@ -999,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
999 | 1005 | ||
1000 | ec->common.handle = device->handle; | 1006 | ec->common.handle = device->handle; |
1001 | ec->common.uid = -1; | 1007 | ec->common.uid = -1; |
1002 | spin_lock_init(&ec->polling.lock); | 1008 | spin_lock_init(&ec->poll.lock); |
1003 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1009 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1004 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1010 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1005 | acpi_driver_data(device) = ec; | 1011 | acpi_driver_data(device) = ec; |
@@ -1038,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
1038 | if (result) | 1044 | if (result) |
1039 | goto end; | 1045 | goto end; |
1040 | 1046 | ||
1041 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | 1047 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n", |
1042 | acpi_device_name(device), acpi_device_bid(device), | 1048 | acpi_device_name(device), acpi_device_bid(device), |
1043 | (u32) ec->common.gpe_bit); | 1049 | (u32) ec->common.gpe_bit); |
1044 | 1050 | ||
@@ -1051,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
1051 | 1057 | ||
1052 | return_VALUE(result); | 1058 | return_VALUE(result); |
1053 | } | 1059 | } |
1054 | static int acpi_ec_burst_add(struct acpi_device *device) | 1060 | static int acpi_ec_intr_add(struct acpi_device *device) |
1055 | { | 1061 | { |
1056 | int result = 0; | 1062 | int result = 0; |
1057 | acpi_status status = AE_OK; | 1063 | acpi_status status = AE_OK; |
@@ -1070,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device) | |||
1070 | 1076 | ||
1071 | ec->common.handle = device->handle; | 1077 | ec->common.handle = device->handle; |
1072 | ec->common.uid = -1; | 1078 | ec->common.uid = -1; |
1073 | atomic_set(&ec->burst.pending_gpe, 0); | 1079 | atomic_set(&ec->intr.pending_gpe, 0); |
1074 | atomic_set(&ec->burst.leaving_burst, 1); | 1080 | atomic_set(&ec->intr.leaving_burst, 1); |
1075 | init_MUTEX(&ec->burst.sem); | 1081 | init_MUTEX(&ec->intr.sem); |
1076 | init_waitqueue_head(&ec->burst.wait); | 1082 | init_waitqueue_head(&ec->intr.wait); |
1077 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1083 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1078 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1084 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1079 | acpi_driver_data(device) = ec; | 1085 | acpi_driver_data(device) = ec; |
@@ -1112,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device) | |||
1112 | if (result) | 1118 | if (result) |
1113 | goto end; | 1119 | goto end; |
1114 | 1120 | ||
1115 | printk("burst-mode-ec-10-Aug\n"); | 1121 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n", |
1116 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | ||
1117 | acpi_device_name(device), acpi_device_bid(device), | 1122 | acpi_device_name(device), acpi_device_bid(device), |
1118 | (u32) ec->common.gpe_bit); | 1123 | (u32) ec->common.gpe_bit); |
1119 | 1124 | ||
@@ -1151,7 +1156,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) | |||
1151 | union acpi_ec *ec = (union acpi_ec *)context; | 1156 | union acpi_ec *ec = (union acpi_ec *)context; |
1152 | struct acpi_generic_address *addr; | 1157 | struct acpi_generic_address *addr; |
1153 | 1158 | ||
1154 | if (resource->id != ACPI_RSTYPE_IO) { | 1159 | if (resource->type != ACPI_RESOURCE_TYPE_IO) { |
1155 | return AE_OK; | 1160 | return AE_OK; |
1156 | } | 1161 | } |
1157 | 1162 | ||
@@ -1171,7 +1176,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) | |||
1171 | addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; | 1176 | addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; |
1172 | addr->register_bit_width = 8; | 1177 | addr->register_bit_width = 8; |
1173 | addr->register_bit_offset = 0; | 1178 | addr->register_bit_offset = 0; |
1174 | addr->address = resource->data.io.min_base_address; | 1179 | addr->address = resource->data.io.minimum; |
1175 | 1180 | ||
1176 | return AE_OK; | 1181 | return AE_OK; |
1177 | } | 1182 | } |
@@ -1267,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle, | |||
1267 | u32 Level, void *context, void **retval) | 1272 | u32 Level, void *context, void **retval) |
1268 | { | 1273 | { |
1269 | 1274 | ||
1270 | if (acpi_ec_polling_mode) | 1275 | if (acpi_ec_poll_mode) |
1271 | return acpi_fake_ecdt_polling_callback(handle, | 1276 | return acpi_fake_ecdt_poll_callback(handle, |
1272 | Level, context, retval); | 1277 | Level, context, retval); |
1273 | else | 1278 | else |
1274 | return acpi_fake_ecdt_burst_callback(handle, | 1279 | return acpi_fake_ecdt_intr_callback(handle, |
1275 | Level, context, retval); | 1280 | Level, context, retval); |
1276 | } | 1281 | } |
1277 | 1282 | ||
1278 | static acpi_status __init | 1283 | static acpi_status __init |
1279 | acpi_fake_ecdt_polling_callback(acpi_handle handle, | 1284 | acpi_fake_ecdt_poll_callback(acpi_handle handle, |
1280 | u32 Level, void *context, void **retval) | 1285 | u32 Level, void *context, void **retval) |
1281 | { | 1286 | { |
1282 | acpi_status status; | 1287 | acpi_status status; |
@@ -1295,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, | |||
1295 | &ec_ecdt->common.gpe_bit); | 1300 | &ec_ecdt->common.gpe_bit); |
1296 | if (ACPI_FAILURE(status)) | 1301 | if (ACPI_FAILURE(status)) |
1297 | return status; | 1302 | return status; |
1298 | spin_lock_init(&ec_ecdt->polling.lock); | 1303 | spin_lock_init(&ec_ecdt->poll.lock); |
1299 | ec_ecdt->common.global_lock = TRUE; | 1304 | ec_ecdt->common.global_lock = TRUE; |
1300 | ec_ecdt->common.handle = handle; | 1305 | ec_ecdt->common.handle = handle; |
1301 | 1306 | ||
@@ -1308,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, | |||
1308 | } | 1313 | } |
1309 | 1314 | ||
1310 | static acpi_status __init | 1315 | static acpi_status __init |
1311 | acpi_fake_ecdt_burst_callback(acpi_handle handle, | 1316 | acpi_fake_ecdt_intr_callback(acpi_handle handle, |
1312 | u32 Level, void *context, void **retval) | 1317 | u32 Level, void *context, void **retval) |
1313 | { | 1318 | { |
1314 | acpi_status status; | 1319 | acpi_status status; |
1315 | 1320 | ||
1316 | init_MUTEX(&ec_ecdt->burst.sem); | 1321 | init_MUTEX(&ec_ecdt->intr.sem); |
1317 | init_waitqueue_head(&ec_ecdt->burst.wait); | 1322 | init_waitqueue_head(&ec_ecdt->intr.wait); |
1318 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 1323 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
1319 | acpi_ec_io_ports, ec_ecdt); | 1324 | acpi_ec_io_ports, ec_ecdt); |
1320 | if (ACPI_FAILURE(status)) | 1325 | if (ACPI_FAILURE(status)) |
@@ -1380,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void) | |||
1380 | 1385 | ||
1381 | static int __init acpi_ec_get_real_ecdt(void) | 1386 | static int __init acpi_ec_get_real_ecdt(void) |
1382 | { | 1387 | { |
1383 | if (acpi_ec_polling_mode) | 1388 | if (acpi_ec_poll_mode) |
1384 | return acpi_ec_polling_get_real_ecdt(); | 1389 | return acpi_ec_poll_get_real_ecdt(); |
1385 | else | 1390 | else |
1386 | return acpi_ec_burst_get_real_ecdt(); | 1391 | return acpi_ec_intr_get_real_ecdt(); |
1387 | } | 1392 | } |
1388 | 1393 | ||
1389 | static int __init acpi_ec_polling_get_real_ecdt(void) | 1394 | static int __init acpi_ec_poll_get_real_ecdt(void) |
1390 | { | 1395 | { |
1391 | acpi_status status; | 1396 | acpi_status status; |
1392 | struct acpi_table_ecdt *ecdt_ptr; | 1397 | struct acpi_table_ecdt *ecdt_ptr; |
@@ -1411,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) | |||
1411 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1416 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1412 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1417 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
1413 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | 1418 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; |
1414 | spin_lock_init(&ec_ecdt->polling.lock); | 1419 | spin_lock_init(&ec_ecdt->poll.lock); |
1415 | /* use the GL just to be safe */ | 1420 | /* use the GL just to be safe */ |
1416 | ec_ecdt->common.global_lock = TRUE; | 1421 | ec_ecdt->common.global_lock = TRUE; |
1417 | ec_ecdt->common.uid = ecdt_ptr->uid; | 1422 | ec_ecdt->common.uid = ecdt_ptr->uid; |
@@ -1431,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) | |||
1431 | return -ENODEV; | 1436 | return -ENODEV; |
1432 | } | 1437 | } |
1433 | 1438 | ||
1434 | static int __init acpi_ec_burst_get_real_ecdt(void) | 1439 | static int __init acpi_ec_intr_get_real_ecdt(void) |
1435 | { | 1440 | { |
1436 | acpi_status status; | 1441 | acpi_status status; |
1437 | struct acpi_table_ecdt *ecdt_ptr; | 1442 | struct acpi_table_ecdt *ecdt_ptr; |
@@ -1452,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void) | |||
1452 | return -ENOMEM; | 1457 | return -ENOMEM; |
1453 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); | 1458 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
1454 | 1459 | ||
1455 | init_MUTEX(&ec_ecdt->burst.sem); | 1460 | init_MUTEX(&ec_ecdt->intr.sem); |
1456 | init_waitqueue_head(&ec_ecdt->burst.wait); | 1461 | init_waitqueue_head(&ec_ecdt->intr.wait); |
1457 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; | 1462 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; |
1458 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1463 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1459 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1464 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
@@ -1571,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str) | |||
1571 | } | 1576 | } |
1572 | 1577 | ||
1573 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); | 1578 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); |
1574 | static int __init acpi_ec_set_polling_mode(char *str) | 1579 | static int __init acpi_ec_set_intr_mode(char *str) |
1575 | { | 1580 | { |
1576 | int burst; | 1581 | int intr; |
1577 | 1582 | ||
1578 | if (!get_option(&str, &burst)) | 1583 | if (!get_option(&str, &intr)) |
1579 | return 0; | 1584 | return 0; |
1580 | 1585 | ||
1581 | if (burst) { | 1586 | if (intr) { |
1582 | acpi_ec_polling_mode = EC_BURST; | 1587 | acpi_ec_poll_mode = EC_INTR; |
1583 | acpi_ec_driver.ops.add = acpi_ec_burst_add; | 1588 | acpi_ec_driver.ops.add = acpi_ec_intr_add; |
1584 | } else { | 1589 | } else { |
1585 | acpi_ec_polling_mode = EC_POLLING; | 1590 | acpi_ec_poll_mode = EC_POLL; |
1586 | acpi_ec_driver.ops.add = acpi_ec_polling_add; | 1591 | acpi_ec_driver.ops.add = acpi_ec_poll_add; |
1587 | } | 1592 | } |
1588 | printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); | 1593 | printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling"); |
1589 | return 0; | 1594 | return 0; |
1590 | } | 1595 | } |
1591 | 1596 | ||
1592 | __setup("ec_burst=", acpi_ec_set_polling_mode); | 1597 | __setup("ec_intr=", acpi_ec_set_intr_mode); |