asus-wmi: provide access to ALS control
[ Upstream commit aca234f6378864d85514be558746c0ea6eabfa8e ] 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 <linux@rempel-privat.de> Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0e0280b077
commit
32101be323
1 changed files with 5 additions and 0 deletions
|
@ -117,6 +117,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
|
||||
|
@ -1759,6 +1760,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)
|
||||
|
@ -1785,6 +1787,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
|
||||
};
|
||||
|
||||
|
@ -1805,6 +1808,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);
|
||||
|
|
Loading…
Add table
Reference in a new issue