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: 723389 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: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: 723388 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: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: 723387 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: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: 723386 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 */ };