From 889bd7cb3e72cc7d40f18f35ff2cfd7d09b6a241 Mon Sep 17 00:00:00 2001 Message-Id: <889bd7cb3e72cc7d40f18f35ff2cfd7d09b6a241.1505121993.git.lv.zheng@intel.com> In-Reply-To: References: <99f23db65bbe89ee856018629654584a96734c84.1501141963.git.lv.zheng@intel.com> From: Lv Zheng Date: Thu, 31 Aug 2017 11:25:52 +0800 Subject: [PATCH v5 1/4] ACPI / EC: Fix regression related to the triggering source of the post-resume EC event handling After reverting back to stop using ec_freeze_events=N by commit 9c40f956, the platforms that are fixed by the ec_freeze_events=Y or commit reverted by commit 4c237371 can regress again. This patch fixes the regressions. Related commits: Commit: e923e8e79e18fd6be9162f1be6b99a002e9df2cb Subject: ACPI / EC: Fix an issue that SCI_EVT cannot be detected after event is enabled Commit: 4c237371f290d1ed3b2071dd43554362137b1cce Subject: ACPI / EC: Remove old CLEAR_ON_RESUME quirk Commit: 9c40f956ce9b331493347d1b3cb7e384f7dc0581 Subject: Revert "ACPI / EC: Enable event freeze mode..." to fix a regression See bug report and verification result in link #1 and #2. For link #1, if key presses occurred before resume, commit 4923e8 surely could initiate the event polling after the noirq stage; but if key presses occurred after resume, commit 4923e8 couldn't help to initiate the event polling, causing EC event stuck. For link #2, if same issue occurred as link #1 to Samsung platforms, with Samsung quirks removed by commit 4c237371, EC event stuck could also be observed. However the situation can be improved when we were using ec_freeze_events=Y and the silicon wasn't buggy, with this behavior reverted by commit 9c40f9, the problems could be re-surfaced. Note that it is hard to reproduce this issue, as it requires the validator to trigger EC events after the beginning of the resume and before the end of the noirq stage. So valiators may sometimes think this was a regression, but sometimes think this wasn't. Fixes: e923e8e79e18 (ACPI / EC: Fix an issue that SCI_EVT cannot be detected after event is enabled) Fixes: 4c237371f290 (ACPI / EC: Remove old CLEAR_ON_RESUME quirk) Fixes: 9c40f956ce9b (Revert "ACPI / EC: Enable event freeze mode..." to fix a regression) Link: https://bugzilla.kernel.org/show_bug.cgi?id=196847 [#1] Link: https://bugzilla.kernel.org/show_bug.cgi?id=196833 [#2] Signed-off-by: Lv Zheng Tested-by: Tomislav Ivek Reported-and-Tested-by: Luya Tshimbalanga Reported-by: Alistair Hamilton Cc: 4.11+ # 4.11+ --- drivers/acpi/ec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fdfae6f..02f38c1 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -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) -- 2.7.4