From patchwork Tue Nov 1 04:30:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9406893 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 A1E2960234 for ; Tue, 1 Nov 2016 04:34:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91A752949E for ; Tue, 1 Nov 2016 04:34:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8458C294A5; Tue, 1 Nov 2016 04:34:58 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 102092949E for ; Tue, 1 Nov 2016 04:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753004AbcKAEda (ORCPT ); Tue, 1 Nov 2016 00:33:30 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36135 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965635AbcKAEdL (ORCPT ); Tue, 1 Nov 2016 00:33:11 -0400 Received: by mail-pf0-f195.google.com with SMTP id n85so10516040pfi.3; Mon, 31 Oct 2016 21:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GB2KyMSZigT/9jMjfu8LmbPxPeRL9VY1bO8ey4DIuR0=; b=NdVLTGyvm/r45szKhIwdJ8nLaD5ndAkKpvyQ+Ei0zbHWab//dXirkqYfVQKTEKox2v XIybEkDVOC6ctFms8fTJ1gLPzqRnGrt/OQ5GUO5640zyA+ig4ZNdKHi5pnpG7SRJvJKd 49CShuPqONW/HM7LrNM0aOCAcpj0mODI1Z1bjUpHrx6DSPQCHV7K+1fr9xKB4QGwGUsE 77I6J2zFfCiTk+5NUVmaupCI0iz0ne1DgkIsP7kWMvhxm8X+LkYDLRzLkZtWY7nBf4z0 VpMs3bstSnjIAFaJCgs/UwRffU4pf5Gt7jQmC+B1JlZw61a7OlX53FFFYutmrZhosFtp jfqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GB2KyMSZigT/9jMjfu8LmbPxPeRL9VY1bO8ey4DIuR0=; b=L8Szm0xjZfBvC/y5kbKInZgHpDEa0uKSn7PUj0fjR+zrSuGQW2+vQqxsSDLCKQZDPu AXl9B6Ka9EWauSm7/YIEiD6nCiHrpxVW/c6+B1xgudigan5rXLFoIQATFKJM0HKaTiF0 LdsYRNpOxP2jJ7MrMSeHLPz24IB6tMoDxGoJqbChAjTPeBXK4E/q94C2no7iYqJeLKR5 1fHPOD+z1Sz7uFyjHwBvnpq4uPBsqiC5PEggw2y/8tEtDNj48jAJPHKDy7dsocnNlQ91 0YEVUG5jh8q7xXRlWzcbYSEguUirFg0bP5KABOUCmX/KgHbS/DbQI6692hL3GnQd6Gox HHPQ== X-Gm-Message-State: ABUngvcyR/GbhHp1fgiifEQKmpoOzZQbof3Ve8wKIjLvOd2bekoiQVCG4/yx085ZTE/phQ== X-Received: by 10.99.61.10 with SMTP id k10mr46966041pga.142.1477974790356; Mon, 31 Oct 2016 21:33:10 -0700 (PDT) Received: from linux-rxt1.site (59-124-67-67.HINET-IP.hinet.net. [59.124.67.67]) by smtp.gmail.com with ESMTPSA id 73sm38769145pfn.45.2016.10.31.21.33.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 21:33:09 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: Darren Hart Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" Subject: [PATCH] acer-wmi: only supports AMW0_GUID1 on acer family Date: Tue, 1 Nov 2016 12:30:58 +0800 Message-Id: <1477974658-12589-1-git-send-email-jlee@suse.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The AMW0_GUID1 wmi is not only found on Acer family but also other machines like Lenovo, Fujitsu and Medion. In the past days, acer-wmi driver handled those non-Acer machines by quirks list. But actually acer-wmi driver was loaded on any machines that have AMW0_GUID1. This behavior is strange because those machines should be supported by appropriate wmi drivers. e.g. fujitsu-laptop, ideapad-laptop. So, This patch adds the logic to check the machine that has AMW0_GUID1 should be in Acer/Packard Bell/Gateway white list. But, it still keeps the quirk list of those supported non-acer machines for backward compatible. Tested-by: Bjørn Mork Cc: Darren Hart Signed-off-by: Lee, Chun-Yi Tested-by: Anthony Wong --- drivers/platform/x86/acer-wmi.c | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 3bb3162..734f0da 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -355,6 +355,32 @@ static const struct dmi_system_id acer_blacklist[] __initconst = { {} }; +static const struct dmi_system_id amw0_whitelist[] __initconst = { + { + .ident = "Acer", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + }, + }, + { + .ident = "Gateway", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Gateway"), + }, + }, + { + .ident = "Packard Bell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"), + }, + }, + {} +}; + +/* + * This quirk table is only for Acer/Gateway/Packard Bell family + * that those machines are supported by acer-wmi driver. + */ static const struct dmi_system_id acer_quirks[] __initconst = { { .callback = dmi_matched, @@ -464,6 +490,17 @@ static const struct dmi_system_id acer_quirks[] __initconst = { }, .driver_data = &quirk_acer_travelmate_2490, }, + {} +}; + +/* + * This quirk list is for those non-acer machines that have AMW0_GUID1 + * but supported by acer-wmi in past days. Keeping this quirk list here + * is only for backward compatible. Please do not add new machine to + * here anymore. Those non-acer machines should be supported by + * appropriate wmi drivers. + */ +static const struct dmi_system_id non_acer_quirks[] __initconst = { { .callback = dmi_matched, .ident = "Fujitsu Siemens Amilo Li 1718", @@ -598,6 +635,7 @@ static void __init find_quirks(void) { if (!force_series) { dmi_check_system(acer_quirks); + dmi_check_system(non_acer_quirks); } else if (force_series == 2490) { quirks = &quirk_acer_travelmate_2490; } @@ -2121,6 +2159,24 @@ static int __init acer_wmi_init(void) find_quirks(); /* + * The AMW0_GUID1 wmi is not only found on Acer family but also other + * machines like Lenovo, Fujitsu and Medion. In the past days, + * acer-wmi driver handled those non-Acer machines by quirks list. + * But actually acer-wmi driver was loaded on any machines that have + * AMW0_GUID1. This behavior is strange because those machines should + * be supported by appropriate wmi drivers. e.g. fujitsu-laptop, + * ideapad-laptop. So, here checks the machine that has AMW0_GUID1 + * should be in Acer/Gateway/Packard Bell white list, or it's already + * in the past quirk list. + */ + if (wmi_has_guid(AMW0_GUID1) && + !dmi_check_system(amw0_whitelist) && + quirks == &quirk_unknown) { + pr_err("Unsupported machine has AMW0_GUID1, unable to load\n"); + return -ENODEV; + } + + /* * Detect which ACPI-WMI interface we're using. */ if (wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))