From patchwork Fri Sep 15 05:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386366 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 0730CEE3F01 for ; Fri, 15 Sep 2023 05:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbjIOFRl (ORCPT ); Fri, 15 Sep 2023 01:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbjIOFRk (ORCPT ); Fri, 15 Sep 2023 01:17:40 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2057.outbound.protection.outlook.com [40.107.92.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91770269D; Thu, 14 Sep 2023 22:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZsVtkuZjqiUtooRx7fT8fOanF8J/FQhPHD6YxjzIK2H1OFNc6DB84710pQ0v/gT/qaKC+tnk6Oe11a4DuHFEc/1YhU7NNjEvNZ3qPdUDFkrU8c/sKDaMopuDQMY5bZOYoLx81aZWH15KRzbOChJilYF9VuqGlLq2XIkVBFq2r0V63fBuWolfTQF+n9bTp8Ea8CJgwqcWhLCfTJSWTfl8pF3jZt/1l1Qi53UyeFb7bKI3VjkVxSA0lE7tayrpjpNodEn6KPCeSwZ+kW++n8m6xGNwycEGpNJpj4W5Vfuqe3N2Vby4RlZ+mdDwmlhDkoicDdLh6Xnl008IUzBZ22dCZw== 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=Oykly3kq3U5cbSPPswSH0C90KCIoiMGc9Un794pwubI=; b=ip4JEz0D1PLt4d+SV21Og5+CjcYZNRwUx5fOPQ4m9TA9j7xuXIu+R+nVpRdrOhvPRcooOGQe6J87lQxaNoSe1sk87qXDM3lBDypTqMfJoDF6CeN6GbbBeUEn8+jsZwi3s6pWdBMtaC7lPOm+o4e9JHd5fO8Hq7K1pV0RS0YYrxQMzSuqOWLC+ST2xxY9+S+1/W0Dgj1l3Cp7bzRny1CrbdY5E1b4lvd9PU0ngNw49sQKt1prHderwnYhU22c6QxdacQM83DAijpkVWfhJYt7HkaTKALRj0XKD0FmCE+hu92SwhqZ3voe/g1x7hXwwERhKoR9lJIc6MnfOgldeVOWeA== 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=Oykly3kq3U5cbSPPswSH0C90KCIoiMGc9Un794pwubI=; b=wCcaH43b/aPLKsRHY72NpvoJDtieaQWfagLWE4T21SOsKfoTA4qDlG0F8wX5MqrYlIXxhu2g7zsupU97wZTqEWn9vTPPYItHDNWmSWYh/ioYTSjzpTSuOC4n3AiW1MGRDvAgeNuQ5BcS7y4N113bsuzi+HDnY+FsK6oTlPbpmEE= Received: from SA9PR10CA0026.namprd10.prod.outlook.com (2603:10b6:806:a7::31) by CY5PR12MB6429.namprd12.prod.outlook.com (2603:10b6:930:3b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 05:17:32 +0000 Received: from SN1PEPF00026368.namprd02.prod.outlook.com (2603:10b6:806:a7:cafe::90) by SA9PR10CA0026.outlook.office365.com (2603:10b6:806:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 05:17: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 SN1PEPF00026368.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.20 via Frontend Transport; Fri, 15 Sep 2023 05:17: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; Fri, 15 Sep 2023 00:17:29 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 1/8] iio: hid-sensor-als: Use channel index to support more hub attributes Date: Fri, 15 Sep 2023 10:46:56 +0530 Message-ID: <20230915051703.1689578-2-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF00026368:EE_|CY5PR12MB6429:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f63468e-7d02-4548-9677-08dbb5ab1057 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FYS6GVco9SBvOrB01FJ9z8lFEcMGj2ljKXoMmHR3pUYPfyg7yP0GXLrLoEdYkaEht0s3Gzxh9hK2HXRAo/JVYGAOPNWERnB3bNURwB8pVwu8oNoZOwtgR+iivYybxgVYFZT8Q13SiLnIQnhC1dE+UbobQfsmmdkyA7HzFPK1j/QRuH13Sjwl1/KVns8FYazcoCU6mTfcal3WJFP/U+N573AAJdf3yw2hZXntJmguuXaO/JKlCXrjeyiier3PxOKK5PLkmO13HRHK5pu1trFAwNyFVKmDmLDJgs8s2vlfbmc2IuyYWc44Am33DTnQk/KZy0wrkAWk6jXzoUEaexO9fKWaGGOGdNs+C7hSdvURKKkggwmWgCdeBbY0VmpBzAb5gZQU6DgvdSVCAgg7JKFcDxEWFkXS7lhYSGFMLORP+xjRFnC1E5VdsH7WSxo031/t2wsy3KfHtrK9ljIrkYIaRpcHpabLUSlvFkbcAKFpJaFsiVfQGi2bkyajNSzc9Zy3OUGkBnBXSLzOEpin0cact5C7wn9xEAVXS3zUZhD6CaNu8ORaesH8o9PewJmS6Nyj6gQMfXwI7KGP4zjkUiNXlIzAO786faxrQ5iIsHpnzMqzg1YtpMfMmMABFhr03iAdUO0UPYF5b+WKomDD/wl0ZpKiZZTrlJJsIMl96Z4QbiIf0H5g00xD59B+zFGj8QOXUyO8+q3L5lPswnFh9ifxFpVFXCA84aKk7tq0n4jtCl0GZb7K1biWR7ZLpQe6FFloT8cvxDSKWO4YAjrAM2NT0A== 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)(186009)(451199024)(82310400011)(1800799009)(36840700001)(46966006)(40470700004)(36756003)(86362001)(40460700003)(40480700001)(8936002)(478600001)(6666004)(1076003)(426003)(336012)(26005)(5660300002)(16526019)(70206006)(70586007)(7696005)(316002)(110136005)(41300700001)(2616005)(4326008)(8676002)(2906002)(36860700001)(47076005)(356005)(81166007)(82740400003)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:32.0642 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f63468e-7d02-4548-9677-08dbb5ab1057 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: SN1PEPF00026368.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6429 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Sensor hub attributes can be extended to support more channels. 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 --- drivers/iio/light/hid-sensor-als.c | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index eb1aedad7edc..48879e233aec 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_illum[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_illum[chan->scan_index].report_id; + min = als_state->als_illum[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_ILLUM; break; default: @@ -242,23 +242,23 @@ 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_illum[i]); + if (ret < 0) + return ret; + als_adjust_channel_bit_mask(channels, i, st->als_illum[i].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum[i].index, + st->als_illum[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_pre_decml, &st->scale_post_decml); + st->scale_precision = hid_sensor_format_scale(usage_id, + &st->als_illum[CHANNEL_SCAN_INDEX_INTENSITY], + &st->scale_pre_decml, &st->scale_post_decml); return ret; } From patchwork Fri Sep 15 05:16:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386367 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 402EEEE3F2F for ; Fri, 15 Sep 2023 05:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbjIOFRo (ORCPT ); Fri, 15 Sep 2023 01:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbjIOFRn (ORCPT ); Fri, 15 Sep 2023 01:17:43 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BC172710; Thu, 14 Sep 2023 22:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q8fkpGmR5YPjlCBdDAH7o0vKYpMWjPIqBSKTxbKQi/rGW2D0d2QmT2ESCvOv0q4OB9gMqMNzN93yr9RM/Es7eBmICa2WpdNUCYpJshsXPxGpWTg2UHDGwypDGbA38WtEQ68O4tElaM0hwRgkQixvo4ixSeu5ieFimQEqLJnt4daQ+7Ysrg4Xm11aqb69Nb62Pw6fJAwax7dGqTodKBIMADOolVwHduwSeMDhaY4brfZ3V0bzmX0prcDpx/DNF8FyWd/O+CFj97AbDBZF+eovj5Xv6ZLVzXM1S8JPJuSe/nWrohH88sI1nk1/skZWRmSJHpxRKacaDyoj+F4m7N6Sbw== 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=szscW+H/lvO7RzJiks8ZmmTn3miMxUiMGEQWZI07Tz0=; b=fpnPr9HhJAwY98Kd4C8tN1TTXvL9UdKxR78xigWy5NUFfH1xlIBJi7lUv8G1Gwnw0NJwv4S0gnkaoI6KbsKSbs40AzhzbSxu7sbuAVrsqS2uj123yUbn5sI7F4C+oNI1uPhKX9enAlA8atDjqdQ9+GulXHOXlqflHhPy3HKoKaCMRK96kSOhLSYrc5cmCn85KvxLIIeyDTQ0c+vSyZPj6wZWtP+0oRX+igCDgE8gR+G6gFfcsEPMRUC5NI54as59yYVPKmW+7PjgAoBdaY2C40Hc9O6OQYr7FN4Q8Ws41F5LBPSjGmFE69BgdUBJI4mTfsXYBmBrr0xRE+5qWbSoLg== 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=szscW+H/lvO7RzJiks8ZmmTn3miMxUiMGEQWZI07Tz0=; b=WWFp60x1prxKCEKQ/qCc9aFGCY+8lTKK3dA/YaMZW7sZT2IM9LZRdEjaBYuHWUK9N7gJOH3NjAwFlw7yjl6hVlWiMiwVdnPjC5Orc74VZoHWpBBFIr4qUpJdajsHn5bhIYafNNBTcWEEXGyLEZtTVZqJGW17Z0mZPPlFH/xYmhg= Received: from SN6PR2101CA0001.namprd21.prod.outlook.com (2603:10b6:805:106::11) by PH0PR12MB5434.namprd12.prod.outlook.com (2603:10b6:510:d5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.19; Fri, 15 Sep 2023 05:17:35 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:805:106:cafe::cd) by SN6PR2101CA0001.outlook.office365.com (2603:10b6:805:106::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.8 via Frontend Transport; Fri, 15 Sep 2023 05:17: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 SN1PEPF0002636C.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; Fri, 15 Sep 2023 05:17: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; Fri, 15 Sep 2023 00:17:31 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 2/8] iio: hid-sensor-als: Add light color temperature support Date: Fri, 15 Sep 2023 10:46:57 +0530 Message-ID: <20230915051703.1689578-3-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636C:EE_|PH0PR12MB5434:EE_ X-MS-Office365-Filtering-Correlation-Id: 7bbd68b1-b6d0-4cbc-3224-08dbb5ab11fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: foK2+KH4Dbm9dZoLt3cBzlq1IhnDnqUWb64kWtC5K20DVmLyrg5E4MVhl793Vk1xqvUCVi1i6NtRNIET7EeAjltHxY9Tripg2/NAGUdHzGzQvPAQYRYlipQ7nDsnKJsZ6aZmmlZIKYMCvcPqM8If6I1wquF750h5XIMO+rjYw51904IMmO1HG07Nlvoo7+dmWKiRnalcT3dbLF0viN9onWecVXSV/Bth8inj1BAkG0v6/vbXIjjC5blbO88yRolH83LsI3WSmFAHZHCbnF2ys4GW2IJVIcBKEwiSYjP4RAXGpEAY5oFb+le+AfKVG42m1RJzUwBYYd0NPIrMircfaNDJEVMo4EJyYkucFIXAZR8aFC8CIthoQkm9ttNtg4QmV+SCl2IINPpuJaUOzf0d31NttH3f69Qe5P+ZTrPK8T23h4AKL6GhUt65VBmVIw24qfLtQ5gjZKQrvNshxZaQTSvwmkT7XBm6rHshCikjmHE4CWM8jn67eigAMuQIPeoXurMMO9CxFkVPnUEaw+6GASXDt9fdUI8IWGc2jW3SqL3Dca8yyaUOa/6AjIo1MjbvmJHL1iZrGDLeTSWK57nVPaBtceVFBi/h3yTT7bT0CA9oib0DS2ftafDbe0BbuqSVQAocvA/6sd3+iFj6a3q3fD2UNaOOnD2zltHUEjq/oHf82Yjw1AS4k/c1nnOERJtpOs5Hn0tfy12CIe6CXK5AZFPGG/5UrXKuyr1YDxvyhzYe/NXejxmHzdqE+YDaYJmYGr8MWGj0+zS1cCeSVlKzLg== 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)(136003)(376002)(396003)(346002)(82310400011)(1800799009)(186009)(451199024)(46966006)(36840700001)(40470700004)(41300700001)(47076005)(8936002)(40480700001)(478600001)(36860700001)(8676002)(4326008)(70206006)(110136005)(1076003)(70586007)(16526019)(6666004)(2616005)(7696005)(336012)(426003)(26005)(316002)(40460700003)(2906002)(5660300002)(81166007)(86362001)(356005)(82740400003)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:34.8142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bbd68b1-b6d0-4cbc-3224-08dbb5ab11fb 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: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5434 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 --- drivers/iio/light/hid-sensor-als.c | 33 ++++++++++++++++++++++++++++++ include/linux/hid-sensor-ids.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 48879e233aec..220fb93fea6d 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -16,6 +16,7 @@ enum { CHANNEL_SCAN_INDEX_INTENSITY = 0, CHANNEL_SCAN_INDEX_ILLUM = 1, + CHANNEL_SCAN_INDEX_COLOR_TEMP, CHANNEL_SCAN_INDEX_MAX }; @@ -65,6 +66,18 @@ static const struct iio_chan_spec als_channels[] = { BIT(IIO_CHAN_INFO_HYSTERESIS_RELATIVE), .scan_index = CHANNEL_SCAN_INDEX_ILLUM, }, + { + .type = IIO_TEMP, + .modified = 1, + .channel2 = IIO_MOD_TEMP_AMBIENT, + .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 +116,11 @@ static int als_read_raw(struct iio_dev *indio_dev, min = als_state->als_illum[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_ILLUM; break; + case CHANNEL_SCAN_INDEX_COLOR_TEMP: + report_id = als_state->als_illum[chan->scan_index].report_id; + min = als_state->als_illum[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE; + break; default: report_id = -1; break; @@ -223,6 +241,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); @@ -256,6 +278,17 @@ static int als_parse_report(struct platform_device *pdev, st->als_illum[i].report_id); } + ret = sensor_hub_input_get_attribute_info(hsdev, HID_INPUT_REPORT, usage_id, + HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE, + &st->als_illum[CHANNEL_SCAN_INDEX_COLOR_TEMP]); + if (ret < 0) + return ret; + als_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_COLOR_TEMP, + st->als_illum[CHANNEL_SCAN_INDEX_COLOR_TEMP].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum[CHANNEL_SCAN_INDEX_COLOR_TEMP].index, + st->als_illum[CHANNEL_SCAN_INDEX_COLOR_TEMP].report_id); + st->scale_precision = hid_sensor_format_scale(usage_id, &st->als_illum[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 Fri Sep 15 05:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386368 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 75174EE3F01 for ; Fri, 15 Sep 2023 05:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231840AbjIOFRy (ORCPT ); Fri, 15 Sep 2023 01:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbjIOFRx (ORCPT ); Fri, 15 Sep 2023 01:17:53 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16CB4271E; Thu, 14 Sep 2023 22:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AjNlOf8DZqJ3Y10mIIF4UPCi+IGYe3k5w9mf1PKNCWrMn28+ODZ5+OZSB0uCDWjBya4nkqupQdBvI2Ulrh/OJNDyWxRVU36lnNyjp1TEK+gAUprJW1fISHuIQwlJo68ryBBjnw3OBQPzWh5YWDFTKqoxswXd/rXQP5atH3RQkl2l6kg9SFBSCeg41xix6Wyiazsg+RonKsnLUuM8SRjIDHaYL0xNQvYKm3fFDdbWlRLij56SbLxso3qsxxqhl80vT8vf7T78O1tWvm5/hdt4B5MeITk6Fmn6kn+JxDzheyP+n9+2ARB8H0IuEHw5mrc5zT8NyALratyrQ2fPpBpnIQ== 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=lUAkDwxm7m0W0CqTR6yx7Fv9jxNJobvrqZisc8SXfsiR2DsdLfqaTtDb2FfPbtYG6WAqUZfQhflAba0eIW4r6GRJExkiLfuWOykHYNbs2Ugj8FBi1ejAITduLXL/98N7O4J1ULqCSs1JJ2x7hzAaJ96idpB9nOdVn3XtUpWHaFy6AIM8sfcQSokW2QY4Di6ctcpw4Af3CYCGYobYYsYk7qQj9udga5Zaoj4TXKi9Dxe9RnYqh/ig8/XjXTs5Et62nmWzoP7f3rWPqhgejbuMOM6pObmQ1/DavWmGsK+JDiHAtlQQBxZXdWzwzlmTWPGLc0LGAiWmomr2wpVoYakkZQ== 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=q0Qc/v5tk/dQeB8Z3a9Dc0TRbdIxDPrKq3/vu4VUz2JxAGn68t1jHQYezhEQnY4r+sx1fe0gPKBuR5XbPZbdfxhg50vsK6uekP+ZRxF6yH5vNpiK4goEQjNrf28R/dlau/YFqBQ1FOrdQBpjdrbi1T5wbc9IqMfKvyY3AWiN/CU= Received: from SA9PR13CA0098.namprd13.prod.outlook.com (2603:10b6:806:24::13) by SJ0PR12MB6880.namprd12.prod.outlook.com (2603:10b6:a03:485::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.33; Fri, 15 Sep 2023 05:17:40 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:24:cafe::91) by SA9PR13CA0098.outlook.office365.com (2603:10b6:806:24::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 05:17:40 +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 SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17: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; Fri, 15 Sep 2023 00:17:34 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 3/8] HID: amd_sfh: Add support for light color temperature Date: Fri, 15 Sep 2023 10:46:58 +0530 Message-ID: <20230915051703.1689578-4-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636A:EE_|SJ0PR12MB6880:EE_ X-MS-Office365-Filtering-Correlation-Id: b28e7e7a-af81-48dd-f10d-08dbb5ab1543 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7m86hZaxu3E6aGRk66GSCBSCLpfEkkxfNsH44JQaT7sVIEV0Q6QDf5PrdHdmahInzU0sq69gRISJzqz30xucXvK7UPmcWxkgcYTYwtQsqepRosdFq6icLqKtf73KXewSg0mqTrJRVDwYDkyLIAFm3v0K3qoBOovo3I9sXXEjtHMOo0JOrmlkV+U8obQlTdVdBldDBwGRpiN88NmHanfcvrHfCh41eUTznn/YP3q/Xi8qqIInumwSsaqFqMMNnwqLcuhv/8y4eHe7uHZq+MA9X5UwcFo9USLavvg2Fy2309WHGlGWlbK5a+RXKIOqBql9YC69r9mk1wc/A03rSH4D21jJW++yeJq1FsiRa7YX2HjpnPWVq2b8kiX8HyaDcZnzN0czsFRAm5UUh6hCfUoN8KZdK+gurUMhJY2QSfvbZXruGL8gDtwSyNiZgr01mSh4h3+2SXgjmDNod6iCMNTy3w6Qt4o7Be1E1lOcmPYDvTnciL4DrPpK48AbA/4CU5B1ttTJjmeLCpJnQUR8VegVparG//MFcvacIkoWfqZ0G1lvo+oFrTa9AK0vCw09yIgRzFNw78N56xv0vyyyB/u9Yv8mtlKe9NVT/DO63gyeliL550jL7jTwB/5i3B8k96CROXyrwPYDxpvQMoaEaQen85WZ28aBQ9w86kt05y5NEOkec7xWyeS/viCoup2Mnahh125Qy65ovhnu7VeABSjHkRu33MAABGZ6edxfuB8K7hLiBwfA79df+O8clak1A7DwYYaihaULmHXmU1kJhGojmg== 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)(396003)(376002)(136003)(39860400002)(1800799009)(451199024)(186009)(82310400011)(46966006)(36840700001)(40470700004)(41300700001)(81166007)(6666004)(7696005)(47076005)(36756003)(86362001)(356005)(40480700001)(316002)(36860700001)(26005)(82740400003)(2616005)(336012)(16526019)(2906002)(40460700003)(8936002)(5660300002)(110136005)(426003)(70586007)(4326008)(478600001)(70206006)(1076003)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:40.3241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b28e7e7a-af81-48dd-f10d-08dbb5ab1543 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: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6880 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 --- 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 Fri Sep 15 05:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386369 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 CB7A3EE3F2F for ; Fri, 15 Sep 2023 05:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232066AbjIOFRz (ORCPT ); Fri, 15 Sep 2023 01:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjIOFRy (ORCPT ); Fri, 15 Sep 2023 01:17:54 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2084.outbound.protection.outlook.com [40.107.95.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B3392722; Thu, 14 Sep 2023 22:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTXokV8HZ/rD092YGH6P2zNWgYPOjs+Ri8RfHgPA0CJOv98m7NOR/Gukl/UEpqvpwcU9BBN07dWxnizDxaEMszZKKb9J+0oRazXV71kjNf8MIz2YF9UqvIAFoDiSbBhhto0qEBD22ptPqQPWaron85eeJuL94bd/BsJD2R/5cPwHPW4EW2ZMh/OJj+pvjtD20HsAc6a7zlgPi/HQ8bPZdEyKwEma88bUupK9eQMMLBoZwhb4h82E7pA6FzBl/qFzXZvh7djY1ZrxKkANr6EdKh0lvGGMo/e/GpE0539icPe1GCYfRwT5xp++bpX92P634gbiOXORMMxpCBJaAmqTXQ== 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=EYhURd78wvYcUvyWJY1Fngnf8DB8NZj+LHFAuC0/0jCApG4v9EoEimwOzAPu5e2lgY4+zj+N3FYXwl8Ls0aj2Qv3O3BL996myvtaek5OZngi/GbfFTSzfEuKRS6mOM0kV7ajGqAo43ZPtuygTlOmsJq20vPax6zWVHlEcmqMqJ/fJlGhVq0363XBgvMRCfBPeSmrJjmoISl7YEk/yKx3yL3IpXNMRsmNlhANPHissv+Fi/2Xh793ldQ2H10bhrNWwxD6Qo3o1r5WGKuOiiKVtVQNlzlYPaFB9+LL/plxsT2cd9Td3zi3hTd6ck3hBxxYcQfT2vM5zHAjy0gBLFyPSw== 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=sGhQlg49KlPArnypQvyBjhrEaq/ViZIdgnIGsXItr0X92ZeQAXIvLK89ZYTXtSR/aXZZjYjWWN8y+0P/bzw4I9piD5DOstqcCS7POCMa2zV8o3H0eClITNe3EKgizDoggQVpyRWy+uHArrMXDcO/8I5NtjG0OwCwhjofEl2HoPs= Received: from SA9PR13CA0106.namprd13.prod.outlook.com (2603:10b6:806:24::21) by SJ2PR12MB8953.namprd12.prod.outlook.com (2603:10b6:a03:544::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.34; Fri, 15 Sep 2023 05:17:43 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:24:cafe::6) by SA9PR13CA0106.outlook.office365.com (2603:10b6:806:24::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17:42 +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 SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17:42 +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; Fri, 15 Sep 2023 00:17:38 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 4/8] HID: amd_sfh: Add support for SFH1.1 light color temperature Date: Fri, 15 Sep 2023 10:46:59 +0530 Message-ID: <20230915051703.1689578-5-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636A:EE_|SJ2PR12MB8953:EE_ X-MS-Office365-Filtering-Correlation-Id: 32b50f8a-85ed-4ace-6a53-08dbb5ab16c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9R7oj/SGb+s2ZSqqKJ3r0TPFx5c5POHQ+ZkqOD4zg8i51gXNzZIE9GT9Z4LHfFyYNRxf9EX+yKhquldma69YMFZ4OaIWi9sxBqzl3zI3yMg/K+yuLa++YnjIFQGtDMH0WOe4/3wr2NxqJY8wNyXjEw6SjbjMaHlmHh6fbkYT34dz/DobjsmlfLkAgDDJMYL7Vzb5vqrDvP3ZpmLAGlzmWT1+hw6wu8G1hJmzrToDeylJutSl+6613hnwwQXHr/F005xCUY3UtPFEvvbfyW2abNSeHme9kHZUyKQz6GIGhy2hx8tku1aMJ41JSYDGgFCfWi61G6XHizmc5SNURvWKxa+SHuIWgoRMfAj5oqSrLvLc2VW8XxTRtbHeHs8FZejxEK+luYfWPukk6nNcXYknEV3t72d4aN1fmvH2lfSrP2/GmdwdRF/1+2z+wxckDYww5mxY0LkBH1ei0vXGQ79FU8mMzkXcNnLKGqZYSnAxTRND/Rb0YJiOLrPD2NtSVntmt6wRHi3ndtOTBYr9Civ9DHUj1CE9JekDJFabd5jDAgDEdjq9GyoBet/L8xDzVOJJeUr1xf2Rtsq3xIhK7m0h7zN1jdkBNweo3rIo5T0jRhunFiWOv2T9HrAlBkosnV/ypSOnC9wUIQ2sIDBwYu5oaauuxAxMohZvOvT4CFeiqPBOIxSQ93++q9/hWIey3hioUoa398hVxnGIIv07O9NmB5GYj7obAPF9d7HjTJvYXXj5WMdgIV44dSGhe+7E2hdSQnapnSQXwvZzPeRLV4p+Lw== 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)(136003)(376002)(346002)(451199024)(1800799009)(186009)(82310400011)(40470700004)(46966006)(36840700001)(8936002)(316002)(41300700001)(26005)(16526019)(40480700001)(336012)(1076003)(70586007)(110136005)(426003)(70206006)(8676002)(2906002)(478600001)(4326008)(5660300002)(6666004)(40460700003)(7696005)(36756003)(2616005)(36860700001)(47076005)(86362001)(82740400003)(81166007)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:42.8241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32b50f8a-85ed-4ace-6a53-08dbb5ab16c1 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: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8953 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 --- 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 Fri Sep 15 05:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386370 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 C6DE8EE021D for ; Fri, 15 Sep 2023 05:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbjIOFSB (ORCPT ); Fri, 15 Sep 2023 01:18:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjIOFSA (ORCPT ); Fri, 15 Sep 2023 01:18:00 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2061.outbound.protection.outlook.com [40.107.92.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F202737; Thu, 14 Sep 2023 22:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KGKVudfhd7vX93BI8PNO78eNEZm1PmA4OJ+r2g9omQ7r7R90OCYNKkf3mtcSXVQbLuH12f5/HrPlfQj+Bs0/y9RR6PDZ3ckj9bHeWrLLrMZiLdcpFBDEh1pORSORTJ1Ov1iW+NBEoAC+MokD3E8i25HTbw0xFfS3rAwzbwjPIyyWapmCI2KwkwZAEebE4Tl2BuBmNBhp6O5mGAf+ouUrehHEbvl9URyjvS8m82DXa4/ien1AU4Yu6MUf2KhgxP8zOQ3v5rQqlZsv8bzhq+qyQA0VGhrjB6QsAyrlqVYe1f/qwM4kKm6prgcR+WGDneBpW4ySOwLOsJFqFkBxx1przg== 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=nXhPlcnMX5GWYU3NNqKS2RRG50qP19klF6F04ecWysU=; b=IAk/IjsfnCwBI3e0g/QtYHa8jEBoWTf8wEDiucjtNc1vPmctB19tWiRY+iJbwX0K4qYFbYWtxl1VCd1rHZMIgWUaEeJdvBqTGJ9FgKFhgwlkrY2MzguAkRCq3Ijg3v/9TINFsyJTsn7GnMldmdbuNK3S/zhFRvJ6pDoDtMjTe86ZGOC7Wg0Zq6PuofwZEi+Evk+H7OiKdcnaAeAi1D0q8KhwVRF0MfE85GGb/Mfb13nQGd3ZUxdGYJBkZXCJCRuqg5/1qaSMjJ2M07V0ieNAbLTPDcrJUk/wpgurYYUlXoAxGmi79etNfO0Vx2Y6a6aF4brmJbsqT1R4iFS+Vg9dkg== 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=nXhPlcnMX5GWYU3NNqKS2RRG50qP19klF6F04ecWysU=; b=BOYU1wHtt0hqjtoV8WklCyGMaRH/Nsd9oLZpfhIcpZE+baqMuLLq5nsFPdALGYKXHMKRPSc/09D89bUnAu1oeidzjcwPt0tNsSFd3LKShDpyqJ2hwi4BFhn6sHNsbWEuLr69Qw9LB+n0D8rWLll4YPWMb8wlWCQtLYDqd+2Hkko= Received: from SA9PR13CA0120.namprd13.prod.outlook.com (2603:10b6:806:24::35) by SA1PR12MB6703.namprd12.prod.outlook.com (2603:10b6:806:253::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Fri, 15 Sep 2023 05:17:44 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:24:cafe::ba) by SA9PR13CA0120.outlook.office365.com (2603:10b6:806:24::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 05:17: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 SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17: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; Fri, 15 Sep 2023 00:17:41 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 5/8] iio: Add channel for chromaticity Date: Fri, 15 Sep 2023 10:47:00 +0530 Message-ID: <20230915051703.1689578-6-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636A:EE_|SA1PR12MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 3987c0a3-b6a0-4062-d5fa-08dbb5ab17af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oouxGMILpwTkEEEyk2higrrAQYw3SGj6IlDSRV5YZR+VLzncw4W2i6jEw+K7AF1HzPZ5LywdJZnPPytq0yZckUrREo95iCvBma8/nbJJeZwWE2o4CrKmWKFMehXRHBxQkIfY2H4cnahSOtVDhexEPd2fdYge3qnQhwMvxcoryTkJRWDOEiBCcxl7vpYnCoEnRQ1kEpCBpyEe6dk1MVOaGSdIqRCsbupRmG+287WKTvzGzNVnhq4N8QA+SX08jm3BaglEvkO0FhzPhlRWf3nYeluQs5Bo2dBTu1NY5TX+OgZNdtWIO2wV1qZLgLg/HLPq8v6NGe2Xg0k11KGeEqCi9N4DguogULqIIGqRi8YVNZwFoXAu8BY5e0IP4rUShfXHBSLX1ioy5PAa6IorM4Cd4wygXBg/hXyVpf2z4zNHgPZjGx5g7wtTeGcssoXO6vPOE8s4ua8wV+7nvD9gasO6Hoar+JII3tuBhFBYDe5o227TC4tDSmmCnYUAJ+5G2Bh1hcMhT5nJCOTea6JE6jBHoeQHLgiz3WkxVjPTVGp4hQ6z14Eu1yNJRYjskQB/gpty422f5D8i5ALb/DweIRZCsyTPSjaxG4lhCyPZfMG/51Vpmr+/syOz6Tkm3BdnI37MQtl+oq6ZlX3MurYndsIaev2ISr/JNtEvQNzMOFEK6IZ3iIgXuoHKe4F1Jyf5/9bqgrto+nqXLUa3vFy2ANgHbm6L/WbCLbi7IpIv/+XNFBmkAv4JhTzftn+ndrbJ3dvB9jF/P5Y21gemlRL8bqUweg== 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)(376002)(346002)(39860400002)(396003)(451199024)(1800799009)(82310400011)(186009)(36840700001)(40470700004)(46966006)(40480700001)(8936002)(41300700001)(36860700001)(81166007)(316002)(70206006)(2906002)(110136005)(70586007)(478600001)(6666004)(86362001)(8676002)(5660300002)(7696005)(2616005)(426003)(47076005)(356005)(82740400003)(1076003)(336012)(40460700003)(4326008)(16526019)(36756003)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:44.4023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3987c0a3-b6a0-4062-d5fa-08dbb5ab17af 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: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6703 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 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 | 2 ++ 4 files changed, 12 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index a2854dc9a839..6a810771f5e4 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2179,3 +2179,11 @@ 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_chromaticity_x_raw +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_y_raw +KernelVersion: 6.6 +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 d752e9c0499b..c1df66cdfdf6 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_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 c79f2f046a0b..8952d48cfc64 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_CHROMATICITY, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 0a5c2bb60030..115ba1fbf3ac 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_CHROMATICITY] = "chromaticity", }; 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_CHROMATICITY: break; default: return false; From patchwork Fri Sep 15 05:17:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386371 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 EAE65EE021D for ; Fri, 15 Sep 2023 05:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbjIOFSD (ORCPT ); Fri, 15 Sep 2023 01:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232069AbjIOFSD (ORCPT ); Fri, 15 Sep 2023 01:18:03 -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 DE659273D; Thu, 14 Sep 2023 22:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gqinrb9mGJxtsqh8zCFtCOu4qFfNSIGOk4KlTVIJUoediLDXH9QFe6RhE1xq37zmC3i4NWwhUcC94i19FC7Xin2h+VYKWVuBPfxjxaPR6SoSRu76hYRZylt2Il32Lqza1d8PQ90CFxmBduSbw8+G8GYCnYgwfim0Yt3FjD3s+vZ8uI6CLek1HB+rMtq8G0xXFul1gFdPnrXZqpiklbV1TlbWPFJVJ6esh5Q9bpg7rH7nsAjnuAT3rpyCreJUzOVfg1y3ALbVdInkuODDDAIv3Gzk4zz2YFTpIcNPszdTKhTi5tLqvmVN0MVtlSHm1WAi0I27x7b5zFuJOO38EM+PwQ== 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=6SYNI5KhPfkUW0S1N8Zeq2VkK4MmJnF7ioBLAkD8gCs=; b=lORQWz+S9pmkJoD1UZPzHgtLaNeRSjKIzk8/98ilhsZ7VhJJHz/EPnZGY9xZF052oJRdpLM5pSRls04FPWVeDe2f2Up0HdQVbiQtXbUQ1VPwyL+fSObbLKtziMZEYn/4fd5QKiIfZU8xLXHd5I3G9vbd9P++qNGkxv2TDMU6qv/C3yw5tfrrF3V3EaPEvdr4Zrn7M30tGXhTbZxU+ztT+h841XdfBKXKIfiAqp4THozStMIuD3QqT5ngxHiaO7aq5PpoZ+pXF14OC7xqidEIfKfFoWabnVACuTWDvfFSgGbRuwl5RmhAk+GtPh0uNCLA10ejtwudWlWw6pdpBtPzBA== 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=6SYNI5KhPfkUW0S1N8Zeq2VkK4MmJnF7ioBLAkD8gCs=; b=ZILOg6KAWS7gJozkqH85f9UcexBwms1QYkUziSNOw5E7QK8Ol12BsRR/Q+vWjxAgQZI3MRVsrFOdE9VcL6SkpAPffan8buLiew57rRITg4NmkemNNGUKJtMNfJZvMYZlxbfOHRSbYV/KBffa0LcgenK6JK4Z2YOfbbLCk5cLIVY= Received: from SA9PR13CA0106.namprd13.prod.outlook.com (2603:10b6:806:24::21) by MW6PR12MB9000.namprd12.prod.outlook.com (2603:10b6:303:24b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 05:17:47 +0000 Received: from SN1PEPF0002636A.namprd02.prod.outlook.com (2603:10b6:806:24:cafe::6) by SA9PR13CA0106.outlook.office365.com (2603:10b6:806:24::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17: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 SN1PEPF0002636A.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17:46 +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; Fri, 15 Sep 2023 00:17:44 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 6/8] iio: hid-sensor-als: Add light chromaticity support Date: Fri, 15 Sep 2023 10:47:01 +0530 Message-ID: <20230915051703.1689578-7-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636A:EE_|MW6PR12MB9000:EE_ X-MS-Office365-Filtering-Correlation-Id: 97af09c7-2697-469c-3add-08dbb5ab1939 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iWQEppS7HxtWuEnB5kRNNU8i5UyRyjmObu6fcuZ4HD9JHJdLauLINZVElTE/KKLXCtyp2tJNOoQBe6bzfm/fSSpO+UIQmoKrvEK/sJN1Xfz3dc9VjvSIHafsCxzHsHN4LaPOm0v+kX5veyGw4tyr1Xadq9BnEqbHnKc7kiUB8JKLQqMs6okW6NFPpQu/VFdVaFWlRpo+Sll2yDwZ4ZJwRJZAs+Dm8eE2A78i2KnlBlGA27CbtkMlQ9XDv4/I/aJ29Vwh+rOvPZpd3gcuAGHpoh7gQzUv85sPPcrVg4fBMZsRoNSZM58bBvQ1nJ/zTG2jeOPbNpAyRRGrREWwK+EQrEvw8ady52jq/sw/IiPJCvoappTyDw/g2oQwD0/nL17ip5iwuYbaQyMlM98lRzM2Me+kwvTdgxHvdCpLd4ep/uXWtirS2E4w+3/QeBI4sH+n9r3b8npU3jk/FrTAqw5EzV1YT9xELELhVaKHzL129m8lvuGIVHj667Nc8INSKtwXUWMyidtHFqv4QOHCZIIIWdyXXVcgMNxlu8dwNTNKSSFwu8G1g9S5rEU+PK0hhYZT17d9xEXyNCVm7aKAZs/cTv1qS2cVAbajkmn4+0nLfsRpTwi4eUa8+egnRK0m39EXDr3MXHdRbVe5ZdB4DYWi6I8UNZyMKc3EaQ3CirzhCYN/UIAmB42OkRxj9lNcbWiNKfVJrVPSCi68xsTTSlBPSSeOhY91MTaCZMGXKwzm/rZQcFscGjeNYocZvB/+MBADdKwzNvuDtfwDabVOnM+k9A== 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)(376002)(396003)(39860400002)(346002)(82310400011)(451199024)(1800799009)(186009)(40470700004)(46966006)(36840700001)(8936002)(8676002)(4326008)(7696005)(6666004)(41300700001)(5660300002)(478600001)(316002)(70586007)(70206006)(2906002)(110136005)(26005)(16526019)(1076003)(2616005)(336012)(426003)(47076005)(36860700001)(36756003)(40480700001)(356005)(40460700003)(82740400003)(81166007)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:46.9804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97af09c7-2697-469c-3add-08dbb5ab1939 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: SN1PEPF0002636A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB9000 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 --- drivers/iio/light/hid-sensor-als.c | 61 ++++++++++++++++++++++++++++++ include/linux/hid-sensor-ids.h | 3 ++ 2 files changed, 64 insertions(+) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index 220fb93fea6d..e1a2cc83b892 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 = 0, CHANNEL_SCAN_INDEX_ILLUM = 1, CHANNEL_SCAN_INDEX_COLOR_TEMP, + CHANNEL_SCAN_INDEX_CHROMATICITY_X, + CHANNEL_SCAN_INDEX_CHROMATICITY_Y, CHANNEL_SCAN_INDEX_MAX }; @@ -78,6 +80,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) }; @@ -121,6 +147,16 @@ static int als_read_raw(struct iio_dev *indio_dev, min = als_state->als_illum[chan->scan_index].logical_minimum; address = HID_USAGE_SENSOR_LIGHT_COLOR_TEMPERATURE; break; + case CHANNEL_SCAN_INDEX_CHROMATICITY_X: + report_id = als_state->als_illum[chan->scan_index].report_id; + min = als_state->als_illum[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_CHROMATICITY_X; + break; + case CHANNEL_SCAN_INDEX_CHROMATICITY_Y: + report_id = als_state->als_illum[chan->scan_index].report_id; + min = als_state->als_illum[chan->scan_index].logical_minimum; + address = HID_USAGE_SENSOR_LIGHT_CHROMATICITY_Y; + break; default: report_id = -1; break; @@ -245,6 +281,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); @@ -289,6 +333,23 @@ static int als_parse_report(struct platform_device *pdev, dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum[CHANNEL_SCAN_INDEX_COLOR_TEMP].index, st->als_illum[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_illum[next_scan_index]); + if (ret < 0) + return ret; + + als_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_CHROMATICITY_X + i, + st->als_illum[next_scan_index].size); + + dev_dbg(&pdev->dev, "als %x:%x\n", + st->als_illum[next_scan_index].index, + st->als_illum[next_scan_index].report_id); + } + st->scale_precision = hid_sensor_format_scale(usage_id, &st->als_illum[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 Fri Sep 15 05:17:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386372 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 63A45EE3F2E for ; Fri, 15 Sep 2023 05:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbjIOFSG (ORCPT ); Fri, 15 Sep 2023 01:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbjIOFSE (ORCPT ); Fri, 15 Sep 2023 01:18:04 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFECE2715; Thu, 14 Sep 2023 22:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U8NVh1ESSg6okQna9JDlEkReg81nXI7KmIIVBM4K23YBgWsVADSU54Ls/ZZYivJS1xXbva6hwPlaWZyMAmVBiBZdjoY80zYoRLUj4hNEAbbc3q/9g4Kyj2lSdI94mw0v+t2WF5S1OEEKgxWkvFOKI67e9aebEhRIQp+yQpbNiJvn1L5EPUW3JGl7wBt0cuzvMakiraarqkP0IyFDepR+mQp28OpTvTHCmRa9gq0oqi3CY/6jIw9GLXN15PGk/fLaA2c4URM888NwfIL16tB5UDtCi1uCNLYLzAZ1i3E6//hdQ4GVRiXX11z2hGoSwQniGvWZveDPgCqod9aIlhgxRg== 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=mu87kFxElD0SL6Yl6gKFQzUZDAc04SJOvM2fWUrWRKiVxA9xteNHfRIQRsxcXURYHX/UBtw2nsrWlcuWLc10BwgN1FUGjMnbipj5GllatOTRO/yUiE1YP6cGNROfljruJMP9nEUL+BvyIbF+ko5W3CxgVHVGCYTVd09j6Nfnul1q/VfOsCJyd68eNrVN0LiDfOS2LW8kX/aqxDMcHllCEy0xFplTsjjvnsfccK9afStkjtQqsyhiC456eEWZ3dRN9KbheLsIde6sgf6EsquLqYfvn6bIJ6Xz8mY5dcyb1Ua+mG3+QmTpgjSFg4hJIZ35Q0ZKX7kGKK6HFsxB3klMfg== 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=2dvUm8YbKBxCXDwth2/DWKDeknIUzTqYNUbVmoJWJq8irQoiDdpJAZaHmgsYqtRTUbl4iSVXqAvbCrTsiqtiu2ka6iin1TLc025VGCMW6MOdnZrVfYh0olDrvk6cBAtggNjf6wbdqKntaeju0AguUwjP9ewEfw8+Wh+l34Xoq24= Received: from SN7PR04CA0174.namprd04.prod.outlook.com (2603:10b6:806:125::29) by PH8PR12MB7230.namprd12.prod.outlook.com (2603:10b6:510:226::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 15 Sep 2023 05:17:50 +0000 Received: from SN1PEPF00026367.namprd02.prod.outlook.com (2603:10b6:806:125:cafe::82) by SN7PR04CA0174.outlook.office365.com (2603:10b6:806:125::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 05:17:49 +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 SN1PEPF00026367.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 05:17:49 +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; Fri, 15 Sep 2023 00:17:46 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 7/8] HID: amd_sfh: Add light chromaticity support Date: Fri, 15 Sep 2023 10:47:02 +0530 Message-ID: <20230915051703.1689578-8-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF00026367:EE_|PH8PR12MB7230:EE_ X-MS-Office365-Filtering-Correlation-Id: b8cf621b-55bc-4845-eac4-08dbb5ab1ae6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f+zzeWyyIeqtiMCUvpTRCJCFV6sX3LVzuV/FN8KPpmRGBYkFhGYmO/FwidJ1IJkoeCxv6mCSS/ph5bp45kaiu8btOB8Xxh9l6IoWQzDMgQ/O4+7n1OsskVMdOQZkOqnAHIJVapI9wcxyJyZGJuatxEiwo+zxxL/3Crz3jq3+rqzUXxXQUReFAisZI6RjO24QXS5bk5Kxiy1BFfEZjeTniKWxYfUXrWGiHB9Pe5Rl264aAqa6fqzA7DiLVDFluh49fAooS4vdxNWYBfPX7ep54OBhSJmv+Dqud6dZAxy1Lech1ETKGrkonRUNo58i6H0FjC2SdfbS+JAnSCV3nS/FL6EYAzvBmsdPGhl68EWZbY4ohR0QwH8eXrKfkZ6Gg//6XqMMwImnj/pRQlB6701Jz5JNylaQzcGJPtnwF213WauysITo2SVXrolLdkdJEh19banDtNIj10PxOdWSpRgMIKvJPKulEcnpr+qngzxMAHv65tDUW/2xJ0E5DBBERgvsw+5G9X3Y35M+PmImOT062ADOgvBQ4Qd9R+UyfYVszHIqbpgzqhJ2yQvjBvkCr6oETqG1WjXlJyE7MMaYMjAmhr3qROTekPlfTWieJxEnCSrBqwOxBoZuzZKOA9HuIj3lKv5516DiTDYZT4Yysnkd+qjVEa7B3vFjA1ov02BZSMTUjHAkZ20y4IHmvZ2m4qfn9BhceoxM8bCWPM+ki08PTdf2nszYC5Fetu6e+zfZC6Xb5qCMCcDa+D3TIVr0hXYbzLXvQ3sHrXx8xUBJ5mtExg== 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)(136003)(396003)(346002)(39860400002)(1800799009)(451199024)(186009)(82310400011)(46966006)(40470700004)(36840700001)(36860700001)(47076005)(2906002)(40460700003)(36756003)(86362001)(82740400003)(41300700001)(81166007)(40480700001)(336012)(70206006)(110136005)(478600001)(316002)(8676002)(2616005)(8936002)(4326008)(1076003)(6666004)(7696005)(70586007)(356005)(426003)(83380400001)(5660300002)(16526019)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:49.7808 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8cf621b-55bc-4845-eac4-08dbb5ab1ae6 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: SN1PEPF00026367.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7230 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 --- .../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 Fri Sep 15 05:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Basavaraj Natikar X-Patchwork-Id: 13386373 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 61511EE3F01 for ; Fri, 15 Sep 2023 05:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbjIOFSL (ORCPT ); Fri, 15 Sep 2023 01:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232106AbjIOFSK (ORCPT ); Fri, 15 Sep 2023 01:18:10 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2067.outbound.protection.outlook.com [40.107.92.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5D4271C; Thu, 14 Sep 2023 22:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lFPcTO3V/Vm2ApexZ7Lx+UrSlOQt5ODC0OjmdkrBt8qhhhKPQkmAf37vCQvgtorSGygcfnh3Vs4SPB08HGi2HTwSqui3rA4bDjNJyLrs/rUU8gH48pnNc51Rvb9i1RsiBwHnpEh5+eRk+Zq+BTYvnBJLRvRaG/xkUYnvUoWc3bvokO+pXKrBZK8bRdiEZ+4DExH3Hpelwv2Ki01Oaq2sDFI9zkE6vxtLJEtW4HIhIax8lU/FVQSn06op2DJu++0/gSzRlc1NLLJ/zn2zHgBrHNJ9TsqlI/Gu5YBu1yxCT6n5/dQ4CsYbUz49qkOFPxRDRUMDEpfBSQA4pVhoprpkbA== 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=FNkd7LUGS+9gwQhFn2EgH9IP3I5/l0z8BBXps9/s4GvE6OhI4mXj6tD+vEuUYNile+hPBR7fkggwwHgeod+jUXakg8mNFzW/8tsqTjCLDMbNDtJZyTKJO9iVEV02F9jZXHcCnqSGHntXDA0MlFw0ygbha7mcFpt+6bLf/Kt8+nUxuH5Gkfa/0Ah+OMxIH+cNqfVl/dJpT5dKMtqfUIPhmQqydHXiPOAO2Pv2UX/jg8YIiQ581ySykG2D0q4bAx+67/7ASsr/d8f8MjonvRkNP5ssGmc+LH/VcVJsCneQC8Mgn3b5SZmh2FPygio/iFCh/FnK0kH7CtP4ArgmLvyhoQ== 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=GXsmtr0n5bNMROC+VZGm89ewL2bmLWhjMyKTaS4/BCe3NLaAVy49XIsIZhCLxKM+3PyM2T6PgtmuSknMDsW4Ol7bha7Zeo8bwOVSCwKGHdk8p+f5Wxq8jT+CDGwfmVYqh1qKjhsHLpC6ZoJbe7em7W7PYpxYoEZ60oFSO0TR8I8= Received: from PA7P264CA0410.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:39b::22) by CY5PR12MB6408.namprd12.prod.outlook.com (2603:10b6:930:3b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 05:17:54 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10a6:102:39b:cafe::e2) by PA7P264CA0410.outlook.office365.com (2603:10a6:102:39b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 05:17:53 +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 SN1PEPF0002636D.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; Fri, 15 Sep 2023 05:17:52 +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; Fri, 15 Sep 2023 00:17:49 -0500 From: Basavaraj Natikar To: , , , , , , CC: Basavaraj Natikar Subject: [PATCH 8/8] HID: amd_sfh: Add light chromaticity for SFH1.1 Date: Fri, 15 Sep 2023 10:47:03 +0530 Message-ID: <20230915051703.1689578-9-Basavaraj.Natikar@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com> References: <20230915051703.1689578-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: SN1PEPF0002636D:EE_|CY5PR12MB6408:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fb23a10-41b7-4d63-c9e2-08dbb5ab1c98 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ifVROvhFmyMC5XlzWQg7IAZpyPmHXnme/gxftLfX/NB1wsnOVWWeLZe0tBgaGbQ/HQyYBtvCAX8dbFF1klTKYt5FjycgPMuQno9SylZOrdlyQnfueTuAUUcGSIX6xM7ctpLlzV7RI3Y3YAxd0+/KWPv/fQeeqI6bGFaIikWgj0gaXAHgcf+EGIf+XIljMdBjt5JL5egcXFXSZIrf/+u4COOyDWCOXDuhLDcNRUNzx+meFsVNXhJ1sZWRBrYbmieA1FeAdzUNN4TMuZ1bYIR1EiJVIYHkMABNz8WNT0FMIgpOR0TmJRXwwY80Bidq/0g0TWrEGGe5RFf3bV3nqeUQuKcj65bobTNsrSnqKB4cL7al8AKGXoMRMELCB70QKyo2etJP0Mfe7kt962a+gsnAnnEol9eVwmDpYxszKgFuN3swPQDh2SVj7NcfYxGvIRBbr6FHkMeBDApw69oMpUXAAFZvAPC7d3s/gWw/pNmzbmr2QuqUX0ZRkK5k5qrHgA0covRuKfftkct3FTVJMWMGtFoMAhgfMPyHSPdY3cLeBIh9oS+DYjPFaMhyMWvVAsAPyax3frfOwioIhO3H+r96d+5sbIkjm7b6fJKjTIKoa0bnbRUUuYrvm7MoQjtzZS4++97Sfy153Lf/vwP3hVY49cPmEZVmERxYntgfwOYeWLrV5WZTXtLOLhs8Vaa8LmfANcLKv/x3Rdmls7XJprb4RMR+cLT9H3Hs4uSQDDmEaMk59C9X3+ZRWSw7r+L3SRhwhf93nMm9lCUkOSh66YPw0w== 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)(346002)(39860400002)(376002)(136003)(82310400011)(451199024)(186009)(1800799009)(46966006)(40470700004)(36840700001)(36860700001)(478600001)(40480700001)(40460700003)(47076005)(4326008)(8676002)(8936002)(81166007)(356005)(316002)(110136005)(70206006)(70586007)(36756003)(41300700001)(5660300002)(82740400003)(16526019)(1076003)(426003)(336012)(86362001)(26005)(2906002)(2616005)(7696005)(6666004)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 05:17:52.6242 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5fb23a10-41b7-4d63-c9e2-08dbb5ab1c98 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6408 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 --- 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 {