From patchwork Tue Sep 19 08:10:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEE19CD54A8 for ; Tue, 19 Sep 2023 08:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbjISILg (ORCPT ); Tue, 19 Sep 2023 04:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjISILd (ORCPT ); Tue, 19 Sep 2023 04:11:33 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2078.outbound.protection.outlook.com [40.107.94.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2129D18D; Tue, 19 Sep 2023 01:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lq/A83rcvLCvjCjoKnuSze+rZH+tfe9ZP4rRWCK6kGOQJvLagIRSLPqYq8IykuLK5Qi59DThb5q0QwODrtkdbpdLGzeMOD5l/I1BqOHuK0Tx9HYXPJBBk0O9T8AljIP+gztGPYhFz7sxGjOp3whnFPPnN+LtagrmCcz5nhXwPlIqjcciDiJKQtiyhRCtN8jkM/L1yY6qKQDcXOKRmSfz4PoTOOBGTbXAFiTqjRQJ0UbEQ6OwNO/rtNkoM9SDR/qlYdhonILFOBVyeLgnNvUc2qK5VdJHwH0VoAaBSk+jFrtEflXCQsdSOl3R67WZbSZozUh7A+9YZ43O717dHzhtAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9DG4gCSDnInNq1X5cgRxW9hJa63Lj0CGrBitDCFBamA=; b=jndP5Dh3wg3iK8ja3sbevo34Qptff/e7qPpgX0SMv1LlAjSKaK7siNrj39gKyphT4XQciz8VHOu9OJwOA4d2YzWXurO9u12M0Tx9LyhGxjNUmMPQTjqX2CZ4RHrSTjQOTc3bjGjIyvv2XfU2EXYwgYyHvVGUcn9xT8RMzt/B/CxhR8acp6AFpnLa+NNKYONaPlTWmu36tYD+VWicnNFNR9EhEe6z3YYome0Jfn7jDcoeDTV23d+8LZUcRiX89T4vycP/TiFLezKyJikWdjXRMqE+dUO7Gb0ZpsNug/MU3eeppMD9SzrYRcjfDbJhFcdaNEeIOQBeOkoCEC+ZvbCyjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9DG4gCSDnInNq1X5cgRxW9hJa63Lj0CGrBitDCFBamA=; b=vf4tP6pjtDC7eWrBSDMvGCbopuNAtezUyT9PK5PgC+VtoOI3Aa5zE8yx5o+RCETopX40oL5EqMGl/oukr6XzHmnIgY8ZJfO1DO7A0pa2CcVgxuHaV1krRWTB68CfSETPX8XF7numPniWlkReDu+JUmtn/a8Y0QdMC1cCTn8K85M= Received: from MW4PR04CA0148.namprd04.prod.outlook.com (2603:10b6:303:84::33) by PH0PR12MB7929.namprd12.prod.outlook.com (2603:10b6:510:284::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:24 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:303:84:cafe::c4) by MW4PR04CA0148.outlook.office365.com (2603:10b6:303:84::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Tue, 19 Sep 2023 08:11:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 08:11:23 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:20 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 1/9] iio: hid-sensor-als: Use channel index to support more hub attributes Date: Tue, 19 Sep 2023 13:40:46 +0530 Message-ID: <20230919081054.2050714-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|PH0PR12MB7929:EE_ X-MS-Office365-Filtering-Correlation-Id: 2674ec1e-15f4-4a1c-3a3b-08dbb8e803e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nenf/s68h2krOG3/g0AZC6BcPzGVOmlKcP+RrYBiBd+hlEcKtjiPiJL0PRpfn5GlZXqMsQi0Kz4iOJ9CMfpsnYCby7xTtRlspGTNWzBf8cgo0n0RaxhEDbCidNFiJr7Yqq7yEUyk9NMkfnNqiQia06qeKmDp1IivQZ/Jjy2CAQJ+jtskEYESJ9DxAZnhdRTHJAFAF2YaGyAZhRIFEvt0bJF1YYXBLhNGkCYyQqqLa/vBZqspwSmqMc8jhzvJo0Q4JT9QbMGyTSy6zy5NiJN170A2Zt8cBA6BuG8ZwvQFJtFxaxmg1aHlcTt5d/18Kujz2Q3sWmzkaDJMgyVumTk+RhG60bSn92ay5E+cWjMxjOFMV3xh4YNfsCWXH75pjkZHaDCsTNL2ctsvWRlJNyMONE4ifj5zZ9SX68AHpdDDgbOiWFbeAOusgef+/CJdawr+QJYTEUhECCrDRl0QEVoX/WJCNG5y38jerMCqMwrQNjSxg6KiiOgxeOzpmKqXSjwH2Tg8gHIMb3zFubFAuuz6XJc3DLR9+qbx31wpz+oZSnuWt8WRJFjmZqjynS8vfJb662DQYnjiJl7f2AZTOAW9lqrwz++cK2fL4sEqFeqnjHxAl5Z2lgpDlfyrhyo++4tT+Dqx+CDqWiuokcgGUO47K28EeVYxug/AaH6GOXyWMMg4XX40bJqG0kB+nEV1qH4WUMTM2nkxULlG5t+7xKCRqfPt2EQHd1cZzOfQRi22crbtRpz5CNTsj+0IOoFt9TlG7lVNVCXgG6pwyKr3N4N+MQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199024)(186009)(82310400011)(1800799009)(46966006)(36840700001)(40470700004)(40480700001)(5660300002)(7696005)(86362001)(316002)(41300700001)(70206006)(70586007)(110136005)(6666004)(478600001)(8936002)(8676002)(16526019)(2616005)(356005)(81166007)(26005)(82740400003)(2906002)(36860700001)(36756003)(336012)(426003)(47076005)(40460700003)(1076003)(83380400001)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:23.8772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2674ec1e-15f4-4a1c-3a3b-08dbb8e803e5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7929 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Sensor hub attributes can be extended to support more channels. Repeat the reading for the two existing channels and store them separately. It still operates in the same manner as before where there was just one entry. So in order to support more sensor hub attributes for ALS use channel index to get specific sensor hub attributes. Signed-off-by: Basavaraj Natikar Acked-by: Srinivas Pandruvada --- drivers/iio/light/hid-sensor-als.c | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index eb1aedad7edc..efb1f8862b28 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -24,7 +24,7 @@ enum { struct als_state { struct hid_sensor_hub_callbacks callbacks; struct hid_sensor_common common_attributes; - struct hid_sensor_hub_attribute_info als_illum; + struct hid_sensor_hub_attribute_info als[CHANNEL_SCAN_INDEX_MAX]; struct { u32 illum[CHANNEL_SCAN_INDEX_MAX]; u64 timestamp __aligned(8); @@ -99,8 +99,8 @@ static int als_read_raw(struct iio_dev *indio_dev, switch (chan->scan_index) { case CHANNEL_SCAN_INDEX_INTENSITY: case CHANNEL_SCAN_INDEX_ILLUM: - report_id = als_state->als_illum.report_id; - min = als_state->als_illum.logical_minimum; + report_id = als_state->als[chan->scan_index].report_id; + min = als_state->als[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_ILLUM; break; default: @@ -242,22 +242,24 @@ static int als_parse_report(struct platform_device *pdev, struct als_state *st) { int ret; + int i; + + for (i = 0; i <= CHANNEL_SCAN_INDEX_ILLUM; ++i) { + ret = sensor_hub_input_get_attribute_info(hsdev, + HID_INPUT_REPORT, + usage_id, + HID_USAGE_SENSOR_LIGHT_ILLUM, + &st->als[i]); + if (ret < 0) + return ret; + als_adjust_channel_bit_mask(channels, i, st->als[i].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", st->als[i].index, + st->als[i].report_id); + } - ret = sensor_hub_input_get_attribute_info(hsdev, HID_INPUT_REPORT, - usage_id, - HID_USAGE_SENSOR_LIGHT_ILLUM, - &st->als_illum); - if (ret < 0) - return ret; - als_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_INTENSITY, - st->als_illum.size); - als_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_ILLUM, - st->als_illum.size); - - dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum.index, - st->als_illum.report_id); - - st->scale_precision = hid_sensor_format_scale(usage_id, &st->als_illum, + st->scale_precision = hid_sensor_format_scale(usage_id, + &st->als[CHANNEL_SCAN_INDEX_INTENSITY], &st->scale_pre_decml, &st->scale_post_decml); return ret; From patchwork Tue Sep 19 08:10:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A5E5CD54A7 for ; Tue, 19 Sep 2023 08:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230439AbjISILk (ORCPT ); Tue, 19 Sep 2023 04:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbjISILg (ORCPT ); Tue, 19 Sep 2023 04:11:36 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57A4B13A; Tue, 19 Sep 2023 01:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rdp2EcccVG8kPWDW6wbvNTdJ385Y+Wp8nNlQb8fYkvCLWCIrfBrnsGt+Ljnc6qvOxMLfwM1ZAMCpYSX/4fioXw2yuEYGRnEJhcbpkFNww5o3Xw0YY+3c/Kpf7dwg2+K+qppx3w8BTn7/hripFQBsu3cthvjCmAHHwB2gUwfJOCJ5vM9FAZZ5UYzfJLYAJ1/22kXEaEUCK4DkbiJl3FzzztRXgqXrXnmK4e6HNwpWx/0at+FJmH9SmEekKM8yyurRczFuJXvtAie+Fv30NTBtBYdl0iyZu9+hr78k93PD+TWtQTjbsJhkUnZ1gopRKR8KVWKgCkf3IEXOFGA9OZCK1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AUzvzZBNARuUcuP2tJ4cRDjF1KyeW11DfvzuR6pJ5VY=; b=nYv3UUyDxETaZea6NfVqdn4cRVSKO7VgcwGLZGIxzXZfdvBxS4zS6yavMoAqckLd8ouakWerKFY/1HaTsdAuumhHd1RDhux1ZKB4QsN/q4BHeGa7MgX6rJDOFGRlZ9xXTGVCZLQWBMa0DNifpWVF+cIYTPLeRuoewppagrDhrM2rslblIiTIWSI+X41LihS3uqIGBfiAsTQXXCpvnNMyY9oOwBzziQdx8TJmn3AMqr5pgxaHzoIGcVjZFgwb2Zxq9KchKxSuWlWK2f2FWTIkCFp5Ck2tOmcbnakhqxv+dl9B9zI+OFIbOYpZYLDaQNIqBdCgizZp0ha87QFdqPbd0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AUzvzZBNARuUcuP2tJ4cRDjF1KyeW11DfvzuR6pJ5VY=; b=sdbW6VlsQUhinkEJIjG/c6JG/wLhNBrNQEGF2cz1dFs1JDm9VpOAsK49IQcsICP7L5ALxr2croRlU5fGaoVoRPPYdZ7E5vWQEWmdcnyAXUyXDdMlMjnl/DUv//ZMZ2mRjBViw//QYKaiOnDiGRfZgxoqcC8ODBmjkixj21xon+g= Received: from MW4PR04CA0167.namprd04.prod.outlook.com (2603:10b6:303:85::22) by DM4PR12MB5357.namprd12.prod.outlook.com (2603:10b6:5:39b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:26 +0000 Received: from MWH0EPF000989EA.namprd02.prod.outlook.com (2603:10b6:303:85:cafe::16) by MW4PR04CA0167.outlook.office365.com (2603:10b6:303:85::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 08:11:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EA.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 08:11:26 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:23 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 2/9] iio: Add channel type light color temperature Date: Tue, 19 Sep 2023 13:40:47 +0530 Message-ID: <20230919081054.2050714-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EA:EE_|DM4PR12MB5357:EE_ X-MS-Office365-Filtering-Correlation-Id: b73f5a74-3203-44c2-945a-08dbb8e8056c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2DxIvdJxRUJu4FpIZv/8h/k1KX3WGYHkQInszNRvgQTlszkdWqPISrpCS/ExVEwPT/vM3SCqILCBmhWlna2QuGSvWTkxg48IVe/DFUCQEyuJrelT1/0CUz10pzceZc3e2vCNnH4b7YxwsZckWQ3c2U9DegjXlGYgmyG7mC3/cTnltCDyAMSWaQq3RYA3GlwzOhXRKJLnhEsxA5wJMuIvJNm5eWUUJYY3/g6w3XGtdru/8o7HptGestktCdZnW8rRE25PmYAldse2/dsCQsLX7v1HrgJfqaQRTtax+NsUUA1xpuc6cdF2LydluJe7LxuMLaUj+IVsCK/qwUE2LcIu7iomj/DVncJu+EK7mfJ+TTogfwlP6eiLPthioepbxsEjNZXqlbAq9a+O/0/W7cxC2zCDuxzTeMm3WXQ7RyP5NR6zIAqBKZcp6BxRjsmilieUurPyAEhaxx3o+Et/49waZ4OwYXCuivYgxHp1G2jvyXjRTKW0pZWmViZlNeahMVzvJfbm67E/RZAM1DdV1ybBebCHl3NwJSb1t3cBAZ09+kWGWA1oTaepzZU0v4n7e0VU1eGQKCDHk2zEEv4CfJqAI9xepJIyuObh3n5sqDak4i34kVIqF55R6ZqS6CBBQ1j8IkQuyBlLKlIVBC1PCRqZBhJAgMlTy3KDnXEHR4DcImWCW/0li6p5k5GF9UGKFMYiJ5JaQ21v6Rlz/exQmTpRbrCRNgMC4/zo1KlbFTtV6xO3c6CiiwpyAWeZ/B/q3hwpt9EWBhMbcSpdDoLgCbsgmw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(396003)(346002)(39860400002)(376002)(82310400011)(451199024)(186009)(1800799009)(46966006)(36840700001)(40470700004)(40480700001)(81166007)(82740400003)(36756003)(356005)(86362001)(40460700003)(478600001)(70206006)(70586007)(2906002)(6666004)(4326008)(8676002)(8936002)(7696005)(426003)(2616005)(5660300002)(336012)(1076003)(36860700001)(41300700001)(316002)(110136005)(47076005)(16526019)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:26.4576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b73f5a74-3203-44c2-945a-08dbb8e8056c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5357 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support light color temperature, which is measured in kelvin. Thus, add channel type light color temperature. Signed-off-by: Basavaraj Natikar --- Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index a2854dc9a839..4cf7ed9ca57b 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2179,3 +2179,10 @@ Contact: linux-iio@vger.kernel.org Description: Number of conditions that must occur, during a running period, before an event is generated. + +What: /sys/bus/iio/devices/iio:deviceX/in_colortemp_raw +KernelVersion: 6.7 +Contact: linux-iio@vger.kernel.org +Description: + Represents light color temperature, which measures light color + temperature in Kelvin. diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index d752e9c0499b..cba942cadf97 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_POSITIONRELATIVE] = "positionrelative", [IIO_PHASE] = "phase", [IIO_MASSCONCENTRATION] = "massconcentration", + [IIO_COLORTEMP] = "colortemp", }; static const char * const iio_modifier_names[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index c79f2f046a0b..08c20e540c13 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -47,6 +47,7 @@ enum iio_chan_type { IIO_POSITIONRELATIVE, IIO_PHASE, IIO_MASSCONCENTRATION, + IIO_COLORTEMP, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 0a5c2bb60030..a63741e43ddf 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_POSITIONRELATIVE] = "positionrelative", [IIO_PHASE] = "phase", [IIO_MASSCONCENTRATION] = "massconcentration", + [IIO_COLORTEMP] = "colortemp", }; static const char * const iio_ev_type_text[] = { @@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_POSITIONRELATIVE: case IIO_PHASE: case IIO_MASSCONCENTRATION: + case IIO_COLORTEMP: break; default: return false; From patchwork Tue Sep 19 08:10:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390938 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD4D6CD54A4 for ; Tue, 19 Sep 2023 08:11:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbjISILn (ORCPT ); Tue, 19 Sep 2023 04:11:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjISILi (ORCPT ); Tue, 19 Sep 2023 04:11:38 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2748412F; Tue, 19 Sep 2023 01:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AYZzdvUaiYb1Bv/eoegpxU+3bjv8PbECSqOagvyRLuJvSCA50GTgY6f+mOz8aieeu2eZ1B57xiXGgHuJjfgvK5RKM8ZVnlE44vsuWpJgB7PqJdrpFsKuVBD13/MbWK3FiDgkk4YMobPv+cG96DkNJBrQyREw4pABT5OhZazVqPoY+ptKRVhWhH8XuYL32TVDyWTfa8HOerLIR388VagSHnF7Sh3x1rboCdq9CuO0xVVvscVX8yRHs0kT2klb+GrOmuTwZKhDz8fAPzw3smbZ507W1zXiCW4jUBksgZ171+y0wnPu+VEAESypaIVLuqDWlxYrMZPAByhnZce5PWn0xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c0+iO/szdrPTOM8xx79lFjdVBbP/nOVbTPGqV5IBkEA=; b=JO5Eu1Z+Sb3mtzNfX8HLAGsakzJ4UB63LgrhMJFfm2Z661VJKGuqh0ckL5XZUwERz8DZ7FA+cQcC7oDN5fbhdRQte9sXrsfsWDz0M+ZAMIRSjDv8zGBJJrt0S/mVIuvgIbwOXu3qGWYu1UauwtUKWmp/DuiUfQPAOWjjtPY258TC8n9ZPm3ybqeOtEp6E9gzwlahoMsi/faZfy3kmJ3ZN1DuD5ndkdKpbHMo46jWndfgeuPfU3ZybZrj3SU8+dro1ZgDQzczdbswwujKUx+ABR/HkO/cpJQYwJUSTg684DKAdUKJds1pywEVitTcFBeuHhT0j77AefSWbvALYzLYOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c0+iO/szdrPTOM8xx79lFjdVBbP/nOVbTPGqV5IBkEA=; b=kFWfXnsKRNzaxUc7aEQLVut3MGmEs3YdWlroAFTa9l7xyJZ6/JWd+Py74I3GAF/UpFnuC3njS2h7EyOH6uGjQF+kRczL9G3wZNs5x+aqYyr4ewCThjbjJwdKGG3bI1G8qdH3oZMkpqrh8S2cBHCR/oUPY5AM0z5MC0GvqjnUK58= Received: from MW4PR04CA0156.namprd04.prod.outlook.com (2603:10b6:303:85::11) by SA3PR12MB8439.namprd12.prod.outlook.com (2603:10b6:806:2f7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:29 +0000 Received: from MWH0EPF000989EA.namprd02.prod.outlook.com (2603:10b6:303:85:cafe::b6) by MW4PR04CA0156.outlook.office365.com (2603:10b6:303:85::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Tue, 19 Sep 2023 08:11:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EA.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 08:11:28 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:26 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 3/9] iio: hid-sensor-als: Add light color temperature support Date: Tue, 19 Sep 2023 13:40:48 +0530 Message-ID: <20230919081054.2050714-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EA:EE_|SA3PR12MB8439:EE_ X-MS-Office365-Filtering-Correlation-Id: ebb32687-005c-47a6-5b4c-08dbb8e806f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: itQZSu/AyruKdcnqcGmaiutOPx54VAgsEDqWo98+LuK761DPNXxeHuT2Al9sQjlIu0jra0sBj17hRE7TG3B+RCqdYDIGRrSpbt2DaiTT7JTuCIQJIgonQa2v9aP2a2Rh4oG90xxoRgJy+56Zhz4ckMmLiCnIoJGCVZam5Dx3G6gYso0yKbel2xZp2MkBqUjqCJVsE0eDnLgSB0yLSLUWKRQQxL2ICwqWLx3rhq5ZzSMrX3/QocyT7lniEfsK6CiEyMvq7OUgJZjzfxdc54zqG/4SG5aOU1quARs4tcw1ZhflLrM6jVu60Ab/PYecE/cJn2E8MRYca6/azDCvYg+TdVYs1b+ayICMzGMQAx7qz9y62lta+Zq4KkkllbvE4jmBRBmBgtPjk1ldIRiPeEk/G4Y/zDXyJffpTHCtbF0OGHxQE2juBF1+d6iTGzqB1S2Jcn6QZ8nUx5Z/2OnUJPq59FXkDGuqGr2SJiDrzRYh14DE8RWI/a9Q3Vrvt54n0Ctfl3+8bEtIe1h3XbYhx6pCHvW3NcZ9XiIzWR0tZEePmMNFFGfeEx2eOrjQlA50i8k2NSvCiK/kgO6eEH5oxelkFqIxxXNC+C0zthBsxEnDL1LboBS6BG5GqeJjf4+spb6OI91g+fSYq1WhO5gjKUnDFAfZd0++kRu+9fnXQQ5/hE/MdlJKewWKKQTGut6evGDhpCd1o3goMiW3FoswlBQefF0acbCanq5TpFyf59RlwkzGr8QLfbnclFAY2E60ujw2HLgHiRyEHJxC+77BLsze2Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(346002)(396003)(39860400002)(136003)(82310400011)(1800799009)(186009)(451199024)(46966006)(40470700004)(36840700001)(26005)(5660300002)(16526019)(1076003)(8676002)(8936002)(4326008)(82740400003)(40460700003)(2616005)(2906002)(86362001)(36756003)(81166007)(356005)(47076005)(36860700001)(83380400001)(426003)(336012)(40480700001)(7696005)(70586007)(70206006)(110136005)(6666004)(478600001)(41300700001)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:28.9888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebb32687-005c-47a6-5b4c-08dbb8e806f8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8439 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support light color temperature. As a result, add support of light color temperature. Signed-off-by: Basavaraj Natikar Acked-by: Srinivas Pandruvada --- drivers/iio/light/hid-sensor-als.c | 37 ++++++++++++++++++++++++++++-- include/linux/hid-sensor-ids.h | 1 + 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index efb1f8862b28..16a3f1941c27 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -14,8 +14,9 @@ #include "../common/hid-sensors/hid-sensor-trigger.h" enum { - CHANNEL_SCAN_INDEX_INTENSITY = 0, - CHANNEL_SCAN_INDEX_ILLUM = 1, + CHANNEL_SCAN_INDEX_INTENSITY, + CHANNEL_SCAN_INDEX_ILLUM, + CHANNEL_SCAN_INDEX_COLOR_TEMP, CHANNEL_SCAN_INDEX_MAX }; @@ -65,6 +66,16 @@ static const struct iio_chan_spec als_channels[] = { BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), .scan_index = CHANNEL_SCAN_INDEX_ILLUM, }, + { + .type = IIO_COLORTEMP, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE) | + BIT(IIO_CHAN_INFO_SAMP_FREQ) | + BIT(IIO_CHAN_INFO_HYSTERESIS) | + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), + .scan_index = CHANNEL_SCAN_INDEX_COLOR_TEMP, + }, IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP) }; @@ -103,6 +114,11 @@ static int als_read_raw(struct iio_dev *indio_dev, min = als_state->als[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_ILLUM; break; + case CHANNEL_SCAN_INDEX_COLOR_TEMP: + report_id = als_state->als[chan->scan_index].report_id; + min = als_state->als[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE; + break; default: report_id = -1; break; @@ -223,6 +239,10 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev, als_state->scan.illum[CHANNEL_SCAN_INDEX_ILLUM] = sample_data; ret = 0; break; + case HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE: + als_state->scan.illum[CHANNEL_SCAN_INDEX_COLOR_TEMP] = sample_data; + ret = 0; + break; case HID_USAGE_SENSOR_TIME_TIMESTAMP: als_state->timestamp = hid_sensor_convert_timestamp(&als_state->common_attributes, *(s64 *)raw_data); @@ -258,6 +278,19 @@ static int als_parse_report(struct platform_device *pdev, st->als[i].report_id); } + ret = sensor_hub_input_get_attribute_info(hsdev, HID_INPUT_REPORT, + usage_id, + HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE, + &st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP]); + if (ret < 0) + return ret; + als_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_COLOR_TEMP, + st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", + st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP].index, + st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP].report_id); + st->scale_precision = hid_sensor_format_scale(usage_id, &st->als[CHANNEL_SCAN_INDEX_INTENSITY], &st->scale_pre_decml, &st->scale_post_decml); diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 13b1e65fbdcc..8af4fb3e0254 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h @@ -21,6 +21,7 @@ #define HID_USAGE_SENSOR_ALS 0x200041 #define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0 #define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1 +#define HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE 0x2004d2 /* PROX (200011) */ #define HID_USAGE_SENSOR_PROX 0x200011 From patchwork Tue Sep 19 08:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390939 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E020CD54A9 for ; Tue, 19 Sep 2023 08:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbjISILr (ORCPT ); Tue, 19 Sep 2023 04:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjISILo (ORCPT ); Tue, 19 Sep 2023 04:11:44 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2071.outbound.protection.outlook.com [40.107.93.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F215A11A; Tue, 19 Sep 2023 01:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MlKMkJ/3WJGXAv/ImgxACyrtiBwtJcuaAjSU81+oIEK+g5X/3Ya5doGxEt6m0GzKxxrMw39oDS68BcMLgXLRWtXluyzur4Nj42yC8g058KvxwxsMok06qP7ZQ0ncTejTUk55fUuZY6b0vS6JX8lfQ6Uor452wNwNYzkHRpnYMVZj2zh9jBzL9MLm6dvL15CZMizRo3bwcvMxxcT4ykriOywGPOpi3GSF80MV/ZM0/bLGBS8Aq+chblrPatnZ+dnz6BDvSJT3vQxXuYo/+Y0Zd15MuJtg6L5uX32TNPgCRoX3RMxWuEk9Z1ofjMZtn8leZYHa6U6re4B/4pCZCK3Azw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T/BjVjzAJB7A3O5Ec7LWjrn0PESlN8X3HAxGueCUxso=; b=GjBC0NCrBHB169lRaz3dEcSU93FMljuVQ20sqjQjYnrUJKI0aB8SbFYT2BTfTUlmAnYAd7KWAtrS7rf2qx/GSA3W1T0wgbVUNlLbUGzBajEWPNsXyqSFN/iGgvRHJabGMy33hTpu0jrAnMaVaSymdYxyHaGaeSoexCpvo+EdfbDdVBR8WdVDZ6xdBa0uJjQ0iddh5wv+aqGTV6bcvR524HywevhLkN9qEX5kAEdRy5EQmkaN4WctW6kq4PM/FAlRBq4GlkN7UQY6/TIBd/nl1J3qdRmI7+nYbg7ZscrtB4E1Te02Xe30pTECccMOpPh/64E/m30/e0jtwmK03yc6kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T/BjVjzAJB7A3O5Ec7LWjrn0PESlN8X3HAxGueCUxso=; b=txFGxU6/7yPZqBu6N36jlFFij/01bcn2beFHD8qHsnOK8lHCilIgfpsbdUOJr1ry3MDgTSjXMXyjlOuGq8ldpvrduJWXtWoQ3Av1pgiSit6uZN2thsXXMFzhQFsL/MWQgBwIp8jxq653iXsET7oubRQwJrZPxMaTnH3K08yTAqg= Received: from MW4PR04CA0063.namprd04.prod.outlook.com (2603:10b6:303:6b::8) by DS0PR12MB7876.namprd12.prod.outlook.com (2603:10b6:8:148::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:33 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:303:6b:cafe::d6) by MW4PR04CA0063.outlook.office365.com (2603:10b6:303:6b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 08:11:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 08:11:32 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:29 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 4/9] HID: amd_sfh: Add support for light color temperature Date: Tue, 19 Sep 2023 13:40:49 +0530 Message-ID: <20230919081054.2050714-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|DS0PR12MB7876:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f9e5029-fbda-45f4-794d-08dbb8e808db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /8K3XuBTg+aiNnUu6WjVzZIqYuorS2S8XjvsZZsNXNbhQ+ohypon/uZKKbEQ0H7joNPpUFPwzJbSbReUAIh21wcCXdHKJ9XRDAXeTSDfgnAhnADaWMFIfzF6eV9M+UkOhBUsmDgV3zZl1gDBlkaSGrzLw6qzpqHV6kC0tb83xPK+Wq/1nlTIy0F5HkcWWeOUtdQUVPpFyf9U+L7woRhDYvGGPOtoJax/YSx0nJCFDP3LFohRyG9d7IWFdo8CtQaNKBZ0TLn0OCJCnQF2b7aivN8yYJUnxUmVbmHWSDYD2JWyI9rBu8pBTuwTUupkOpdAWC/WNX1bHtGG02EMeee2eSTCx4FIjrB0FT5JkzLPmscUsLapHvAPnjQlTUUeRA+ItYbN5aQxNsU0ziePY+uK4c+41AJQry7kCNg1La4xTzS4FQ/CusgPjgSh0vUjnQlyQbQGNG+je8xnsYuR+1kHloRUVy+8UpRpf9XSCJAXr7LWqe2CxJOEyS9eoWOCyraL9oL8L92Pg8O7YcIArXTv4O9bbvRKLQWYIlTDUSATr+3v/Rk2GgOhZDHXq7PnpXmc7gOVv5Pm2lciedapIbqqP/TI0VCjUbD2htTLWd2q0VtCFgS+7Q36PvNUHPpNHRvy+whPLxGr5lyEmvLo2g9GKhvIewmbH1RcFb7r5g2CEICKy1s0Hkr4P+elQRh/U7Hlk/v0GXOLcln9euESj0Jtntcu/oyYFS5zUKQbw55g2gCZIFNIgQR3W9QZAotJQuxH47Uoof0XxPC41O7w/z5mMw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199024)(186009)(82310400011)(1800799009)(40470700004)(46966006)(36840700001)(6666004)(40480700001)(7696005)(86362001)(316002)(41300700001)(70586007)(70206006)(110136005)(478600001)(5660300002)(8936002)(8676002)(2616005)(356005)(81166007)(82740400003)(16526019)(26005)(2906002)(36860700001)(426003)(36756003)(336012)(47076005)(40460700003)(1076003)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:32.1862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f9e5029-fbda-45f4-794d-08dbb8e808db X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7876 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support light color temperature. As a result, add support of light color temperature. Signed-off-by: Basavaraj Natikar Acked-by: Jiri Kosina --- drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 4 ++++ drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h | 1 + .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c index 8716a05950c8..b7e732ec4806 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c @@ -257,6 +257,10 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id, else als_input.illuminance_value = (int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER; + + if (sensor_idx == ACS_IDX) + als_input.light_color_temp = sensor_virt_addr[1]; + report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); break; diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h index ebd55675eb62..a7fc50deca4d 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h @@ -99,6 +99,7 @@ struct als_input_report { struct common_input_property common_property; /* values specific to this sensor */ int illuminance_value; + int light_color_temp; } __packed; struct hpd_feature_report { diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h index 697f2791ea9c..26e994e54ded 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h @@ -641,6 +641,13 @@ static const u8 als_report_descriptor[] = { 0x75, 32, /* HID report size(32) */ 0x95, 1, /* HID report count (1) */ 0X81, 0x02, /* HID Input (Data_Arr_Abs) */ +0x0A, 0xD2, 0x04, /* HID usage sensor data light temperature */ +0x17, 0x00, 0x00, 0x01, 0x80, /* HID logical Min_32 */ +0x27, 0xFF, 0xFF, 0xFF, 0x7F, /* HID logical Max_32 */ +0x55, 0x0, /* HID unit exponent(0x0) */ +0x75, 32, /* HID report size(32) */ +0x95, 1, /* HID report count (1) */ +0X81, 0x02, /* HID Input (Data_Arr_Abs) */ 0xC0 /* HID end collection */ }; From patchwork Tue Sep 19 08:10:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390940 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A86DCD54AE for ; Tue, 19 Sep 2023 08:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjISILw (ORCPT ); Tue, 19 Sep 2023 04:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjISILt (ORCPT ); Tue, 19 Sep 2023 04:11:49 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53CA12C; Tue, 19 Sep 2023 01:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cm8RK2xGTyMrF+raG6lUo5GvkVl5uRea4zGdoZcPtMxnYFaqx/ArdtuwMG0wK8ddXOVyBLP5fpVJ5SNAl9sktlF4+xeFQOBfIWs+aqMWItGAtLSzZR/FxFNuU/tSFCjUBy9f4ZSXYKwAmgYuuXQW6M3PMbsD3P5XZvLKnGKkycOzw/A+Dfh2gdAxqeuDO6rXhz+ai6k4m6qE751Fz2dSHjdmAOwhDwiKHxxTBg1fZbmUKAnViR4NwH3A/nv3q2msWnjCf8DkL8IPPGXMkYqFJfDmbFXO+djGkaCydBqvHi/EdEGiWEKSj3CK62rZrKxLmpxStKCdKkzf4Ke2yknryQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XYFbC19+qb+hmfTtsZu+eKfqubRxtg4a/ctf2q6CvkQ=; b=WURDObCa0nlQ5kMqyY92x3ENBJuhBj7kPvToEE189bz9gsnmPRGvzRVnct3hXJoBY8YyaUcwJB/9w8maU9lLABueBYBh8F1DhnXYyIlLxJhfhbhjHdPosqSJYj+AtlAQ8A63w6Y5KsSDTi8eSvRBrkb2PMAOes8Xun5+M8L4ytQTdwossSq//q4AcOgq1tFO70MbTw3H4S0lpnObJvTzXJAOjv6PpH/8EeB6EB06UNFbEbBVSh654wMRSADUI7FphgQlV+/tUWx9qhzAucjFGEmZwo/qWrzrenjguURU2aaQlDmG7huLG5n5SbP7TUXyDp/QWA3W3BGJ3Zm4pfmAXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XYFbC19+qb+hmfTtsZu+eKfqubRxtg4a/ctf2q6CvkQ=; b=0XSxtJzyceGLFiIbugwQhWb8FO0yXUlxjIfiSymP4QTNoUHzM/HF5spAFObGGyaHNeD4zMddxu+z+KatsW9oWDI9YAjKGL6zodkFodc17A5ZxbbuMJKKjlazLet1neIPwqyu2UWU2eWe6wvfcXt54fuV1ClBnKqQK5z6Ei4eTzc= Received: from MW4PR03CA0038.namprd03.prod.outlook.com (2603:10b6:303:8e::13) by BL3PR12MB6593.namprd12.prod.outlook.com (2603:10b6:208:38c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Tue, 19 Sep 2023 08:11:35 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:303:8e:cafe::58) by MW4PR03CA0038.outlook.office365.com (2603:10b6:303:8e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Tue, 19 Sep 2023 08:11:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 08:11:34 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:31 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 5/9] HID: amd_sfh: Add support for SFH1.1 light color temperature Date: Tue, 19 Sep 2023 13:40:50 +0530 Message-ID: <20230919081054.2050714-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E6:EE_|BL3PR12MB6593:EE_ X-MS-Office365-Filtering-Correlation-Id: 846f533c-273f-4f8f-5cbd-08dbb8e80a81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VYf8i37kOK7br0+PrLtDyo1+A+dHU92DG9gH7/92LNLW1ubNW0YiGSxzEoFBVLLOZQBA6B7qNtodQkL2wkXiDsapcXcFGM+gVN+gSxOgOezNfmL/oQ0NNBj6pbc5V97YwjKzYtYqZCPl/BGYhFc9v0MmQF5OF0WtkdGD2T4oURJe/Qs8tXlGXI5P+OFTdq8u4pE8VTfAuMxf7mE3ckRRNAhkdUAsUtGMYOr0hLK5VdHZ+x6n6u4JdJLG+WuqRhOuBqdYw3gQqARiZ1/oI44SyIPN+FQrHsBSCU5kY7jiMJyuSn24KLf1GXJKlx+tvWW+Bpi516vIiNveAzXiQx0lUB0RzT4IO7IYsFT5bZP5zPleHblFPEYLkkGZrHMxwf/oolmNO6hnffcW8S3Vj5fd7Hv4bcQgk6sLKwlgmOWXgSKreHNwZQJzERSrtTJBBsHMm9Schu5aSNgZukCRYGxvrKx89YOY5961n3x71nMsNLwDMpd6eC/cmFWr0JG+QbmE1FgGUmptX9ekduroAT24J545YLrNNpW99VJ7VXKzkBOg6AVGEiw6h6p2UoW+RVhX5ajj32DKp/K5TPeSRQL8XHtaduwLLOT9EX0JO/xClyOTkZ/dj8ZdpvqE8QZ00c69+XY5dj9PRN3qaGfScoLdBo/cCJK6nUzc3OD/1yXx+eJWYPJKwFubvC5i+sksLPngu7XP/zzJGribmXZGYnKnPtptHrsITTSpL7W/BkMOG8j9bvUMm23b3RXGrwa+S9qK4wlKjNUTEx2IOPKpBBgFPg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(39860400002)(376002)(396003)(136003)(82310400011)(1800799009)(186009)(451199024)(46966006)(36840700001)(40470700004)(110136005)(336012)(7696005)(6666004)(47076005)(478600001)(2616005)(16526019)(70586007)(356005)(2906002)(426003)(1076003)(70206006)(316002)(8676002)(4326008)(8936002)(86362001)(5660300002)(41300700001)(36756003)(82740400003)(81166007)(36860700001)(26005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:34.9824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 846f533c-273f-4f8f-5cbd-08dbb8e80a81 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6593 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support light color temperature. As a result, add support of light color temperature for SFH1.1. Signed-off-by: Basavaraj Natikar Acked-by: Jiri Kosina --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 6 ++++++ drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c index 06bdcf072d10..f100aaafa167 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c @@ -188,6 +188,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, struct sfh_mag_data mag_data; struct sfh_als_data als_data; struct hpd_status hpdstatus; + struct sfh_base_info binfo; void __iomem *sensoraddr; u8 report_size = 0; @@ -235,6 +236,11 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, memcpy_fromio(&als_data, sensoraddr, sizeof(struct sfh_als_data)); get_common_inputs(&als_input.common_property, report_id); als_input.illuminance_value = float_to_int(als_data.lux); + + memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info)); + if (binfo.sbase.s_prop[ALS_IDX].sf.feat & 0x2) + als_input.light_color_temp = als_data.light_color_temp; + report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); break; diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h index 9d31d5b510eb..6f6f5db150c3 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h @@ -88,6 +88,16 @@ struct sfh_sensor_list { }; }; +struct sfh_sensor_prop { + union { + u32 sprop; + struct { + u32 elist : 16; + u32 feat : 16; + } sf; + }; +}; + struct sfh_base_info { union { u32 sfh_base[24]; @@ -95,6 +105,8 @@ struct sfh_base_info { struct sfh_platform_info plat_info; struct sfh_firmware_info fw_info; struct sfh_sensor_list s_list; + u32 rsvd; + struct sfh_sensor_prop s_prop[16]; } sbase; }; }; @@ -134,6 +146,7 @@ struct sfh_mag_data { struct sfh_als_data { struct sfh_common_data commondata; u32 lux; + u32 light_color_temp; }; struct hpd_status { From patchwork Tue Sep 19 08:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F14ECD54A4 for ; Tue, 19 Sep 2023 08:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231567AbjISIMC (ORCPT ); Tue, 19 Sep 2023 04:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjISILu (ORCPT ); Tue, 19 Sep 2023 04:11:50 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68B2618F; Tue, 19 Sep 2023 01:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYMHIfhoWiloJJAKTkcYRWsQVb/sBlDcsL7LmuQLbghsVP++s1XgTAUS6AuUEn38E02kiHfCkRC/yZLHop798w4XFX76mRkMqY+98Rj1Qfcez0INCJkSbtn9JdQzZJZlIKLRyPKA2+Q9IbfoaM397tPDgqOTKfdzj40zws64oDBhKmzlasMNvPUoyBzU3tWxMuOYuzm2IgVMMEl/sUKe5IpE2PAMJnM5W9X9jkxnZCpGR+I5BUhwebVu/4Ug7o5NFu2bnbjWSzRdzvUMT3oHRwoahEyv89ZXCmQZbbtofdHL/V0O4rQIWFkdys5PxNblAfFR/3PaM4PMSnXPHZZq6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4GOZDiGaiqGffm/LE0+eDNy1BcfpXqw4uJ4Bmy0+nrk=; b=ZslMRHZN6ePydYYZ6UJ8hEjjufd4PTTG+1i47dnjf57kuRaVXZ99ryRmsMsGOxDZDjSkFArHSEhkS6AdHy3T6VH8+/Hf0W5kOdrp3k5vtTPjxCo6neGY8l3B2rQ/egFVu2QrrJCc/ff80Ts7v/tApRNBsbPFLV8sdfujfjNvQ/hm3WbNRIXq1F4YeZZ2WK9YEs0j2lighH5n3cnF64A8iW/Qd7+oBFrT+e/6F35lFkl7OwcI8hYENl5WWdLLcQIxGoyY6kHvFC+gHjHLjfsPPUJcBV8AYIGxLLthUz5rfs5QuwhTcI+0CS4PIcryit5br3EHyMG3M3fnpRrm0G8pow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4GOZDiGaiqGffm/LE0+eDNy1BcfpXqw4uJ4Bmy0+nrk=; b=xdCkvd/UBp7rQYBVGT5vzx2kdU+XVqzHXjzo2WxOM+yRxRtuS1yBDJ9oXuwD0tn5Y3eMX6ro0xvoDlI3+7SuDypYU+8h6z3cg970OTdhIqyZNixfi/YY/ZKPSDA/k9UNba4/sa+83dLc2rZG6/8mR9SVlM/yejqnEKivuOD97Hg= Received: from MW4PR04CA0070.namprd04.prod.outlook.com (2603:10b6:303:6b::15) by CH3PR12MB7739.namprd12.prod.outlook.com (2603:10b6:610:151::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:38 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:303:6b:cafe::4e) by MW4PR04CA0070.outlook.office365.com (2603:10b6:303:6b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 08:11:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 08:11:37 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:34 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 6/9] iio: Add channel type for chromaticity Date: Tue, 19 Sep 2023 13:40:51 +0530 Message-ID: <20230919081054.2050714-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|CH3PR12MB7739:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b7513b5-f92f-41b4-04a8-08dbb8e80c31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M42mGJh+vpWmW9vSuXmtjbyoilj9oB25bmRlQADNgyPi8Ptl8Y+31p/JjbCTsFTtEiJqqJSJ7Of4Y7IuPv6SWsbwo4itXn9RlIAwu7xpWDZkjJyBcbpY82iFHLHoftd+vRzxzSIeITCKsugGOOQKURE0AZXSG0mYcBks4Ad/2SsH29vkuGuboRyGvmyodiD+mSHqiz+vjh7xMs3nv4df+SEotyCUkXoFJPd3gK0TQPapmLEdZRfF7beWF0HqwTczPJJOCnuCsCPClIpvsgIMkYkCOrek0Df88UVjzUSaZeiwIFzxqJlWtGKEG7gVCRrf5l2aX/MA8E+hp5tM/Hw1QjoucH93IMlZbwK1J8w3WK98+ibYAl0uKzVRkkBlGA46V8qGoJgc9DaAu7xZCuNy5Uh3W3pS2Yu1i3aebtSnJF67prMGu7UUoX0pyapNr9PblUYObbB0Vtki4vya8PpUK6LDzoo3h5//JzpJkEaDBJ7G2zktp1uXABUXdFKVQKW2yMy/wpdJs0+OHWVmhSS6kTDeQNG1yG51KKyucIgcUoHgruFCHFZEd3pE0HR9b77WYJT281d4gtVC/iw8NLuxvIdvTyxBl/Cdr+iBkWnOENdDmm9dSzkN0cYNRgT4UlXZnJolqwuefy8FLaGzPdhkVlH2qqkqE8ZpqCM2X8uZzo4aZtq5rzB4cvaUzeM4Y3ikQ0BldEl8YFYFV32GGXMOfCggz/Ft2rUXaUT9NWOwLzJwJaffiLWINNJkojk0qDGRG+VTLTni5iST2O+EK2VKvA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(396003)(136003)(39860400002)(346002)(1800799009)(451199024)(186009)(82310400011)(36840700001)(40470700004)(46966006)(8676002)(8936002)(4326008)(2906002)(41300700001)(5660300002)(70206006)(70586007)(316002)(110136005)(40460700003)(478600001)(6666004)(7696005)(36756003)(16526019)(1076003)(426003)(2616005)(26005)(47076005)(336012)(40480700001)(36860700001)(81166007)(356005)(82740400003)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:37.7800 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b7513b5-f92f-41b4-04a8-08dbb8e80c31 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7739 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add channel type for chromaticity. Signed-off-by: Basavaraj Natikar --- Documentation/ABI/testing/sysfs-bus-iio | 8 ++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 1 + 4 files changed, 11 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 4cf7ed9ca57b..0c9389ad3709 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2186,3 +2186,11 @@ Contact: linux-iio@vger.kernel.org Description: Represents light color temperature, which measures light color temperature in Kelvin. + +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_x_raw +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_y_raw +KernelVersion: 6.7 +Contact: linux-iio@vger.kernel.org +Description: + The x and y light color coordinate on the CIE 1931 chromaticity + diagram. diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index cba942cadf97..6dc4d2b296bb 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -91,6 +91,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_PHASE] = "phase", [IIO_MASSCONCENTRATION] = "massconcentration", [IIO_COLORTEMP] = "colortemp", + [IIO_CHROMATICITY] = "chromaticity", }; static const char * const iio_modifier_names[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 08c20e540c13..4832c611c027 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -48,6 +48,7 @@ enum iio_chan_type { IIO_PHASE, IIO_MASSCONCENTRATION, IIO_COLORTEMP, + IIO_CHROMATICITY, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index a63741e43ddf..5edacc358c5d 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -175,6 +175,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_PHASE: case IIO_MASSCONCENTRATION: case IIO_COLORTEMP: + case IIO_CHROMATICITY: break; default: return false; From patchwork Tue Sep 19 08:10:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A870ECD54A9 for ; Tue, 19 Sep 2023 08:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbjISIME (ORCPT ); Tue, 19 Sep 2023 04:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbjISILw (ORCPT ); Tue, 19 Sep 2023 04:11:52 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC8A12F; Tue, 19 Sep 2023 01:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oHHnS2cfsJTN1Um8Q0OUZ74VY1GerowZSbg2+FPVw0veh9woZKtqX0CXOMW+TpNjGINnXndAnf1A/gxQ91E7CML8Xo47wRUEzxrSP3qCoOsMnUkB7HMu3BHxeAomiTA26fNbbJG/3BWX/Xd2xlGi9NY/VeTv1nxahYLBVOYzI75+/pvq7BASPKihSjgh3vGmPKFj599rrc608t7UAYNpfWqUvcR339vwfhqiXOhRRGtEWm5K6w+5Bh6EtnwNxrgE96QnnUS2DxxFYNf09pLuk+IEXwQEi3jVVdNNA4lza9CibuJFAD7UtfKbm428KF32DlNaE4nWFRUanKUcxl3L0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G/T/GD34c7wjZ4oKhiB7EyqZT6/B6WlMHqs7N1WAK9s=; b=dAhNRAhcJ6puTFT51DJhI0xM9lm15UuITgJ3U/55VMQJnTvBL+Lg1aTxzjzE0CCv58Pi7R5DJvQnMASk/mkuDywe5d0qz5D0TjbxoNmpbL/Q1Ws67GLBzWv7aPTqcyVWoKihnkwYLynsYR1t5IwwVrjqT/qiBxjctxTMY33A7B2DB4NOxB+/Ao3hQgegk2SBBgrygh5mrk/dwd/YM/2GWWAMO9TSGIvWz7jYHG+3Ug/TjxdxyTUdbIlNOduWFFZbvC5C5VGMooYDPr6Q3Abhk3xzWBj9ZxEe2V551yLWMkw8FTFr7Hu1yWXKwpPboSXfGQDW4OUhcxd/iRQiSTZr4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G/T/GD34c7wjZ4oKhiB7EyqZT6/B6WlMHqs7N1WAK9s=; b=jfJQRuAALqOWswnQB1zHGTajGFUa0Db7Yzl69ySBLFjnkXzMAchOkLYccV7VBwfXYeIGAto/q+ddBhCrdlMXMHZLD7JX1PKR2/PvPhInTqd0+xkAOYPYj966duMVMP+AqNWn+L6wgCUlrWd+IMMVMs1ana9oXuvGndVL4wDdsz8= Received: from MW4PR03CA0042.namprd03.prod.outlook.com (2603:10b6:303:8e::17) by IA0PR12MB8713.namprd12.prod.outlook.com (2603:10b6:208:48e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.24; Tue, 19 Sep 2023 08:11:41 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:303:8e:cafe::7f) by MW4PR03CA0042.outlook.office365.com (2603:10b6:303:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.28 via Frontend Transport; Tue, 19 Sep 2023 08:11:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 08:11:40 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:37 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 7/9] iio: hid-sensor-als: Add light chromaticity support Date: Tue, 19 Sep 2023 13:40:52 +0530 Message-ID: <20230919081054.2050714-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E6:EE_|IA0PR12MB8713:EE_ X-MS-Office365-Filtering-Correlation-Id: 7675cbf1-2d4f-4e1d-e4a1-08dbb8e80e14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yC7r3u5nqLLvyzhuhDvtF6gd4eGt+B5/F7PTDOTHFTgUbGavjzj3GJsgEVV/VEHefnZm/RsZnLGeyLNsROChWw7UmhBVWGDWWhm1/TRCh8TlAgvBTyDXKA85/ThY9IOEMJMU2FthV+4jpzDRzRPsVHRyJhdCyQqnBV0ay1+Bn+VtKgsrbkpCoEZ0hUwHjoGYRqGgObBBCGlTSwZf3z6by2fwlo7MTAH7LPnkVALRu6RP2hl7TkLY4PdFFnV5WvfBym3eEgXqGIy5d5hDcTShAK8Dqf5zjkx5+QOOYUMvOXOl7Om6ihZNG3mFQ514PcsVfuOjynHwWOj+fXVOWTV7vhXv+UFRHmcXBLepoBdxqI2KbJJHQlNSkpd4e8PittugIIYh7utWiim+uUa3i/2FsFoevm/5vZXWsU8nrZBM3R93nznHMKAa55Cok7UvOJr+6gyjlopwy7XjD707+PcO/afofeUA82gq4Vs3aWC/CpTGGv0/XfGAV4CENnv4QBNVHbxw3LFbNrfWGakZE5D6MHwXFuXwYpeffHs22OGCBHSs3pYmzhOyO+wKq5wjJG0QbCsDHiv203JHwqI8lqBob3awbrCy6nZIWFmRgQ3Yymw+EkdwGMNkvYUxlqAFETpW9HhEmw7M8pan5SGZ1gKrJY4MyElaXFoRUnv4Bap/Xm9tGo81/M2Dx9N29Fu+Q7IwDKZyd6Tiw7Nbk6HEDQEFgHdr+qqT5zRuxcjDxvc9ugQ31VAWjMs7nui0tHwYx3wF8ucpV/3rFQ7nZfrVX6Nagg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(39860400002)(346002)(376002)(82310400011)(1800799009)(186009)(451199024)(40470700004)(36840700001)(46966006)(356005)(26005)(81166007)(16526019)(82740400003)(2616005)(8936002)(8676002)(4326008)(1076003)(40460700003)(47076005)(36860700001)(2906002)(426003)(36756003)(336012)(5660300002)(40480700001)(86362001)(7696005)(478600001)(6666004)(316002)(70206006)(70586007)(110136005)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:40.9824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7675cbf1-2d4f-4e1d-e4a1-08dbb8e80e14 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8713 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add light chromaticity x and y. Signed-off-by: Basavaraj Natikar Acked-by: Srinivas Pandruvada --- drivers/iio/light/hid-sensor-als.c | 63 ++++++++++++++++++++++++++++++ include/linux/hid-sensor-ids.h | 3 ++ 2 files changed, 66 insertions(+) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 16a3f1941c27..c9d114ff080a 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -17,6 +17,8 @@ enum { CHANNEL_SCAN_INDEX_INTENSITY, CHANNEL_SCAN_INDEX_ILLUM, CHANNEL_SCAN_INDEX_COLOR_TEMP, + CHANNEL_SCAN_INDEX_CHROMATICITY_X, + CHANNEL_SCAN_INDEX_CHROMATICITY_Y, CHANNEL_SCAN_INDEX_MAX }; @@ -76,6 +78,30 @@ static const struct iio_chan_spec als_channels[] = { BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), .scan_index = CHANNEL_SCAN_INDEX_COLOR_TEMP, }, + { + .type = IIO_CHROMATICITY, + .modified = 1, + .channel2 = IIO_MOD_X, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE) | + BIT(IIO_CHAN_INFO_SAMP_FREQ) | + BIT(IIO_CHAN_INFO_HYSTERESIS) | + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), + .scan_index = CHANNEL_SCAN_INDEX_CHROMATICITY_X, + }, + { + .type = IIO_CHROMATICITY, + .modified = 1, + .channel2 = IIO_MOD_Y, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | + BIT(IIO_CHAN_INFO_SCALE) | + BIT(IIO_CHAN_INFO_SAMP_FREQ) | + BIT(IIO_CHAN_INFO_HYSTERESIS) | + BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), + .scan_index = CHANNEL_SCAN_INDEX_CHROMATICITY_Y, + }, IIO_CHAN_SOFT_TIMESTAMP(CHANNEL_SCAN_INDEX_TIMESTAMP) }; @@ -119,6 +145,16 @@ static int als_read_raw(struct iio_dev *indio_dev, min = als_state->als[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE; break; + case CHANNEL_SCAN_INDEX_CHROMATICITY_X: + report_id = als_state->als[chan->scan_index].report_id; + min = als_state->als[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_CHROMATICITY_X; + break; + case CHANNEL_SCAN_INDEX_CHROMATICITY_Y: + report_id = als_state->als[chan->scan_index].report_id; + min = als_state->als[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_CHROMATICITY_Y; + break; default: report_id = -1; break; @@ -243,6 +279,14 @@ static int als_capture_sample(struct hid_sensor_hub_device *hsdev, als_state->scan.illum[CHANNEL_SCAN_INDEX_COLOR_TEMP] = sample_data; ret = 0; break; + case HID_USAGE_SENSOR_LIGHT_CHROMATICITY_X: + als_state->scan.illum[CHANNEL_SCAN_INDEX_CHROMATICITY_X] = sample_data; + ret = 0; + break; + case HID_USAGE_SENSOR_LIGHT_CHROMATICITY_Y: + als_state->scan.illum[CHANNEL_SCAN_INDEX_CHROMATICITY_Y] = sample_data; + ret = 0; + break; case HID_USAGE_SENSOR_TIME_TIMESTAMP: als_state->timestamp = hid_sensor_convert_timestamp(&als_state->common_attributes, *(s64 *)raw_data); @@ -291,6 +335,25 @@ static int als_parse_report(struct platform_device *pdev, st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP].index, st->als[CHANNEL_SCAN_INDEX_COLOR_TEMP].report_id); + for (i = 0; i < 2; i++) { + int next_scan_index = CHANNEL_SCAN_INDEX_CHROMATICITY_X + i; + + ret = sensor_hub_input_get_attribute_info(hsdev, + HID_INPUT_REPORT, usage_id, + HID_USAGE_SENSOR_LIGHT_CHROMATICITY_X + i, + &st->als[next_scan_index]); + if (ret < 0) + return ret; + + als_adjust_channel_bit_mask(channels, + CHANNEL_SCAN_INDEX_CHROMATICITY_X + i, + st->als[next_scan_index].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", + st->als[next_scan_index].index, + st->als[next_scan_index].report_id); + } + st->scale_precision = hid_sensor_format_scale(usage_id, &st->als[CHANNEL_SCAN_INDEX_INTENSITY], &st->scale_pre_decml, &st->scale_post_decml); diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 8af4fb3e0254..6730ee900ee1 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h @@ -22,6 +22,9 @@ #define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0 #define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1 #define HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE 0x2004d2 +#define HID_USAGE_SENSOR_LIGHT_CHROMATICITY 0x2004d3 +#define HID_USAGE_SENSOR_LIGHT_CHROMATICITY_X 0x2004d4 +#define HID_USAGE_SENSOR_LIGHT_CHROMATICITY_Y 0x2004d5 /* PROX (200011) */ #define HID_USAGE_SENSOR_PROX 0x200011 From patchwork Tue Sep 19 08:10:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390943 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEEE4CD54A4 for ; Tue, 19 Sep 2023 08:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbjISIMF (ORCPT ); Tue, 19 Sep 2023 04:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230496AbjISILy (ORCPT ); Tue, 19 Sep 2023 04:11:54 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2082.outbound.protection.outlook.com [40.107.212.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC2F128; Tue, 19 Sep 2023 01:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JNYBKre6EX4TDFPDBuTGvjinLu17+UR4+s9YCvGiVO7XgoxHPJeOYb4UJ2QyH9W+R+Yo+uB7pZ7qeAJ+AoGbibCvp7ybiEm+j+aC8snu+PVmXciMfrkUjeW+4RN+gvpeZuojXMpQ5FjmMLAIRgu+0xUYbAA7RaCMooY95remTljdo7yAyYjcmAz4+jqVGaHioa60d6GFWFeZGmoXsOwvTLveGL4c2szgMouWv/zH8Ihbr7yI6tBe7T6leAI1A7Fs0RHbv2ngKDm6EJNcBK6gbk+VqgOiOC9tcCcXFhcUUc2s/kXiE+p3BbOqmUATWEmY83ixXWeE3GHC9AEPIw6fmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uaW9ndZ6fil1wmCgqAoOdbhpctkg3+X8/ea5itEqowc=; b=RSAX6T6AXKAYi1K2ng59Fq83MD6IJUY6hMgXCLYsIgsBty6+CCK98EqfSN9kTNZobYCAhWgHziTuevV0FldSAUUm0OmKmGDEfVqP9RjDvGIomSlzEO8B1AZK4yGA6NcjwTnPi7zglIYf8FGrmGlewFJCmFSSVWRjey6UMcTUSgbPlqZs8N70gbfHd2oRN83szrLuGPDFUCDzXk6QCvCpvx7UfZ1dZlNnPpGATPfQ4qBlmUvpT3VLRD0IyNkqTvf+9D+BXOfc5OXjb7gKIiHtYODY/4DLGgIMBKhz4qvLYgER2N81UQJcWf7y4Ci74AaF222hxDi2V4hEI2TgTNQndw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uaW9ndZ6fil1wmCgqAoOdbhpctkg3+X8/ea5itEqowc=; b=Q3BZKuiXB63gdj2HgeNKyHbBcY5AJO+DvZd5aR5EZsd9jgQiQkewkXWO2L6k0iFjUC4kJpcvn7GxZ5H5Oayu8DMRNyzqQrXYrWWJ3NbHEdHCV2lOe45sNZcbtAUQVbqDJu2rah7dTLNBwmdYSDnexmMGZVH7b6Oo8kUk/AsHVso= Received: from BYAPR21CA0017.namprd21.prod.outlook.com (2603:10b6:a03:114::27) by PH7PR12MB5950.namprd12.prod.outlook.com (2603:10b6:510:1d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Tue, 19 Sep 2023 08:11:45 +0000 Received: from MWH0EPF000989EB.namprd02.prod.outlook.com (2603:10b6:a03:114:cafe::b) by BYAPR21CA0017.outlook.office365.com (2603:10b6:a03:114::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.4 via Frontend Transport; Tue, 19 Sep 2023 08:11:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EB.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Tue, 19 Sep 2023 08:11:44 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:40 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 8/9] HID: amd_sfh: Add light chromaticity support Date: Tue, 19 Sep 2023 13:40:53 +0530 Message-ID: <20230919081054.2050714-9-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EB:EE_|PH7PR12MB5950:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b6be82e-0aa7-4abb-b86e-08dbb8e81042 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y2cecF5sXQr3DyAxLWlZBLY/QA49a8cpOeCMcKd+Xl6k6KQewdtoAzeQojnjIQ1RVkLWuvnpIZl++ejzWaLPs1tpmFrePrCIqRX+/A/OT47sLQtS0xMpNU5u28pcF9T8BBDz8uiGEWv3c6yx9oTbIvZHUS+vUvU88icouAigeG6SAsW6SFEzf4raGCqXbYjRpaS6lAt2bkQiEVwIAdJe3wtxUGcUICFSHhPWH5YTJwl+I4o2AMpBaGmPTrLA8kubgDm11/AFWmC8pnufOI6dTiiwMM/PHnRhVbl6njUOmS+0UdF+4hx6emb1X4xFilRAddsynHjQ+S57+OQDvjAzLEEfxPOy2hClM/Xya7oIsfccyrz+mk55jYjyvVAHLSk8x/ZId2aMgfgljUZm1lmSdLUu19ywuaYf4OY5+gXcqKU3K063T8mDmmzFgLtsR9kZ1wt30NZK7l+4ZOVajYHsYyltzxkIrzdlRJ9bHsPHilyK9LJPfE06N/jSi1+e+b8pfvVTl53uOwYBKi5Wxzu2qdIIUAmHNXi+wY+15iPnNpKSpLFRaSwtjFOOAS1Va8wUjVIHtmvYdUQlq/by9uMZCMX+eB0OPd9hMUBsr1jk+4ljmv/8h48yp/iK/a6bujyyhbgvu/4k8eyy6/tXySLROlpmaJYGsnhK9KUbdUM7L9wsiHSr7oFFZY2/svN+KdEWPOZUKmKln8cum8U2Qse8tO+IPCC+yK1/ILc2gBgYSjZ20BcjM4G/nvFWMsehis3uWvOAi114bgg2za/Azzhobw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(376002)(39860400002)(396003)(1800799009)(82310400011)(186009)(451199024)(40470700004)(36840700001)(46966006)(356005)(81166007)(26005)(82740400003)(8936002)(2616005)(16526019)(8676002)(1076003)(40460700003)(4326008)(83380400001)(36860700001)(2906002)(36756003)(47076005)(336012)(426003)(40480700001)(5660300002)(86362001)(7696005)(478600001)(6666004)(316002)(70206006)(70586007)(110136005)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:44.6226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b6be82e-0aa7-4abb-b86e-08dbb8e81042 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5950 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add light chromaticity x and y. Signed-off-by: Basavaraj Natikar Acked-by: Jiri Kosina --- .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c | 5 ++++- .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h | 2 ++ .../hid_descriptor/amd_sfh_hid_report_desc.h | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c index b7e732ec4806..ef1f9be8b893 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c @@ -258,8 +258,11 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id, als_input.illuminance_value = (int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER; - if (sensor_idx == ACS_IDX) + if (sensor_idx == ACS_IDX) { als_input.light_color_temp = sensor_virt_addr[1]; + als_input.chromaticity_x_value = sensor_virt_addr[2]; + als_input.chromaticity_y_value = sensor_virt_addr[3]; + } report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h index a7fc50deca4d..882434b1501f 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h @@ -100,6 +100,8 @@ struct als_input_report { /* values specific to this sensor */ int illuminance_value; int light_color_temp; + int chromaticity_x_value; + int chromaticity_y_value; } __packed; struct hpd_feature_report { diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h index 26e994e54ded..67ec2d6a417d 100644 --- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h +++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h @@ -648,6 +648,20 @@ static const u8 als_report_descriptor[] = { 0x75, 32, /* HID report size(32) */ 0x95, 1, /* HID report count (1) */ 0X81, 0x02, /* HID Input (Data_Arr_Abs) */ +0x0A, 0xD4, 0x04, /* HID usage sensor data light chromaticity_x */ +0x17, 0x00, 0x00, 0x01, 0x80, /* HID logical Min_32 */ +0x27, 0xFF, 0xFF, 0xFF, 0x7F, /* HID logical Max_32 */ +0x55, 0x0, /* HID unit exponent(0x0) */ +0x75, 32, /* HID report size(32) */ +0x95, 1, /* HID report count(1) */ +0X81, 0x02, /* HID Input (Data_Var_Abs) */ +0x0A, 0xD5, 0x04, /* HID usage sensor data light chromaticity_y */ +0x17, 0x00, 0x00, 0x01, 0x80, /* HID logical Min_32 */ +0x27, 0xFF, 0xFF, 0xFF, 0x7F, /* HID logical Max_32 */ +0x55, 0x0, /* HID unit exponent(0x0) */ +0x75, 32, /* HID report size(32) */ +0x95, 1, /* HID report count (1) */ +0X81, 0x02, /* HID Input (Data_Var_Abs) */ 0xC0 /* HID end collection */ }; From patchwork Tue Sep 19 08:10:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13390944 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1908CD54A7 for ; Tue, 19 Sep 2023 08:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjISIMI (ORCPT ); Tue, 19 Sep 2023 04:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231575AbjISIMC (ORCPT ); Tue, 19 Sep 2023 04:12:02 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9A4197; Tue, 19 Sep 2023 01:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehU/6wETGHNHtJ2nd84PXweGTbXEpXYW38Nun85TU8NG/LWv8Lq1i2zta3ahc/+fYDDMLCqQYF3HoVWcqBU7laNCvRMleSZx0iPuuHbzTfiqwfTLFKTm7qBJ1Fbnu6kRhFhex1UXcWFnEuH473mbPf9fTvadMKlxVKEJUnN/pS8LWJx/gTO+y7m0zrXqroicmxcdU1/Mb6pqZin6YMvTvGfzMnqv53oHerF8VBsrDPavKdwlnSxYAHDT0b/bXwfK8LpbBykPNZqowrnF5tYFk906sQPiVS2Lof9wzQBy9vIIb7mUFv3sLy2bTI8sTrKokMjGLzoVmWMXsXqNk6JjqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BRttNnP96aTPXTUOo6HAVcO1CoeD7W1mXfqZ/tJJmZU=; b=HfpDXpW79wYDU7LoLoTp+hcredY9MQzgWkWG+QIUcGWc0zhj60XslFozbVssukvGL4AyBj/G3ijJkXbQyihgoP2WbTK7Xv/5u7zLfyFbdAhbAuIwcTqihzilUPe0sWT3RlUi3kixKkGSKxY6VfnzRb5g/OIXPgOCX9DXlv6meE9qguYlCGb8ldDIINsH47fIzxPbuzwFGHVU57mUm86GM9vb67LHGyhRpkp++eUellLIIKz6Obq0/Nj59d8Yz1LqgPacr8o3/+JS6AF0ryihREgCwFdk7MKZ1IFUvHoap2TG68KBEPHY7ORX/Wb4zhGNVfrdeIL46edYgeHsOCujfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BRttNnP96aTPXTUOo6HAVcO1CoeD7W1mXfqZ/tJJmZU=; b=UjCrodRmUoQFN/LDbeMM84Jt7dKCrbA/mXBiRPBpGDRqTD4wH5OaFaLv6CKLr4BlSyUWA9qj2cy9omjs83aFPfRq3lSa9WZG0YhJfK13CZmRkqlEWLzBnFPGklcqnLyVauH1pPYl9bkqQn7OAtA5MByRHa01l/Fll5W9ilIczpw= Received: from MW4PR04CA0062.namprd04.prod.outlook.com (2603:10b6:303:6b::7) by MN2PR12MB4046.namprd12.prod.outlook.com (2603:10b6:208:1da::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.34; Tue, 19 Sep 2023 08:11:48 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:303:6b:cafe::c0) by MW4PR04CA0062.outlook.office365.com (2603:10b6:303:6b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Tue, 19 Sep 2023 08:11:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.19 via Frontend Transport; Tue, 19 Sep 2023 08:11:47 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 19 Sep 2023 03:11:44 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH v2 9/9] HID: amd_sfh: Add light chromaticity for SFH1.1 Date: Tue, 19 Sep 2023 13:40:54 +0530 Message-ID: <20230919081054.2050714-10-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> References: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|MN2PR12MB4046:EE_ X-MS-Office365-Filtering-Correlation-Id: ee221716-0782-4b78-397f-08dbb8e811f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nLA5dWu7yMjcGNYl0aKJ4izDVz7JBTJ6SH2o26b75irPAespa+0wYsc3dZgRq6JghCMgxpB+Inr85Hnf96kIK3l9BlvnVQDyyOkeRHMxCmRIauqlKIy0U8Vu45rv2PkoYjQTcte/rGQ/xULQw8dUuO8NoXL8oBBig2iG56u20t7nK/QooQNXBpoIPR66e0BcN88Yx0EwitASJVGuI3wufiLim3zje262wcenBDbrxD8iO1js6VTFnRT95fmd5ivG3HtDpwuI+QNv8C0iyEvxZ6FGCDhTAQ2kWol9hxTrk9Yf8WdweI7FLvHqTCUwjpGxxvME3fAwfqhlIMhre1DewV75u20LOTKM306GB4i4T6pxRfrGw6X65XkKZQEduhRUQiiNuk6ddHJeCjcyFADRlXMabmfHYK1wK/JxmEkdwcIEi5K123OJKkAa+8MC5fQqBqjClrFw66SVxXkADQwWAq8RXy3cHtbIUW/RM7PlglBhhBFChpEaxbRsflqpjvfP3drO+OEscEpIqk5MaTTqBnxMPDriWzVTRT0PAXNisZ+gE+n5awFkPHxOvZao8EX78VgpC1iAvQcsuvJKwBYsc9Xrx6PPFGwUJjziCuVZwLd0CWRjTwlfMQqy+brFD4H2FhRlbRbjCaCppfNonsOF7Mpdx4PjADCCixgU0rHbDG10ZxFGR3MP4UICqDn4gm/5h2PJt1zSgfFWDXzhH6rRHEfNmHh0FsBkja0/aBIFw3cmHqtrPIcflqBBkvdKmSqNOrgP4xAnOwiHa2Bzx3B6lg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199024)(82310400011)(1800799009)(186009)(46966006)(36840700001)(40470700004)(2906002)(40460700003)(83380400001)(1076003)(36756003)(86362001)(7696005)(6666004)(478600001)(2616005)(426003)(336012)(16526019)(26005)(40480700001)(8936002)(8676002)(4326008)(36860700001)(41300700001)(47076005)(5660300002)(316002)(356005)(81166007)(110136005)(70206006)(70586007)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 08:11:47.4832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee221716-0782-4b78-397f-08dbb8e811f7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4046 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add light chromaticity x and y for SFH1.1. Signed-off-by: Basavaraj Natikar Acked-by: Jiri Kosina --- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 5 ++++- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c index f100aaafa167..8a037de08e92 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c @@ -238,8 +238,11 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id, als_input.illuminance_value = float_to_int(als_data.lux); memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info)); - if (binfo.sbase.s_prop[ALS_IDX].sf.feat & 0x2) + if (binfo.sbase.s_prop[ALS_IDX].sf.feat & 0x2) { als_input.light_color_temp = als_data.light_color_temp; + als_input.chromaticity_x_value = float_to_int(als_data.chromaticity_x); + als_input.chromaticity_y_value = float_to_int(als_data.chromaticity_y); + } report_size = sizeof(als_input); memcpy(input_report, &als_input, sizeof(als_input)); diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h index 6f6f5db150c3..656c3e95ef8c 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h @@ -147,6 +147,8 @@ struct sfh_als_data { struct sfh_common_data commondata; u32 lux; u32 light_color_temp; + u32 chromaticity_x; + u32 chromaticity_y; }; struct hpd_status {