Received: by 10.223.164.202 with SMTP id h10csp4036375wrb; Mon, 20 Nov 2017 08:52:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ6dWtOl14knndHNQ7p/ECc3V+Y0ieZHVwszEUDQr4U77x8SVfGaUoNz/1iDaurJSELz2t0 X-Received: by 10.99.125.71 with SMTP id m7mr14150101pgn.62.1511196768568; Mon, 20 Nov 2017 08:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511196768; cv=none; d=google.com; s=arc-20160816; b=wcGVstippk2hD6+8KdTqRdlqEADH7ZRJgnVMVJfMgaK+TYW9K850TAWMS9lKf0mN40 E4jfzrtDP2wNFDlI5UWk2eoKp1XiV6rdldZSzez54GJhltqKJxBArACMVi7/6qF76M4k Ctf6C6MzbcQGVd/lRW5IjArV91Ph+GPOKc9CzKGQ2TOFCLZUWhBcikVSRJhcixk+pY0S pNbiovjOUlIXesu45ZwmQYUgjj0sa9U/WwYzMnJ2fiabXIu6bvPkB5leVttO7/O/EyUk hWR2bLk4dSlDPpyOpftyZAQELWO15zzhNlFlSOZ7Plr4yeQMTTwT0QYWGUWgUBfWFFUQ WC0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=A4mqPwjmlmYk8P50HATvdYOOyD0z1rHpx3FSqgoBMvk=; b=A5SoUOoV3ycpKWCrahEzlY7xvHuf/RG5J3EVGR9n6zY9VDHX9n9aPvk2xdxhT1mx2A Pa9lJu8369js21BTNRvqpIecn3NR5sr8jd9xElAi/yaaFNF32vvTQGHrQ4rVglhKH0iv O7FR1JzKNIs3O90vd42h1r+9+wQcQ/+SNejwQQgyIfLixMroWkdoU2AEbrlZgtiEqnau hEnsx6LVAyjaC89Pu5bS3TyP0dGif9b4Fhrbkwwn37WirCnKWDZZOv5/fwVvSRzwOZSg YYTe47ZH5L+nRVb1VicT8M0hnv9qAXHnP4l8i++Bujonvk11eHQhGgt5Lri0bT65qLb8 GStQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=esHMmeJ3; 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 m26si8537529pli.826.2017.11.20.08.52.38; Mon, 20 Nov 2017 08:52:48 -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=esHMmeJ3; 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 S1751754AbdKTQvz (ORCPT + 66 others); Mon, 20 Nov 2017 11:51:55 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:39362 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbdKTQvv (ORCPT ); Mon, 20 Nov 2017 11:51:51 -0500 Received: by mail-pg0-f65.google.com with SMTP id 70so7811814pgf.6; Mon, 20 Nov 2017 08:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=A4mqPwjmlmYk8P50HATvdYOOyD0z1rHpx3FSqgoBMvk=; b=esHMmeJ3DF2/KWSC8SQIyc5PB4CZPVW28od3d9VtH9uHiB/lcNpjyPFpOLOVGA1cyL adviAYmdZ7L74xvdboO5qtmjTOymgkCjMjm1t/+2tDNm3ix2C0Wl53t3FvSosF1b7IJo WXqnMWYxxgQjUldSikVX6kWBB88iPN4eHdOqiQwYxTy5BS402UiiQdqFc9ba4XDydjsg on5cm+fd2ZT8342xhyNKczbJtSCoshaCtBC4P2IUvRGGIsD4DoVUfMPhqKtMFeM2awHC jacpsh4bBVdGqks3ASZu9noUmpFnsVxuSW2ylILhcHkcyWxIG/6l/NgNimEfcEvnJmlp IrcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=A4mqPwjmlmYk8P50HATvdYOOyD0z1rHpx3FSqgoBMvk=; b=ilE/RWyTy1aYk4pCx9D+L0cgJYt67CCdqSX9ghnO+igsWaIzzuxwdWAX2Qs1s1YaYt m4BULBXOzdpSNoeCdrT4GoDwhF7+oky9WhL9oMpjyngL9HCvHlh/Y5NHb2j9jzsU3CTb QT+UcOx8fHWQkMvEVy48uX2lUT6WYOgCiLb5qsJjFIqJ8HL+3xP36FmW2XJO+8HRVniM xC3g4D9RMQX/WPRvElJbYTVwq+tfHD/3+h57u8W4jEosRQXyxyGTa11VUnarNgT8aqd/ grE8cQhWWtpkZusOgnca4ENqp0OCN/p8umHCzyUKUwzoFnWVkjcTeh/XimEXHN7Siyu+ ev3A== X-Gm-Message-State: AJaThX7k8/DSMv0+86CrDSNOyegmTVr710MLtSVpkNHI7n62JAIsMLjO ct+YtFyXcsjt761XLiGx+JcFcflQ/M9JPg+WFz4= X-Received: by 10.99.127.84 with SMTP id p20mr14284544pgn.204.1511196710745; Mon, 20 Nov 2017 08:51:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.154.82 with HTTP; Mon, 20 Nov 2017 08:51:50 -0800 (PST) In-Reply-To: <2bf0e8c2-efe9-c309-844c-de5392216848@denx.de> References: <20171116032754.20719-1-kah.listaddress@gmail.com> <20171119170341.62e5de3d@archlinux> <2bf0e8c2-efe9-c309-844c-de5392216848@denx.de> From: Kiernan Hager Date: Mon, 20 Nov 2017 09:51:50 -0700 Message-ID: Subject: Re: [RFC] iio: light: acpi-als: Enable the light sensor on the Zenbook UX430UQ To: Marek Vasut Cc: Gabriele Mazzotta , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 19, 2017 at 11:11 AM, Marek Vasut wrote: > On 11/19/2017 06:38 PM, Gabriele Mazzotta wrote: >> 2017-11-19 18:03 GMT+01:00 Jonathan Cameron : >>> On Wed, 15 Nov 2017 20:27:54 -0700 >>> Kiernan Hager wrote: >>> >>>> 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. >>> >>> Please wrap descriptions to around 72 characters (leaves room for inden= tation >>> 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. > > Maybe that's where it should go . EC0 in the ACPI path seems like > Embedded Controller to me . > >> Kiernan, check commit aca234f6378864d85514be558746c0ea6eabfa8e >> ("asus-wmi: provide access to ALS control") in particular. >> >>>> >>>> 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 *devic= e) >>>> 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 *devic= e) >>>> >>>> iio_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")) { >>> 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? >>> >>>> + 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); >>>> } >>>> >>> > > > -- > 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 From 1584519210708841013@xxx Sun Nov 19 18:14:35 +0000 2017 X-GM-THRID: 1584194897937602464 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread