iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ
RFC 1/1 iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ
This makes acpi-als properly enable the light sensor on the Zenbook UX430UQ. I don't know if the checking that I do to make sure that the ACPI method exists is sufficient or if it should disable the sensor when the module is unloaded, so input is appreciated on those matters.
--- drivers/iio/light/acpi-als.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/iio/light/acpi-als.c +16 -0
@@ -179,6 +179,10 @@ static int acpi_als_add(struct acpi_device *device)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)
@@ -203,6 +207,18 @@ static int acpi_als_add(struct acpi_device *device)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); }
Signature · 1 line
2.15.0
Jonathan Cameron
maintainerQuoted 1 line · On Wed, 15 Nov 2017 20:27:54 -0700 Kiernan Hager <[email protected]>…
This makes acpi-als properly enable the light sensor on the Zenbook UX430UQ. I don't know if the checking that I do to make sure that the ACPI method exists is sufficient or if it should disable the sensor when the module is unloaded, so input is appreciated on those matters.
Please wrap descriptions to around 72 characters (leaves room for indentation in the email thread :)
This seems very much like a board specific hack. I've cc'd people who have worked on the driver recently and the acpi list.
Quoted 22 lines
Signed-off-by Kiernan Hager <[email protected]>--- drivers/iio/light/acpi-als.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/iio/light/acpi-als.c +4
-0@@ -179,6 +179,10 @@ static int acpi_als_add(struct acpi_device *device)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)
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *device) · line 215
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0@@ -203,6 +207,18 @@ static int acpi_als_add(struct acpi_device *device)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" )) {
So this is poking something on
PCI bus 0
LPC bus B
Somethingbus 0
Ambient light controller.
I assume there is a better way of establishing this needs to be set?
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0+ 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); }
2017-11-19 18:03 GMT+01:00 Jonathan Cameron <[email protected]>:
Quoted 4 lines
Quoted 1 line · On Wed, 15 Nov 2017 20:27:54 -0700 Kiernan Hager <[email protected]>…
This makes acpi-als properly enable the light sensor on the Zenbook UX43=
0UQ. I don't know if the checking that I do to make sure that the ACPI meth= od exists is sufficient or if it should disable the sensor when the module = is unloaded, so input is appreciated on those matters.
Quoted 2 lines
Please wrap descriptions to around 72 characters (leaves room for indenta=
tion
Quoted 4 lines
in the email thread :)
This seems very much like a board specific hack. I've cc'd people who have worked on the driver recently and the acpi list.
This is indeed board specific. I know many other laptops of the Zenbook line need something similar and if you look at drivers/platform/x86/asus-wmi.c or any other asus-* driver you'll find several quirks to enable various features.
Kiernan, check commit aca234f6378864d85514be558746c0ea6eabfa8e ("asus-wmi: provide access to ALS control") in particular.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Kiernan Hager <[email protected]>--- drivers/iio/light/acpi-als.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/iio/light/acpi-als.c +4
-0@@ -179,6 +179,10 @@ static int acpi_als_add(struct acpi_device *device)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 =3D devm_iio_device_alloc(&device->dev, sizeof(*als));if (!indio_dev)@@ -203,6 +207,18 @@ static int acpi_als_add(struct acpi_device *device)
Quoted 8 lines
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *device) · line 215
Quoted 8 lines
drivers/iio/light/acpi-als.c +6
-0iio_device_attach_buffer (indio_dev, buffer); + arg_list.count =3D 1; + arg_list.pointer =3D &arg; + arg.type =3D ACPI_TYPE_INTEGER; + arg.integer.value =3D 1; + + if (acpi_has_method(als->device->handle, "\\_SB.PCI0.LPCB.EC0.ALSC=
")) {
Quoted 18 lines
So this is poking something on
PCI bus 0
LPC bus B
Somethingbus 0
Ambient light controller.I assume there is a better way of establishing this needs to be set?
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0+ status =3D acpi_evaluate_integer(als->device->handle, +"\\_SB.PCI0.LPCB.EC0.ALSC" , + &arg_list, + &temp_val); + } +return devm_iio_device_register (&device->dev, indio_dev); }
Quoted 9 lines · Gabriele Mazzotta
2017-11-19 18:03 GMT+01:00 Jonathan Cameron <[email protected]>:
Quoted 8 lines
Quoted 1 line · On Wed, 15 Nov 2017 20:27:54 -0700 Kiernan Hager…
This makes acpi-als properly enable the light sensor on the Zenbook UX430UQ. I don't know if the checking that I do to make sure that the ACPI method exists is sufficient or if it should disable the sensor when the module is unloaded, so input is appreciated on those matters.
Please wrap descriptions to around 72 characters (leaves room for indentation in the email thread :)
Quoted 7 lines
Quoted 2 lines
This seems very much like a board specific hack. I've cc'd people who have worked on the driver recently and the acpi list.
This is indeed board specific. I know many other laptops of the Zenbook line need something similar and if you look at
drivers/platform/x86/asus-wmi.cor any other asus-* driver you'll find several quirks to enable various features.
Maybe that's where it should go . EC0 in the ACPI path seems like Embedded Controller to me .
Quoted 52 lines
Kiernan, check commit
aca234f6378864d85514be558746c0ea6eabfa8e("asus-wmi: provide access to ALS control") in particular.Quoted 49 lines
Quoted 22 lines
Signed-off-by Kiernan Hager <[email protected]>--- drivers/iio/light/acpi-als.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/iio/light/acpi-als.c +4
-0@@ -179,6 +179,10 @@ static int acpi_als_add(struct acpi_device *device)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)drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *device) · line 215
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0@@ -203,6 +207,18 @@ static int acpi_als_add(struct acpi_device *device)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" )) {So this is poking something on
PCI bus 0
LPC bus B
Somethingbus 0
Ambient light controller.I assume there is a better way of establishing this needs to be set?
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0+ 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); }
Signature · 2 lines
Best regards, Marek Vasut
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Gabriele Mazzotta
2017-11-19 18:03 GMT+01:00 Jonathan Cameron <[email protected]>:
Quoted 4 lines
Quoted 1 line · On Wed, 15 Nov 2017 20:27:54 -0700 Kiernan Hager <[email protected]>…
This makes acpi-als properly enable the light sensor on the Zenbook UX=
430UQ. I don't know if the checking that I do to make sure that the ACPI me= thod exists is sufficient or if it should disable the sensor when the modul= e is unloaded, so input is appreciated on those matters.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Please wrap descriptions to around 72 characters (leaves room for inden=
tation
Quoted 17 lines
Quoted 9 lines
Quoted 4 lines
in the email thread :)
This seems very much like a board specific hack. I've cc'd people who have worked on the driver recently and the acpi list.
This is indeed board specific. I know many other laptops of the Zenbook line need something similar and if you look at
drivers/platform/x86/asus-wmi.cor any other asus-* driver you'll find several quirks to enable various features.Maybe that's where it should go . EC0 in the ACPI path seems like Embedded Controller to me .
Quoted 4 lines
Kiernan, check commit
aca234f6378864d85514be558746c0ea6eabfa8e("asus-wmi: provide access to ALS control") in particular.Quoted 1 line
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/iio/light/acpi-als=
Quoted 6 lines
Signed-off-by Kiernan Hager <[email protected]>--- drivers/iio/light/acpi-als.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/iio/light/acpi-als= renamed from drivers/iio/light/acpi-als.c +0
-0
.c
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *devic=
Quoted 4 lines
index
c35e2f8df339..8fd66166f19f100644drivers/iio/light/acpi-als.c +0
-0@@ -179,6 +179,10 @@ static int acpi_als_add(struct acpi_device *devic=
e)
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *devic=
Quoted 11 lines
drivers/iio/light/acpi-als.c +4
-0struct 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 =3D devm_iio_device_alloc(&device->dev, sizeof(*als));if (!indio_dev)@@ -203,6 +207,18 @@ static int acpi_als_add(struct acpi_device *devic=
e)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *devic= · line 214
Quoted 9 lines
drivers/iio/light/acpi-als.c +6
-0iio_device_attach_buffer (indio_dev, buffer); + arg_list.count =3D 1; + arg_list.pointer =3D &arg; + arg.type =3D ACPI_TYPE_INTEGER; + arg.integer.value =3D 1; + + if (acpi_has_method(als->device->handle, "\\_SB.PCI0.LPCB.EC0.AL=
SC")) {
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
So this is poking something on
PCI bus 0
LPC bus B
Somethingbus 0
Ambient light controller.I assume there is a better way of establishing this needs to be set?
Quoted 2 lines
drivers/iio/light/acpi-als.c +2
-0+ status =3D acpi_evaluate_integer(als->device->handle, + "\\_SB.PCI0.LPCB.EC0.ALSC=
",
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
drivers/iio/light/acpi-als.c static int acpi_als_add(struct acpi_device *device) · line 224
Quoted 7 lines
drivers/iio/light/acpi-als.c +4
-0+ &arg_list, + &temp_val); + } +return devm_iio_device_register (&device->dev, indio_dev); }
Quoted 3 lines
--
Best regards,
Marek Vasut
That sounds like a good idea. I'll have a look at that file and possibly apply my patch to that instead.
Kiernan