From patchwork Sun Feb 28 01:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Life is hard, and then you die" X-Patchwork-Id: 12107963 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 D21C3C433E9 for ; Sun, 28 Feb 2021 01:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7964964DEE for ; Sun, 28 Feb 2021 01:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbhB1B1i (ORCPT ); Sat, 27 Feb 2021 20:27:38 -0500 Received: from chill.innovation.ch ([216.218.245.220]:46772 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbhB1B1h (ORCPT ); Sat, 27 Feb 2021 20:27:37 -0500 Received: from localhost (localhost [127.0.0.1]) by chill.innovation.ch (Postfix) with ESMTP id BB43F6401BC; Sat, 27 Feb 2021 17:26:55 -0800 (PST) X-Virus-Scanned: amavisd-new at innovation.ch Authentication-Results: chill.innovation.ch (amavisd-new); dkim=pass (2048-bit key) header.d=innovation.ch Received: from chill.innovation.ch ([127.0.0.1]) by localhost (chill.innovation.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Mc_SY7zFZNI0; Sat, 27 Feb 2021 17:26:54 -0800 (PST) From: =?utf-8?q?Ronald_Tschal=C3=A4r?= DKIM-Filter: OpenDKIM Filter v2.10.3 chill.innovation.ch 4D41E640186 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1614475613; bh=yqkjLYjbiyTHjaBgcNcDvq5q01Pg0kINgxo7MEPqnVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W2L1QXb4VPIHw3yI7Vz/2/q9aVtJdItdM+xz9eQMdt3k6aInGuhfYv68H+KtJtfme v/6RHhc/gbD8oGmqryFzGdo0is/CuOb5xVBz3glbhXspgLatfenSaRGHCzIKuSlyH/ lTTFLgle2MX3OdtfkUXmgJQl1ZydblZwVwY5g7VxkU0xtqEU/xZoNGjpc+PwFkRIME WX4Hr1S+eRRBUVrD/4btuMrzdKSFurQOtVX9qjRsQ9wH0IJb7IS9MPtznUC/+xZsFn K1hTn/Cn8nkbDr+WiD11zpVglgNnKbtwLxXyU7Gz0p1ceVgQ8fTchvcZpuhubYPeI0 Pr+816QalWEoQ== To: Jiri Kosina , Benjamin Tissoires , Jonathan Cameron , Srinivas Pandruvada , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH 2/5] iio: hid-sensor-als: Support change sensitivity in illuminance too. Date: Sat, 27 Feb 2021 17:26:40 -0800 Message-Id: <20210228012643.69944-3-ronald@innovation.ch> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210228012643.69944-1-ronald@innovation.ch> References: <20210228012643.69944-1-ronald@innovation.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 --- 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);