From patchwork Fri Apr 21 15:24:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9693459 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 09F2B601D4 for ; Fri, 21 Apr 2017 18:39:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3B0528654 for ; Fri, 21 Apr 2017 18:39:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E877B28660; Fri, 21 Apr 2017 18:39:50 +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 101E628654 for ; Fri, 21 Apr 2017 18:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161932AbdDUSjs (ORCPT ); Fri, 21 Apr 2017 14:39:48 -0400 Received: from mout.gmx.net ([212.227.17.21]:65217 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423342AbdDUSjp (ORCPT ); Fri, 21 Apr 2017 14:39:45 -0400 Received: from localhost.localdomain ([31.18.251.158]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M34eJ-1cBowq1lfb-00sxSw; Fri, 21 Apr 2017 17:24:39 +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, 21 Apr 2017 17:24:34 +0200 Message-Id: <20170421152434.3834-1-linux@rempel-privat.de> X-Mailer: git-send-email 2.11.0 X-Provags-ID: V03:K0:X6giuMJr1QIu5hLv8evp60nx99AE9RcWhRPvf4DfQeR4xkd6nxt cUC7YVxMozoKO+hf16lC5R8+AN1wQRpkJv0iTspz8sr1hbWkGoKNRO0y68W5JTzOetHiNXc frDAO2N3AlRJRAbCUkKuU1yRSc9zpjOMMYf/yw8BLpR5r8TFTYgOz3zM6AuIVV8LWm8p4Fe J/zdXsysB8c6mv3PcP0og== X-UI-Out-Filterresults: notjunk:1; V01:K0:ghDir1ADfH8=:C48Snt1/oIKzsn53f1G05b qDhGHPsjgjseCQ9rgK8cpabtio64j5uTd+2Goz/7/oy/hc5BtbUdM0MguPLHivJT1A9uj6N7n lSynDS/gE3gb+KiZ5Uy/gTXAsmqYQS5Igr3rJRK811HPJOJ6UDBNbsGeXshXsGihN3iCtgJYK b4ZjzGq71/fHxhiqs7augFWKGRbJk6vu3wJ/WxWSpJmz1uHi7FVtZROTzdj7lJidp0ooBxPJg hwJft9/o/F0312m92tMs3i/D5kJv1Trydix7XQqXZxvkLRLfKDCZQs5aoBnqzpdLFJscL4pr1 THiBqVsFW2J+jv54uF/YJnePhh1Wi5OerTbFHYFAI7TQdpcKHbB0dMR6MANROiam+OIrb77dT ZgPB1XS9qPE+/0v3nThUU0OIjLpEZSrqg27RKZpo9sFQDPYYCd9ydn7lWElzyzVUmHWzoKYw4 axrB3Jk+WoF0SRE3aDjbUD6SQtmpkQak279+ZTf/kzb/WD6R+LcnhvA/0VT641Jh3ibSBn5cq zAWdDAS/5X5n/3jDfaZAi/mE37zP+woTbw4rNtF+EZVRZAiDPw2SljyL3rp3/eVlTwMaRrVAX QHsO6b+zSwvf1iKACIRDWs9HLQm4uNzhqcsc2QmteLUzjjY/xG3P9VhA516yUQuS63flvhOXW yjNfRE+8ctaLJ8ckhVV+K1dagunF2Sxn/2GoQ+dBPtRW3yCmjEGBvaxPEKVrGeApwb26kKGk3 L+BDLg1KzhtvVCW8+rxFbvCFPckjW+Hi+7KnTdX+6yvSPmf2KOkV7cMXnsc= 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)) } 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-wmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 8fe5890bf539..6b3aef40431c 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,8 @@ static int asus_wmi_add(struct platform_device *pdev) goto fail_rfkill; } + 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);