From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932540AbdKPD3F (ORCPT ); Wed, 15 Nov 2017 22:29:05 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:39883 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932485AbdKPD26 (ORCPT ); Wed, 15 Nov 2017 22:28:58 -0500 X-Google-Smtp-Source: AGs4zMbU9umezpS2Ml+FtGiOzFPQFaazJ4/FdqYG2pYk6XGpRGEuq4u0zal1z9xN1UGAWlLuC8BHTA== From: Kiernan Hager To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kiernan Hager Subject: [RFC] iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ Date: Wed, 15 Nov 2017 20:27:54 -0700 Message-Id: <20171116032754.20719-1-kah.listaddress@gmail.com> X-Mailer: git-send-email 2.15.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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