[PATCH] Fix the ambient light sensor on Zenbook UX430UQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I recently discovered that the acpi-als driver doesn't properly
activate the ambient light sensor in this laptop. The sensor begins in
the off state, and gives a constant brightness value of 0x190 when
queried. The solution is to call the \_SB.PCI0.LPCB.EC0.ALSC method
with an integer argument of 1 when the module is loaded. I have a
patch for this, but I don't know if what it does constitutes proper
testing for the presence of that method, or if I should disable the
sensor when the module is unloaded, so input is welcome on those
details.

--- acpi-als.c.orig 2017-11-09 13:29:43.346699941 -0700
+++ acpi-als.c 2017-11-09 13:35:21.708579014 -0700
@@ -180,6 +180,11 @@
  struct acpi_als *als;
  struct iio_dev *indio_dev;
  struct iio_buffer *buffer;
+    unsigned long long temp_val;
+    acpi_status status;
+    struct acpi_object_list arg_list;
+    union acpi_object arg;
+

  indio_dev = devm_iio_device_alloc(&device->dev, sizeof(*als));
  if (!indio_dev)
@@ -204,6 +209,18 @@

  iio_device_attach_buffer(indio_dev, buffer);

+    arg_list.count = 1;
+    arg_list.pointer = &arg;
+    arg.type = ACPI_TYPE_INTEGER;
+    arg.integer.value = 1;
+
+    if (acpi_has_method(als->device->handle, "\\_SB.PCI0.LPCB.EC0.ALSC")) {
+    status = acpi_evaluate_integer(als->device->handle,
+                                   "\\_SB.PCI0.LPCB.EC0.ALSC",
+                                   &arg_list,
+                                   &temp_val);
+    }
+
  return devm_iio_device_register(&device->dev, indio_dev);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux