From: Kiernan Hager <kah.listaddress@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Kiernan Hager <kah.listaddress@gmail.com>
Subject: [RFC] iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ
Date: Wed, 15 Nov 2017 20:27:54 -0700 [thread overview]
Message-ID: <20171116032754.20719-1-kah.listaddress@gmail.com> (raw)
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.
Signed-off-by: Kiernan Hager <kah.listaddress@gmail.com>
---
drivers/iio/light/acpi-als.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index c35e2f8df339..8fd66166f19f 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -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);
}
--
2.15.0
next reply other threads:[~2017-11-16 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-16 3:27 Kiernan Hager [this message]
2017-11-19 17:03 ` [RFC] iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ Jonathan Cameron
2017-11-19 17:38 ` Gabriele Mazzotta
2017-11-19 18:11 ` Marek Vasut
2017-11-20 16:51 ` Kiernan Hager
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171116032754.20719-1-kah.listaddress@gmail.com \
--to=kah.listaddress@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox