Skip to content


ACPI / EC: Add support to disallow QR_EC to be issued when SCI_EVT is…
Browse files Browse the repository at this point in the history
…n't set

There is a platform refusing to respond QR_EC when SCI_EVT isn't set
(Acer Aspire V5-573G).

Currently, we rely on the behaviour that the EC firmware can respond
something (for example, 0x00 to indicate "no outstanding events") to
QR_EC even when SCI_EVT is not set, but the reporter has complained
about AC/battery pluging/unpluging and video brightness change delay
on that platform.

This is because the work item that has issued QR_EC has to wait until
timeout in this case, and the _Qxx method evaluation work item queued
after QR_EC one is delayed.

It sounds reasonable to fix this issue by:
 1. Implementing SCI_EVT sanity check before issuing QR_EC in the EC
    driver's main state machine.
 2. Moving QR_EC issuing out of the work queue used by _Qxx evaluation
    to a seperate IRQ handling thread.

This patch fixes this issue using solution 1.

By disallowing QR_EC to be issued when SCI_EVT isn't set, we are able to
handle such platform in the EC driver's main state machine. This patch
enhances the state machine in this way to survive with such malfunctioning
EC firmware.

Note that this patch can also fix CLEAR_ON_RESUME quirk which also relies
on the assumption that the platforms are able to respond even when SCI_EVT
isn't set.

Fixes: c0d6534 ACPI / EC: Fix race condition in ec_transaction_completed()
Reported-and-tested-by: Alexander Mezin <>
Signed-off-by: Lv Zheng <>
Cc: 3.16+ <> # 3.16+
Signed-off-by: Rafael J. Wysocki <>
  • Loading branch information
Lv Zheng authored and rafaeljw committed Aug 26, 2014
1 parent 52addcf commit 3afcf2e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/acpi/ec.c
Expand Up @@ -197,6 +197,8 @@ static bool advance_transaction(struct acpi_ec *ec)
t->rdata[t->ri++] = acpi_ec_read_data(ec);
if (t->rlen == t->ri) {
if (t->command == ACPI_EC_COMMAND_QUERY)
pr_debug("hardware QR_EC completion\n");
wakeup = true;
} else
Expand All @@ -208,7 +210,20 @@ static bool advance_transaction(struct acpi_ec *ec)
return wakeup;
} else {
if ((status & ACPI_EC_FLAG_IBF) == 0) {
* There is firmware refusing to respond QR_EC when SCI_EVT
* is not set, for which case, we complete the QR_EC
* without issuing it to the firmware.
if (!(status & ACPI_EC_FLAG_SCI) &&
(t->command == ACPI_EC_COMMAND_QUERY)) {
t->rdata[t->ri++] = 0x00;
pr_debug("software QR_EC completion\n");
wakeup = true;
} else if ((status & ACPI_EC_FLAG_IBF) == 0) {
acpi_ec_write_cmd(ec, t->command);
} else
Expand Down

0 comments on commit 3afcf2e

Please sign in to comment.