From patchwork Fri Apr 1 11:35:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 8723251 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5B8479F38C for ; Fri, 1 Apr 2016 11:36:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D626203A4 for ; Fri, 1 Apr 2016 11:36:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A5CE2039E for ; Fri, 1 Apr 2016 11:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbcDALgI (ORCPT ); Fri, 1 Apr 2016 07:36:08 -0400 Received: from mout.gmx.net ([212.227.17.22]:59882 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751513AbcDALgH (ORCPT ); Fri, 1 Apr 2016 07:36:07 -0400 Received: from ultralex.Speedport_W_724V_09011603_00_023 ([80.136.217.105]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0M85r3-1Zr5Q82PAH-00vgHs; Fri, 01 Apr 2016 13:35:29 +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] asus-wmi: provide access to ALS control Date: Fri, 1 Apr 2016 13:35:21 +0200 Message-Id: <1459510521-4682-1-git-send-email-linux@rempel-privat.de> X-Mailer: git-send-email 2.5.0 X-Provags-ID: V03:K0:t3N2p4Lw/dimqOum6E1sPWSxw9WNmKOujL/8x6m+m3YBXQt7xBc uCxioNNkU39SgCnINZLP60f+ZKDherbima4y6YCey5ulOhXD4Uds4P1LYI/3IslKHYrdIol YG2lcKVZpe46HApZUBYUyDHLm8th0dQKF7RxUKnUdWU2A3eOGQ5Z2G78F06b4+ArzxzPhPU 2jnX9Z2KsUwoduA6wuCtg== X-UI-Out-Filterresults: notjunk:1; V01:K0:s4yTfHtUaWk=:ZVE26ppbPV4V6M1eyjMOdy 4nnidmY0hPIO/dMkjasAN55YYFTc108IUCEFJopDjZEP11MiYat4M1NQDSsExM3OvYZJOaBQJ GdFmaipnkHC0ujEW6HobtzXV4GSVQrQeiiy29pZ0PKvOl8I+h03BELy93Lq7PNon1OyMOy0RT dHcvMszFX0LzguR6oR9dv+2oRjirFMp6jGO1zs3rli+kQXixquiqGRPZSvrQjjaRFNRIaO43w u+NMpKjAU9BKe190TlyxzGv4iYgy2fmg/0iYv+w42Ew/PJYWJ+sB2YfH9raRr6Z+PdEvOlTqA zOVevLk2Ub8a0HcKA5J/mSxfgRriAvH4Wd91xVAsjf7ntnZP+idtLdvUw9IU3930k4478l39s 75MLN/zszF3qf1yyc1B3AimiNldN8NTldwODgEr5t3jYMuv465uFYiLJ2YtsyRcAEQc6zj5pq tF80EB7eLhYQvTyz6F3djE9TaybNwJFaBDZmKy3+eQ9F1F+J12Psnc/L4CtkuwvEHh0n58N2V zx5tOynSIPP+8xJupRMbAfGi/7zVxZVexV9QHqyMohDNk/uVsLA2r1G9RRvQGz+Uh+veKowBz 0aPX7yY88bPZPCKJ6m0uXZTCTDz9TLLZ6AWPKom2U6u+DbZ9VuEjAcgnjkshLKEBFoChOlxFP IwUMRUNKwG9xKqAz8zGxXvAzr/x25jNEh/23xUQRIWpJ1p5uklOFj3i32jz81CPb/xMky/Wgs i/fwSZ5j7utuDyedw56awcW7lS+RjuvOOP/rXchcaRXd8VBjqNHWEd4Qm7g= Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Asus Zenbook ux31a is providing ACPI0008 interface for ALS (Ambient Light Sensor), which is accessible for OS => Win 7. This sensor can be used with iio/acpi-als driver. Since it is disabled by default, we should use asus-wmi interface to enable it. Signed-off-by: Oleksij Rempel --- drivers/platform/x86/asus-wmi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index a96630d..a26dca3 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -114,6 +114,7 @@ MODULE_LICENSE("GPL"); #define ASUS_WMI_DEVID_LED6 0x00020016 /* Backlight and Brightness */ +#define ASUS_WMI_DEVID_ALS_ENABLE 0x00050001 /* Ambient Light Sensor */ #define ASUS_WMI_DEVID_BACKLIGHT 0x00050011 #define ASUS_WMI_DEVID_BRIGHTNESS 0x00050012 #define ASUS_WMI_DEVID_KBD_BACKLIGHT 0x00050021 @@ -1730,6 +1731,7 @@ ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, ASUS_WMI_DEVID_TOUCHPAD); ASUS_WMI_CREATE_DEVICE_ATTR(camera, 0644, ASUS_WMI_DEVID_CAMERA); ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER); ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME); +ASUS_WMI_CREATE_DEVICE_ATTR(als_enable, 0644, ASUS_WMI_DEVID_ALS_ENABLE); static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -1756,6 +1758,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_cardr.attr, &dev_attr_touchpad.attr, &dev_attr_lid_resume.attr, + &dev_attr_als_enable.attr, NULL }; @@ -1776,6 +1779,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, devid = ASUS_WMI_DEVID_TOUCHPAD; else if (attr == &dev_attr_lid_resume.attr) devid = ASUS_WMI_DEVID_LID_RESUME; + else if (attr == &dev_attr_als_enable.attr) + devid = ASUS_WMI_DEVID_ALS_ENABLE; if (devid != -1) ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0);