]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ACPI / EC: Fix regression related to triggering source of EC event handling
authorLv Zheng <lv.zheng@intel.com>
Tue, 26 Sep 2017 08:54:03 +0000 (16:54 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 8 Nov 2017 23:23:53 +0000 (00:23 +0100)
Originally the Samsung quirks removed by commit af071b86 can be covered
by commit 746ed222 and ec_freeze_events=Y mode. But commit 8e3d836d
changed ec_freeze_events=Y back to N, making this problem re-surface.

Actually, if commit 746ed222 is robust enough, we can freely change
ec_freeze_events mode, so this patch fixes the issue by improving
commit 746ed222.

Related commits listed in the merged order:

 Commit: 746ed222c3b6d8ea43b50120e8592e739758efc7
 Subject: ACPI / EC: Fix an issue that SCI_EVT cannot be detected
          after event is enabled

 Commit: af071b862470edbf7f8a65d7dc86c0f4da440176
 Subject: ACPI / EC: Remove old CLEAR_ON_RESUME quirk

 Commit: 8e3d836d7af8c5a81fa7972a8d481573521f901e
 Subject: Revert "ACPI / EC: Enable event freeze mode..." to fix
          a regression

This patch not only fixes the reported post-resume EC event triggering
source issue, but also fixes an unreported similar issue related to the
driver bind by adding EC event triggering source in ec_install_handlers().

Fixes: 746ed222c3b6 (ACPI / EC: Fix an issue that SCI_EVT cannot be detected after event is enabled)
Fixes: af071b862470 (ACPI / EC: Remove old CLEAR_ON_RESUME quirk)
Fixes: 8e3d836d7af8 (Revert "ACPI / EC: Enable event freeze mode..." to fix a regression)
Link: https://bugzilla.kernel.org/show_bug.cgi?id=196833
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reported-by: Alistair Hamilton <ahpatent@gmail.com>
Tested-by: Alistair Hamilton <ahpatent@gmail.com>
Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/ec.c

index 236b14324780a1c1c416c852957cfa732144b8fc..82b3ce5e937e8b980acd1a02e6a1f21c408a5ee0 100644 (file)
@@ -486,8 +486,11 @@ static inline void __acpi_ec_enable_event(struct acpi_ec *ec)
 {
        if (!test_and_set_bit(EC_FLAGS_QUERY_ENABLED, &ec->flags))
                ec_log_drv("event unblocked");
-       if (!test_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
-               advance_transaction(ec);
+       /*
+        * Unconditionally invoke this once after enabling the event
+        * handling mechanism to detect the pending events.
+        */
+       advance_transaction(ec);
 }
 
 static inline void __acpi_ec_disable_event(struct acpi_ec *ec)
@@ -1456,11 +1459,10 @@ static int ec_install_handlers(struct acpi_ec *ec, bool handle_events)
                        if (test_bit(EC_FLAGS_STARTED, &ec->flags) &&
                            ec->reference_count >= 1)
                                acpi_ec_enable_gpe(ec, true);
-
-                       /* EC is fully operational, allow queries */
-                       acpi_ec_enable_event(ec);
                }
        }
+       /* EC is fully operational, allow queries */
+       acpi_ec_enable_event(ec);
 
        return 0;
 }