Skip to content

Commit 440f53d

Browse files
Chris Chiurafaeljw
authored andcommitted
ACPI / EC: Fix media keys not working problem on some Asus laptops
Some Asus laptops (verified on X550VXK/FX502VD/FX502VE) get no interrupts when pressing media keys thus the corresponding functions are not invoked. It's due to the _GPE defines in DSDT for EC returns differnt value compared to the GPE Number in ECDT. Confirmed with Asus that the vale in ECDT is the correct one. This commit uses DMI quirks to prevent calling _GPE when doing ec_parse_device() and keep the ECDT GPE number setting for the EC device. With previous commit, it is ensured that if there is an ECDT, it can always be kept as boot_ec, this patch thus can implement a quirk on top of the determined ECDT boot_ec. Link: https://phabricator.endlessm.com/T16033 Link: https://phabricator.endlessm.com/T16722 Link: https://bugzilla.kernel.org/show_bug.cgi?id=195651 Tested-by: Daniel Drake <[email protected]> Signed-off-by: Chris Chiu <[email protected]> Signed-off-by: Carlo Caione <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Lv Zheng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c712bb5 commit 440f53d

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

drivers/acpi/ec.c

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static struct workqueue_struct *ec_query_wq;
190190

191191
static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
192192
static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */
193+
static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setting */
193194

194195
/* --------------------------------------------------------------------------
195196
* Logging/Debugging
@@ -1366,12 +1367,20 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
13661367
if (ec->data_addr == 0 || ec->command_addr == 0)
13671368
return AE_OK;
13681369

1369-
/* Get GPE bit assignment (EC events). */
1370-
/* TODO: Add support for _GPE returning a package */
1371-
status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp);
1372-
if (ACPI_FAILURE(status))
1373-
return status;
1374-
ec->gpe = tmp;
1370+
if (boot_ec && boot_ec_is_ecdt && EC_FLAGS_IGNORE_DSDT_GPE) {
1371+
/*
1372+
* Always inherit the GPE number setting from the ECDT
1373+
* EC.
1374+
*/
1375+
ec->gpe = boot_ec->gpe;
1376+
} else {
1377+
/* Get GPE bit assignment (EC events). */
1378+
/* TODO: Add support for _GPE returning a package */
1379+
status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp);
1380+
if (ACPI_FAILURE(status))
1381+
return status;
1382+
ec->gpe = tmp;
1383+
}
13751384
/* Use the global lock for all EC transactions? */
13761385
tmp = 0;
13771386
acpi_evaluate_integer(handle, "_GLK", NULL, &tmp);
@@ -1770,11 +1779,39 @@ static int ec_correct_ecdt(const struct dmi_system_id *id)
17701779
return 0;
17711780
}
17721781

1782+
/*
1783+
* Some DSDTs contain wrong GPE setting.
1784+
* Asus FX502VD/VE, X550VXK, X580VD
1785+
* https://bugzilla.kernel.org/show_bug.cgi?id=195651
1786+
*/
1787+
static int ec_honor_ecdt_gpe(const struct dmi_system_id *id)
1788+
{
1789+
pr_debug("Detected system needing ignore DSDT GPE setting.\n");
1790+
EC_FLAGS_IGNORE_DSDT_GPE = 1;
1791+
return 0;
1792+
}
1793+
17731794
static struct dmi_system_id ec_dmi_table[] __initdata = {
17741795
{
17751796
ec_correct_ecdt, "MSI MS-171F", {
17761797
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star"),
17771798
DMI_MATCH(DMI_PRODUCT_NAME, "MS-171F"),}, NULL},
1799+
{
1800+
ec_honor_ecdt_gpe, "ASUS FX502VD", {
1801+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1802+
DMI_MATCH(DMI_PRODUCT_NAME, "FX502VD"),}, NULL},
1803+
{
1804+
ec_honor_ecdt_gpe, "ASUS FX502VE", {
1805+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1806+
DMI_MATCH(DMI_PRODUCT_NAME, "FX502VE"),}, NULL},
1807+
{
1808+
ec_honor_ecdt_gpe, "ASUS X550VXK", {
1809+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1810+
DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL},
1811+
{
1812+
ec_honor_ecdt_gpe, "ASUS X580VD", {
1813+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1814+
DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL},
17781815
{},
17791816
};
17801817

0 commit comments

Comments
 (0)