From patchwork Fri May 19 07:07:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9736019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D81476034C for ; Fri, 19 May 2017 07:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B621128658 for ; Fri, 19 May 2017 07:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB14F288B5; Fri, 19 May 2017 07:08:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5524E28658 for ; Fri, 19 May 2017 07:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750746AbdESHIO (ORCPT ); Fri, 19 May 2017 03:08:14 -0400 Received: from mga04.intel.com ([192.55.52.120]:49973 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbdESHIK (ORCPT ); Fri, 19 May 2017 03:08:10 -0400 Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2017 00:07:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,362,1491289200"; d="scan'208";a="89397686" Received: from unknown (HELO Surface-Pro-3.sh.intel.com) ([10.239.159.64]) by orsmga004.jf.intel.com with ESMTP; 19 May 2017 00:07:57 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Chris Chiu Subject: [PATCH v2 3/3] ACPI / EC: Fix media keys not working problem on some Asus laptops Date: Fri, 19 May 2017 15:07:55 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chris Chiu 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 use a DMI quirk to prevent calling _GPE when doing ec_parse_device() and keep the ECDT GPE number setting for the EC device. Link: https://phabricator.endlessm.com/T16033 https://phabricator.endlessm.com/T16722 Link: https://bugzilla.kernel.org/show_bug.cgi?id=195651 Tested-by: Daniel Drake Signed-off-by: Chris Chiu Signed-off-by: Lv Zheng --- drivers/acpi/ec.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index e232a1c..b6d28ef 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -190,6 +190,7 @@ static struct workqueue_struct *ec_query_wq; static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */ static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */ +static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setting */ /* -------------------------------------------------------------------------- * Logging/Debugging @@ -1371,12 +1372,21 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) if (ec->data_addr == 0 || ec->command_addr == 0) return AE_OK; - /* Get GPE bit assignment (EC events). */ - /* TODO: Add support for _GPE returning a package */ - status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); - if (ACPI_FAILURE(status)) - return status; - ec->gpe = tmp; + if (boot_ec && EC_FLAGS_IGNORE_DSDT_GPE) { + /* + * First boot_ec is always ECDT EC. + * Always inherit the GPE number setting from the first + * boot_ec. + */ + ec->gpe = boot_ec->gpe; + } else { + /* Get GPE bit assignment (EC events). */ + /* TODO: Add support for _GPE returning a package */ + status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); + if (ACPI_FAILURE(status)) + return status; + ec->gpe = tmp; + } /* Use the global lock for all EC transactions? */ tmp = 0; acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); @@ -1769,11 +1779,39 @@ static int ec_correct_ecdt(const struct dmi_system_id *id) return 0; } +/* + * Some DSDTs contain wrong GPE setting. + * Asus FX502VD/VE, X550VXK, X580VD + * Link: https://bugzilla.kernel.org/show_bug.cgi?id=195651 + */ +static int ec_honor_ecdt_gpe(const struct dmi_system_id *id) +{ + pr_debug("Detected system needing ignore DSDT GPE setting.\n"); + EC_FLAGS_IGNORE_DSDT_GPE = 1; + return 0; +} + static struct dmi_system_id ec_dmi_table[] __initdata = { { ec_correct_ecdt, "MSI MS-171F", { DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-171F"),}, NULL}, + { + ec_honor_ecdt_gpe, "ASUS FX502VD", { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "FX502VD"),}, NULL}, + { + ec_honor_ecdt_gpe, "ASUS FX502VE", { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "FX502VE"),}, NULL}, + { + ec_honor_ecdt_gpe, "ASUS X550VXK", { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL}, + { + ec_honor_ecdt_gpe, "ASUS X580VD", { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL}, {}, };