aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:08:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:08:30 -0400
commit9e50ab91d025afc17ca14a1764be2e1d0c24245d (patch)
tree2647ef3fed12810ef88eb77e05bb7c3b2ea49d56 /drivers/acpi/ec.c
parent3cc08fc35db75b059118626c30b60b0f56583802 (diff)
parenta0d468718b9049f7396d101075a129a2d683ad66 (diff)
Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (27 commits) ACPI / ACPICA: Simplify acpi_ev_initialize_gpe_block() ACPI / ACPICA: Fail acpi_gpe_wakeup() if ACPI_GPE_CAN_WAKE is unset ACPI / ACPICA: Do not execute _PRW methods during initialization ACPI: Fix bogus GPE test in acpi_bus_set_run_wake_flags() ACPICA: Update version to 20100702 ACPICA: Fix for Alias references within Package objects ACPICA: Fix lint warning for 64-bit constant ACPICA: Remove obsolete GPE function ACPICA: Update debug output components ACPICA: Add support for WDDT - Watchdog Descriptor Table ACPICA: Drop acpi_set_gpe ACPICA: Use low-level GPE enable during GPE block initialization ACPI / EC: Do not use acpi_set_gpe ACPI / EC: Drop suspend and resume routines ACPICA: Remove wakeup GPE reference counting which is not used ACPICA: Introduce acpi_gpe_wakeup() ACPICA: Rename acpi_hw_gpe_register_bit ACPICA: Update version to 20100528 ACPICA: Add signatures for undefined tables: ATKG, GSCI, IEIT ACPICA: Optimization: Reduce the number of namespace walks ...
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 1fa0aafebe2a..f31291ba94d0 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -303,11 +303,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
303 pr_debug(PREFIX "transaction start\n"); 303 pr_debug(PREFIX "transaction start\n");
304 /* disable GPE during transaction if storm is detected */ 304 /* disable GPE during transaction if storm is detected */
305 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 305 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
306 /* 306 /* It has to be disabled, so that it doesn't trigger. */
307 * It has to be disabled at the hardware level regardless of the 307 acpi_disable_gpe(NULL, ec->gpe);
308 * GPE reference counting, so that it doesn't trigger.
309 */
310 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
311 } 308 }
312 309
313 status = acpi_ec_transaction_unlocked(ec, t); 310 status = acpi_ec_transaction_unlocked(ec, t);
@@ -316,12 +313,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
316 ec_check_sci_sync(ec, acpi_ec_read_status(ec)); 313 ec_check_sci_sync(ec, acpi_ec_read_status(ec));
317 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 314 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
318 msleep(1); 315 msleep(1);
319 /* 316 /* It is safe to enable the GPE outside of the transaction. */
320 * It is safe to enable the GPE outside of the transaction. Use 317 acpi_enable_gpe(NULL, ec->gpe);
321 * acpi_set_gpe() for that, since we used it to disable the GPE
322 * above.
323 */
324 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
325 } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { 318 } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
326 pr_info(PREFIX "GPE storm detected, " 319 pr_info(PREFIX "GPE storm detected, "
327 "transactions will use polling mode\n"); 320 "transactions will use polling mode\n");
@@ -746,7 +739,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
746 if (ACPI_FAILURE(status)) 739 if (ACPI_FAILURE(status))
747 return -ENODEV; 740 return -ENODEV;
748 741
749 acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); 742 acpi_enable_gpe(NULL, ec->gpe);
750 status = acpi_install_address_space_handler(ec->handle, 743 status = acpi_install_address_space_handler(ec->handle,
751 ACPI_ADR_SPACE_EC, 744 ACPI_ADR_SPACE_EC,
752 &acpi_ec_space_handler, 745 &acpi_ec_space_handler,
@@ -763,7 +756,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
763 } else { 756 } else {
764 acpi_remove_gpe_handler(NULL, ec->gpe, 757 acpi_remove_gpe_handler(NULL, ec->gpe,
765 &acpi_ec_gpe_handler); 758 &acpi_ec_gpe_handler);
766 acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); 759 acpi_disable_gpe(NULL, ec->gpe);
767 return -ENODEV; 760 return -ENODEV;
768 } 761 }
769 } 762 }
@@ -774,7 +767,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
774 767
775static void ec_remove_handlers(struct acpi_ec *ec) 768static void ec_remove_handlers(struct acpi_ec *ec)
776{ 769{
777 acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); 770 acpi_disable_gpe(NULL, ec->gpe);
778 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 771 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
779 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 772 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
780 pr_err(PREFIX "failed to remove space handler\n"); 773 pr_err(PREFIX "failed to remove space handler\n");
@@ -1018,22 +1011,6 @@ error:
1018 return -ENODEV; 1011 return -ENODEV;
1019} 1012}
1020 1013
1021static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state)
1022{
1023 struct acpi_ec *ec = acpi_driver_data(device);
1024 /* Stop using the GPE, but keep it reference counted. */
1025 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
1026 return 0;
1027}
1028
1029static int acpi_ec_resume(struct acpi_device *device)
1030{
1031 struct acpi_ec *ec = acpi_driver_data(device);
1032 /* Enable the GPE again, but don't reference count it once more. */
1033 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
1034 return 0;
1035}
1036
1037static struct acpi_driver acpi_ec_driver = { 1014static struct acpi_driver acpi_ec_driver = {
1038 .name = "ec", 1015 .name = "ec",
1039 .class = ACPI_EC_CLASS, 1016 .class = ACPI_EC_CLASS,
@@ -1041,8 +1018,6 @@ static struct acpi_driver acpi_ec_driver = {
1041 .ops = { 1018 .ops = {
1042 .add = acpi_ec_add, 1019 .add = acpi_ec_add,
1043 .remove = acpi_ec_remove, 1020 .remove = acpi_ec_remove,
1044 .suspend = acpi_ec_suspend,
1045 .resume = acpi_ec_resume,
1046 }, 1021 },
1047}; 1022};
1048 1023