From patchwork Fri Apr 28 14:19:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9704803 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 4A18F602B7 for ; Fri, 28 Apr 2017 14:20:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B7A6283BA for ; Fri, 28 Apr 2017 14:20:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 302942863C; Fri, 28 Apr 2017 14:20:45 +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=ham 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 ABC71283BA for ; Fri, 28 Apr 2017 14:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031948AbdD1OUo (ORCPT ); Fri, 28 Apr 2017 10:20:44 -0400 Received: from mout.gmx.net ([212.227.17.21]:58988 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031362AbdD1OUn (ORCPT ); Fri, 28 Apr 2017 10:20:43 -0400 Received: from localhost.localdomain ([31.18.254.51]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MgXCF-1dQK4H3YzX-00O1ZD; Fri, 28 Apr 2017 16:19:59 +0200 From: Oleksij Rempel To: dvhart@infradead.org, corentin.chary@gmail.com, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: Oleksij Rempel Subject: [PATCH] platform/x86: asus-wmi: try to set als by default Date: Fri, 28 Apr 2017 16:19:49 +0200 Message-Id: <20170428141949.3459-1-linux@rempel-privat.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-Provags-ID: V03:K0:e85mvIV31p3WTMskgx3MgbDBvwlOmXob8pN00k1U2aN0fZ7hGYt J7PuUcURu6pKBUYSrJxg5onVymVdZjK4ZreVwD49IHOVDuCtyyS+gQxbc3IElJsRE0dRYLS ZSkaJn03i0U+RYTXy6djQ0JD9tCYmETZDqJ2h/iBW5SR6/b0hcOVE2aQEdnWvJsGoX7dom+ 0HuxRR/fWi+O8bz4lZCZg== X-UI-Out-Filterresults: notjunk:1; V01:K0:+SvybHFaSfU=:7OTkLL18UmGW35bi2iMVrH YlJdBw0+w6iUx+RGmB3Vq6Ut9qcnRqnFQApxiQT+ayVgo90J5CUCbMUuuLIMv0LDs5BsjuR7I w8/TgVIn7uujyCM2ppRGjsY89yb9kjjDXw4sX1InQxexVL2jCyejUUGrWd/+0zoGjhKOWwzdB MnoNRH6ptz0bvm0q6E84uGPZg7I82u0l45VwviT9SYp2rph+YMY68qSms0e/L6ouIFNkjGf8e 3TxyoqPeD7OJSe5Whc9ITmD8V/gzbD1HN1D2s751HGp+EkwYOEEQlNZVUiWF+O3bkclfb60p3 r+Y+YO2uXGw054RDDDh+ARSXNEu/kNNHyBRx6ZsU5Lqj1F8ltMxErFPdSeqMSC3uPiUtyqt06 i9kvhUE8GWReKOPkwg8p2p5ljAYEo8g0f91x0Bt/XleD099801Z080n26AW33m9w2fhwhGSNl rVu4ZeULXU2buOJhK+Os60Dga5vby6XlvABBgKeJ2r9PYhVlGlGw7qZ8//R/Jj+ue/X2/kKdm Of+rTm3ak1fHjEOT+GopRsZDYXZfFun37xY5yROM7ho4Qp3agBBcUeCFHG2D2HrDApnb2WzCg l7TQjmprZYrL5JnerOyDK4bqSFKg8DbKCKMCFHeoSCONk4NNmobD87626n/79Jbbn2Acj2xfL qaDdbuVEN8N7cZqQHoP2Lo7LEvpFhcVA5kj/anRP4BXwl8WwRCJCArNkOCh7tu/bsHPDewEJ9 VEM0M4iL3YJQLvJ3keGRZm5rbET2UANjMQQflhrHWB7n9UF8z8ciTbH784A= 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 some laptops, for example ASUS UX330UAK, have brocken als_get function but working als_set funktion. In this case, ALS will stay turned off. Method (WMNB, 3, Serialized) { ... If (Local0 == 0x53545344) { ... If (IIA0 == 0x00050001) { If (!ALSP) { Return (0x02) } Local0 = (GALS & 0x10) <<<---- bug, should be: (GALS () & 0x10) If (Local0) { Return (0x00050001) } Else { Return (0x00050000) } } ..... If (Local0 == 0x53564544) { ... If (IIA0 == 0x00050001) { Return (ALSC (IIA1)) } ...... Method (GALS, 0, NotSerialized) { Local0 = Zero Local0 |= 0x20 If (ALAE) { Local0 |= 0x10 } Local1 = 0x0A Local1 <<= 0x08 Local0 |= Local1 Return (Local0) } Since it works without problems on Windows I assume ASUS WMI driver for Win never trying to get ALS state, and instead it is setting it by default to ON. This patch will do the same. Turn ALS on by default. Signed-off-by: Oleksij Rempel --- drivers/platform/x86/asus-nb-wmi.c | 13 +++++++++++++ drivers/platform/x86/asus-wmi.c | 12 ++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + 3 files changed, 26 insertions(+) diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c index dea98ffb6f60..e030a8d470a4 100644 --- a/drivers/platform/x86/asus-nb-wmi.c +++ b/drivers/platform/x86/asus-nb-wmi.c @@ -111,6 +111,10 @@ static struct quirk_entry quirk_asus_x550lb = { .xusb2pr = 0x01D9, }; +static struct quirk_entry quirk_asus_ux330uak = { + .wmi_force_als_set = true, +}; + static int dmi_matched(const struct dmi_system_id *dmi) { pr_info("Identified laptop model '%s'\n", dmi->ident); @@ -369,6 +373,15 @@ static const struct dmi_system_id asus_quirks[] = { }, { .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. UX330UAK", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "UX330UAK"), + }, + .driver_data = &quirk_asus_ux330uak, + }, + { + .callback = dmi_matched, .ident = "ASUSTeK COMPUTER INC. X550LB", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 8fe5890bf539..9d3dac30cb08 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -1109,6 +1109,15 @@ static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) } /* + * Some devices dont support or have borcken get_als method + * but still support set method. + */ +static void asus_wmi_set_als(void) +{ + asus_wmi_set_devstate(ASUS_WMI_DEVID_ALS_ENABLE, 1, NULL); +} + +/* * Hwmon device */ static int asus_hwmon_agfn_fan_speed_read(struct asus_wmi *asus, int fan, @@ -2117,6 +2126,9 @@ static int asus_wmi_add(struct platform_device *pdev) goto fail_rfkill; } + if (asus->driver->quirks->wmi_force_als_set) + asus_wmi_set_als(); + /* Some Asus desktop boards export an acpi-video backlight interface, stop this from showing up */ chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE); diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h index c9589d9342bb..6c1311f4b04d 100644 --- a/drivers/platform/x86/asus-wmi.h +++ b/drivers/platform/x86/asus-wmi.h @@ -44,6 +44,7 @@ struct quirk_entry { bool store_backlight_power; bool wmi_backlight_power; bool wmi_backlight_native; + bool wmi_force_als_set; int wapf; /* * For machines with AMD graphic chips, it will send out WMI event