From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB1FC433DB for ; Sun, 28 Feb 2021 14:47:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B7D964EAF for ; Sun, 28 Feb 2021 14:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbhB1OrS convert rfc822-to-8bit (ORCPT ); Sun, 28 Feb 2021 09:47:18 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2612 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229982AbhB1OrR (ORCPT ); Sun, 28 Feb 2021 09:47:17 -0500 Received: from fraeml735-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4DpQxy2lx4z67m8h; Sun, 28 Feb 2021 22:39:02 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml735-chm.china.huawei.com (10.206.15.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sun, 28 Feb 2021 15:46:34 +0100 Received: from localhost (10.47.88.221) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Sun, 28 Feb 2021 14:46:33 +0000 Date: Sun, 28 Feb 2021 14:45:25 +0000 From: Jonathan Cameron To: Ronald =?ISO-8859-1?Q?Tschal=E4r?= CC: Jiri Kosina , Benjamin Tissoires , Jonathan Cameron , Srinivas Pandruvada , "Lars-Peter Clausen" , Peter Meerwald-Stadler , , , Subject: Re: [PATCH 2/5] iio: hid-sensor-als: Support change sensitivity in illuminance too. Message-ID: <20210228144525.00000730@Huawei.com> In-Reply-To: <20210228012643.69944-3-ronald@innovation.ch> References: <20210228012643.69944-1-ronald@innovation.ch> <20210228012643.69944-3-ronald@innovation.ch> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.47.88.221] X-ClientProxiedBy: lhreml718-chm.china.huawei.com (10.201.108.69) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On Sat, 27 Feb 2021 17:26:40 -0800 Ronald Tschalär wrote: > Recent MacBook Pro's specify the usage of the change sensitivity field > as illuminance (with a change sensitivity modifier) rather than as > light. > > Signed-off-by: Ronald Tschalär This looks fine to me though it the hid sensors spec never fails to surprise me in the different slight variants of the same thing that come up. Illuminance is at least fairly well defined, but who knows what for the DATA_LIGHT version takes? Anyhow, lets give time for Srinivas to sanity check this as he's much more familiar with that spec than I am. Jonathan > --- > drivers/iio/light/hid-sensor-als.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c > index a21c827e4953d..849ee37dcd866 100644 > --- a/drivers/iio/light/hid-sensor-als.c > +++ b/drivers/iio/light/hid-sensor-als.c > @@ -252,6 +252,14 @@ static int als_parse_report(struct platform_device *pdev, > HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS | > HID_USAGE_SENSOR_DATA_LIGHT, > &st->common_attributes.sensitivity); > + > + if (st->common_attributes.sensitivity.index < 0) > + sensor_hub_input_get_attribute_info(hsdev, > + HID_FEATURE_REPORT, usage_id, > + HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS | > + HID_USAGE_SENSOR_LIGHT_ILLUM, > + &st->common_attributes.sensitivity); > + > dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n", > st->common_attributes.sensitivity.index, > st->common_attributes.sensitivity.report_id);