Received: by 10.223.164.202 with SMTP id h10csp1421526wrb; Wed, 15 Nov 2017 20:19:46 -0800 (PST) X-Google-Smtp-Source: AGs4zMarcAogEqsvp8HYrjDt/2t9Gu1XMJfiaocMVN5nr6MR297cpGP37JfZ9jLlrSDe+Of4incg X-Received: by 10.98.19.23 with SMTP id b23mr416073pfj.63.1510805986427; Wed, 15 Nov 2017 20:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510805986; cv=none; d=google.com; s=arc-20160816; b=TCX8sOV8bSWygtIMYUAqDrppNA4UZI5O/iA6nepTUWDE60vtZVclKahPv4525T1xOo ehtzYLjXQOjVoef5/uh41R0l+zCr1e37IDvqeYKQPQmrBWEIf78vGF49aCjUKwMRGzby hqKUfjnrbd8aQqfjEr7ejWiM3ak+ls+taXNvlXcrIBjQatg28uMNpeRYi2Hk3ljjkii5 QwqLg49ILQ3e0GE7UepD9Rx8qoNLF9QdR7E9Doun9Tq9BTk58EkxJ/5CDQkmyL/+utLk GMVaF9jPmjtD2+G+jFb3P5tuZd0yksydJyUrO5q0xH4NUwoyG2tFs7wyNAVXm0SPKdc/ 7zeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=QKDK/di1L0oqEvFmoyUYl4cFyDjV195+t6dONFYWv+I=; b=ohbclxTeYd5aYvd6C0+n6pLyam29CJFpL59uj870ko2gHQ1Y3J84p4ssO2lWFNEVx4 fORZgBAyn/Ud6vxe1wdfSle9h+YO08iC2ERyFjg9HeWYhUnyE1jjGG82cB+dGRJRkCU0 ggbszbI4+Qsre8QYNW0bKKRZ6cOYvPAH+6KK0GVohXWxXkUa6k0Wnaj+rBoBmVdxI/10 i6hm5iAFuOh6cQSFV5xVpUhJyG05fLdDqa2vTv1OcEx6LBst6RNRNU50pho3U4V5cgpu uSVs43G8VckuMRaiWlgoAjY2RClB2724TzEXpoMBhDiZZY6+LhGorH5d7VZe7h4xA2fF XsEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TOryhOq8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si171563pgo.486.2017.11.15.20.19.34; Wed, 15 Nov 2017 20:19:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TOryhOq8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932663AbdKPD3F (ORCPT + 89 others); 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 Received: by mail-it0-f67.google.com with SMTP id y15so4298032ita.4; Wed, 15 Nov 2017 19:28:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=QKDK/di1L0oqEvFmoyUYl4cFyDjV195+t6dONFYWv+I=; b=TOryhOq8dq1EIZwK9z7aiIvcSzK+l6QrWo//8XmQ8YTTslNtOM0uo45yJPJBpyDNiP ssH7gF9Fd2krFu+LozfyfiMY+i3EBvIrWWnhcu5PlmydYNKwlVREh/MXjfWuVRUfmWBz L+jsUiXOPyvA36ItQ9OfCvGWknBfz9u/EYh7/ckX6bU5eHWL8XtPzDRy/R3yB6iuupOf 9cm5vyrREcWgpDP5exw41G55iC/4X2wuOVEO60UWcyqnAW9vcafabc5hjtHq7SQx+B0j 4Nd/Ui5lnwzzXv7H/PGpu7DwAaQ96Q/siDasd6Qakf16Q1dg6LPc1YrAhYRHsLL5qWJb sltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QKDK/di1L0oqEvFmoyUYl4cFyDjV195+t6dONFYWv+I=; b=piau1q7jkvHQ3ClF8XA+dGMH/Nvi09h3KEjDz60PC9AHkWQ41EfDiqhQ/lC4DgAP/s hyzPmHvjUgpHIe2fMWVeSApd8pKcD+78Nrq9nVQlHjO1pdj7QnWPkqnxxI2WL43yef9l rIf48z4Suiuv1MiR8SkjWYRsZMS580XDkLwnzXUKrvl8CU5l3NXbJbBw7pKun1B8chi6 eFVApHQrbtSd8Nz2/N1eB2YNLDCDAI1VezaZ3sqdeghhJPSsIRCHR75sr5ZwOsaBUNlk oc/axa4o9LPLsWQMvtsTIfk6kK36HPvPKr1ssD1ovflAswW8oXdINtVEZzCH9tbvvqtm INeQ== X-Gm-Message-State: AJaThX5QjrIfnjCs/AyhN14AppWngIO6PlJiTghL8Jiv8PKH/+tNowP5 lobJyRaXmWGmYSJzYeS37g0= X-Received: by 10.36.87.207 with SMTP id u198mr734826ita.108.1510802937618; Wed, 15 Nov 2017 19:28:57 -0800 (PST) Received: from kiernan-UX430UQ.cg.shawcable.net (S01066c198fc40c0f.cg.shawcable.net. [96.51.153.191]) by smtp.gmail.com with ESMTPSA id x7sm57942iod.86.2017.11.15.19.28.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 19:28:56 -0800 (PST) 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 Precedence: bulk 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 From 1584692565658760928@xxx Tue Nov 21 16:09:59 +0000 2017 X-GM-THRID: 1584692538731272220 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread