diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5f2027d782e8..1e6d4184f0ea 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -313,11 +313,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
313 | pr_debug(PREFIX "transaction start\n"); | 313 | pr_debug(PREFIX "transaction start\n"); |
314 | /* disable GPE during transaction if storm is detected */ | 314 | /* disable GPE during transaction if storm is detected */ |
315 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 315 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
316 | /* | 316 | /* It has to be disabled, so that it doesn't trigger. */ |
317 | * It has to be disabled at the hardware level regardless of the | 317 | acpi_disable_gpe(NULL, ec->gpe); |
318 | * GPE reference counting, so that it doesn't trigger. | ||
319 | */ | ||
320 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | ||
321 | } | 318 | } |
322 | 319 | ||
323 | status = acpi_ec_transaction_unlocked(ec, t); | 320 | status = acpi_ec_transaction_unlocked(ec, t); |
@@ -326,12 +323,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
326 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); | 323 | ec_check_sci_sync(ec, acpi_ec_read_status(ec)); |
327 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 324 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
328 | msleep(1); | 325 | msleep(1); |
329 | /* | 326 | /* It is safe to enable the GPE outside of the transaction. */ |
330 | * It is safe to enable the GPE outside of the transaction. Use | 327 | acpi_enable_gpe(NULL, ec->gpe); |
331 | * acpi_set_gpe() for that, since we used it to disable the GPE | ||
332 | * above. | ||
333 | */ | ||
334 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | ||
335 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { | 328 | } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { |
336 | pr_info(PREFIX "GPE storm detected, " | 329 | pr_info(PREFIX "GPE storm detected, " |
337 | "transactions will use polling mode\n"); | 330 | "transactions will use polling mode\n"); |
@@ -822,7 +815,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
822 | if (ACPI_FAILURE(status)) | 815 | if (ACPI_FAILURE(status)) |
823 | return -ENODEV; | 816 | return -ENODEV; |
824 | 817 | ||
825 | acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 818 | acpi_enable_gpe(NULL, ec->gpe); |
826 | status = acpi_install_address_space_handler(ec->handle, | 819 | status = acpi_install_address_space_handler(ec->handle, |
827 | ACPI_ADR_SPACE_EC, | 820 | ACPI_ADR_SPACE_EC, |
828 | &acpi_ec_space_handler, | 821 | &acpi_ec_space_handler, |
@@ -839,7 +832,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
839 | } else { | 832 | } else { |
840 | acpi_remove_gpe_handler(NULL, ec->gpe, | 833 | acpi_remove_gpe_handler(NULL, ec->gpe, |
841 | &acpi_ec_gpe_handler); | 834 | &acpi_ec_gpe_handler); |
842 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 835 | acpi_disable_gpe(NULL, ec->gpe); |
843 | return -ENODEV; | 836 | return -ENODEV; |
844 | } | 837 | } |
845 | } | 838 | } |
@@ -850,7 +843,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
850 | 843 | ||
851 | static void ec_remove_handlers(struct acpi_ec *ec) | 844 | static void ec_remove_handlers(struct acpi_ec *ec) |
852 | { | 845 | { |
853 | acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 846 | acpi_disable_gpe(NULL, ec->gpe); |
854 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 847 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
855 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 848 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
856 | pr_err(PREFIX "failed to remove space handler\n"); | 849 | pr_err(PREFIX "failed to remove space handler\n"); |
@@ -1088,22 +1081,6 @@ error: | |||
1088 | return -ENODEV; | 1081 | return -ENODEV; |
1089 | } | 1082 | } |
1090 | 1083 | ||
1091 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | ||
1092 | { | ||
1093 | struct acpi_ec *ec = acpi_driver_data(device); | ||
1094 | /* Stop using the GPE, but keep it reference counted. */ | ||
1095 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | ||
1096 | return 0; | ||
1097 | } | ||
1098 | |||
1099 | static int acpi_ec_resume(struct acpi_device *device) | ||
1100 | { | ||
1101 | struct acpi_ec *ec = acpi_driver_data(device); | ||
1102 | /* Enable the GPE again, but don't reference count it once more. */ | ||
1103 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | ||
1104 | return 0; | ||
1105 | } | ||
1106 | |||
1107 | static struct acpi_driver acpi_ec_driver = { | 1084 | static struct acpi_driver acpi_ec_driver = { |
1108 | .name = "ec", | 1085 | .name = "ec", |
1109 | .class = ACPI_EC_CLASS, | 1086 | .class = ACPI_EC_CLASS, |
@@ -1111,8 +1088,6 @@ static struct acpi_driver acpi_ec_driver = { | |||
1111 | .ops = { | 1088 | .ops = { |
1112 | .add = acpi_ec_add, | 1089 | .add = acpi_ec_add, |
1113 | .remove = acpi_ec_remove, | 1090 | .remove = acpi_ec_remove, |
1114 | .suspend = acpi_ec_suspend, | ||
1115 | .resume = acpi_ec_resume, | ||
1116 | }, | 1091 | }, |
1117 | }; | 1092 | }; |
1118 | 1093 | ||