From patchwork Mon Jan 20 02:25:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13944694 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD059C02187 for ; Mon, 20 Jan 2025 02:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=68sNTPGQCgbbRgyuRWHPeD3AapuURVy2WR1PynHpbgI=; b=lBzPnUxIflEPjC1ARW+D/B2hK7 wpmks0II4GIn9t2u0BFugJBOT9Af+YGEeqzSYqUC7RGztlMreNnvWMfeYcUMOH6bqupFgCp/r7x7O ZGG7IZpE30SNmw64q5JsTD6ODb7nZRPp6FK2VStwrdWYXonTyWwgwZ/DG7qC8O+Hk5ZNjKIdWdPES jsRcfDqTuRD6SLLt2dRBDBobkkfdhMo9eJQxRcy1/8DV3ETTojb+Yl05rZOc/e0ZmaupzZRkXmzVg g0Q/5wDoqkpKwCIeWObWHchY0GocQr2vfZ6pU+ENUqVO/0HZMbzOkE+guTtly+iVruQr3zNCCTCnS lnJu+v6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tZhXL-00000004aPa-0fme; Mon, 20 Jan 2025 02:29:11 +0000 Received: from mail-vi1eur02on2061d.outbound.protection.outlook.com ([2a01:111:f403:2607::61d] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tZhUp-00000004a4J-1rQP for linux-arm-kernel@lists.infradead.org; Mon, 20 Jan 2025 02:26:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iHOgH65Shon93aVQXNbAd/g2t/8+bwYhm0sBINgIACczvbkzr4UqidSUnpcTbgRH0ezbVFhCtifF4mFWu3kw11mCDGQH9VLc3M/+hEjhBxDPhwbqx89rhDo9y3+iIs/hVGP2gPHZ2sQkCc232gPoJXd/KIAlipC9rHH6+dYKmVRfSf39WkB/19n5t0ZPywMNj6SM/6vCcW3a1sMe85XOHKqjdxiHZ8KC8thEGBu6xQvuhW7T1hDEt3hUaOFCL00lMkrHVtCGZva4IZIkA2giEqvY44o7b1nz7K2GDhIoiDUbozk12nMKa6doXv/gLLjWNjlLKZJ2FgMgJ2ZaKdSkjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=68sNTPGQCgbbRgyuRWHPeD3AapuURVy2WR1PynHpbgI=; b=Q/G0naYNIJKj3+LesrPThWL9RaR3SJ5G9fr+bnGXWETFz3/nrpu+QWX2N4Tc8c8zfY+3huizqdv38a8xCZtWq4GNIqL1gdM5Czt5KXWsO52h6CxKi23LYrpt0vwOPn/UmNkaRtKkUZQgOmKQmIHukMauxAyL57yGOfi3xjujAWNHu0QfHxjQkeOVWDXarV6qJUrf0EJxvP8pkwCJ+2F42zAin8Dtdu3b09/sQH9tCf5WATHLZC7LyE4GLB2Imqr15bdl9ROxeJBotG+tzscrQwN3woH2h/tvvPkvy5nLVVQWdyvanL0FmAQToYT0X3s+zj9lGpfD79JmvBkT/pJdSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=68sNTPGQCgbbRgyuRWHPeD3AapuURVy2WR1PynHpbgI=; b=uluGuIkFnskBdQMJn6yWhnBTLl462RJXskZWSM5caN+Nh6SSXm4Sq2GMhyTv2Zah6OrqNZRsIzM6eKOpCzawiSjWMAjJm9Qf59rUMHzCdoYxKPtknAQW5DGX1PgRd3RAVgU8Ydyx+rE3yOP/Jg5BSLMMBcRTU6hzHPR2Eijs57yUAcckis9FW12gunICDQOSB+KVE4Ml47Wp0MzVHYhRnbv0bGO21Y/IlI+g7rkiw+z5QknzQGl1QVHBCAYeSYvLmcQcBZBcIzPlsW0iRvaHloP7EsUDJNfUvK9jTE+VRDsVk56tsyEmu+eCLKSBIu18GAPDvKKATUY/i6IU8mOqbQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB8690.eurprd04.prod.outlook.com (2603:10a6:20b:429::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.17; Mon, 20 Jan 2025 02:26:29 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8356.020; Mon, 20 Jan 2025 02:26:29 +0000 From: "Peng Fan (OSS)" Date: Mon, 20 Jan 2025 10:25:33 +0800 Subject: [PATCH 1/4] firmware: arm_scmi: imx: Support more event sources Message-Id: <20250120-rtc-v1-1-08c50830bac9@nxp.com> References: <20250120-rtc-v1-0-08c50830bac9@nxp.com> In-Reply-To: <20250120-rtc-v1-0-08c50830bac9@nxp.com> To: Sudeep Holla , Cristian Marussi , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Alexandre Belloni Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737339953; l=2331; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=tqpvycmCUkKZkyc9Cyg3oUuQKAchfg07LHtaTpoAfgw=; b=cZyiewEjAmB1rjpHMTQgKi+1YAmewsz7J4uTr65YE4idYJ7iZNowzIsUkETz9iGboewI8NNQt rC9Cs4pddSMBaoEpkdP75XhPUFqLttJYPeetXe7XcK/3V0w2X6XyaaA X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0038.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::7) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB8690:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a8c5149-07b0-43ef-d69f-08dd38f9d91b X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?FcROdBhQmP6B2g00JNu3HP1AuvskHsq?= =?utf-8?q?updv1JZAF0NxiLkQHGlbrqfUFtxhKQqV+vQQq7CfZYR7wD1g1B7wX73wvFybvOeTh?= =?utf-8?q?h66md8B8hwzc8E3DJAjySToMQX1r+HaKxQ7IHIrsO2iLr6tL8PMkTTTCUjYoYsRx5?= =?utf-8?q?NiRpVlQxIXYP2krUYiaNJFnMSTaSZi070ntHCgN+WG5IuCh6bxDeX+95HJtwaMr0j?= =?utf-8?q?iTy5WCckn25qC7Z9IN2MLrVExo13SmptrGE8WoMb56hAsuhy/HQppPm9jTATXXXmP?= =?utf-8?q?HyTRZJZbJ5pahTKi2O0PIPNVhoqW/b5vjhvlq7cYbEnCJAKz0xU7IwwlRUaiPIsNl?= =?utf-8?q?aAT3LwoDGxXyaxtXAfqupBYnyqEWT/2b62K03gr0HHW7DHm/zcmbfRbtdxCHjYsjO?= =?utf-8?q?FoS78tqBRjPfzSlbQ5tZGye2RK9iHqDOC2DJJbs5iP9apRsfvsV0vzo7IDA9mGTe6?= =?utf-8?q?uqlwK51gZ0Rcww6JA/GXAZg22Iz6RywQErT0f3QxrG3jHtzxv9xRgMusS5sE6TFx2?= =?utf-8?q?UYRJhlqOINGE/EXuzpkwKg1MtETlju5CS3lHDiR3CLu459hap2+AS8Nt7ymmNJWUG?= =?utf-8?q?uEu2pLlZq64RrxD76zud8vzwKbd/F+iUAiV4rLL/eCfubiPf8frvU8RwkhmUDrUSr?= =?utf-8?q?+Ip5hgi1fsJONXjGcpyQluUxDgOKt+Opx8fNIT4tG5H6bHk3tHyxYNvEPE9zm8CaR?= =?utf-8?q?3Osm/13GZLMingcXdJcHPe4DBp9k5n+9mx67Klo1HxjXJt9ZSLr9Xh9hDumNOwWhI?= =?utf-8?q?vv7MWANLhWs8hIOyxde/oDM0W5fYqLOkhHmAwMaPHvNGDZPNtqE+utDtZHTV+XOfR?= =?utf-8?q?jWQ15OF8YN6kiC7PAiZysCnorwcq9q98wQQjEJAldNelqxn9SZvnwYRTy78rPoUoC?= =?utf-8?q?GRvUaHpIacxiQ7hMkB1uX4TBdIQMiJt8JIygPuLM9DMt5rcyqwU3IOaSIyq3jF7lT?= =?utf-8?q?KG1B6lw9AIrJhJ+/FbVvNnv4oRtz0TU8BldG+J7K18NfRMUJFfgvNcAvB/C8Gqua/?= =?utf-8?q?Zgk1q/m23Er7snSxkjynSKezYjQJoA/0ly5UqIzvONIcNhhM1ctFCvkJP+K4xGswR?= =?utf-8?q?mGMHW09UNUfjn39tvRJ3Wixedy9xp14T0NY0oGhY9Mh3BWvoaP/JKx6GZrmGIYmEH?= =?utf-8?q?VMF7CkSLbqx3CQMzsT1bTss36NYdeU4cDttg1WeQpoyLJE7PnaQjjg1V1saWu5Knb?= =?utf-8?q?F/msJkXtxnyCPjBwOuyM2Sc/WXHPohW60JNEIAYE1j/P7VHKe1fPmJZPuXL42y20l?= =?utf-8?q?203CLZUkj0FnqjFjc4+BhmZGYFzQP1KcpEblXZ/N6zxGgeQD7fHP5O3MpzhFyYVjQ?= =?utf-8?q?XRO2ZRza9DuRz4cYMH0Rbcc1SYq9XKH8MmiVgeGIYCa0jE7N+trtA/u9HRxA0HujU?= =?utf-8?q?SWszZt2nIdJ?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?l5hk/OBCtZMY8Qr0rdHDE52VPitb?= =?utf-8?q?vtB59TIn920M0f8NGuD2hkPB3Jf6e+N/XAiXRZVR3dEYRIcrzlyyqWud0jF5r1tI8?= =?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?q?FPRJIB9sOUd8usKNXAH4CKMA4JJOQkCOzY50hYzhxkSI/zRZp6tAM4V1VrZW7gFJU?= =?utf-8?q?MdOoSfFvkIA029LJcFArQxt1e3pH23LVnwx4X/Z1fywfPo/fwVWdQVc08uRRloil9?= =?utf-8?q?IW94AJvfU7ZXxK+UcYpziq/vBaLrJJCjN3tTSVrR3LvAu8ZXifXY5y4x9/nXY4raY?= =?utf-8?q?tHB8qQngV6I99SQDjQhjLfXnClkSlSEoe1U423aJw5POQnpQddCPkSCrLiAtPpzdU?= =?utf-8?q?FVsnoNjIR6wExnWdspw0adMMnADMzykj3nDKI1A91lxIRujCi3QOguj5u0XZMtXOY?= =?utf-8?q?cU0TrA+MqIOSPfgoDmGEeDouCxhZ4UURbC9NmqwHXTf+DGG4Cxbyvajv4z2U6+OaQ?= =?utf-8?q?ID7WwENMV37DN5SBxNqU2n6vTlb40QoehzNJsxPLX/ofCuQNK9scYWJgla/IcF9Ke?= =?utf-8?q?hGiaEE2p5YvA0ZGArsnO9zwzMsPUjupa9mntl1l8qgq8BkrsHxrowiTwglT6ZV9fF?= =?utf-8?q?RdrTb7d5L7/wEjKs9d/OOAe5OLWVNRo+664XCdhOfSettxYnjzwaWeIfPtBK8ZvBw?= =?utf-8?q?pHJ5LtGzIUGx?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a8c5149-07b0-43ef-d69f-08dd38f9d91b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 02:26:29.8057 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FFjijZmvwVhi1s2TgjZhZsDqtFTIQ93LpK2y4iNJHZFqMWAPDzYasxz3GZSrgG4HHf6IggwWngQrxoE4xxjmPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8690 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250119_182635_491707_F5C7A9A5 X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan The i.MX System Manager BBM protocol has the capability to support more than one RTCs. Add scmi_imx_bbm_get_num_sources to replace num_sources which was fixed to 1. Then the 2nd RTC event could be configured. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c index aa176c1a5eefe4220e54e366cf3a267de639fa9b..86fadfe8e3560b1cab5876a1029e38d91d938e2f 100644 --- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c +++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c @@ -128,7 +128,7 @@ static int scmi_imx_bbm_notify(const struct scmi_protocol_handle *ph, return ret; rtc_notify = t->tx.buf; - rtc_notify->rtc_id = cpu_to_le32(0); + rtc_notify->rtc_id = cpu_to_le32(src_id); rtc_notify->flags = cpu_to_le32(enable ? SCMI_IMX_BBM_NOTIFY_RTC_FLAG : 0); } else if (message_id == IMX_BBM_BUTTON_NOTIFY) { @@ -156,6 +156,20 @@ static enum scmi_imx_bbm_protocol_cmd evt_2_cmd[] = { IMX_BBM_BUTTON_NOTIFY }; +static int scmi_imx_bbm_get_num_sources(const struct scmi_protocol_handle *ph) +{ + struct scmi_imx_bbm_info *pi = ph->get_priv(ph); + + if (!pi) + return -EINVAL; + + /* + * There is RTC and Button, but there is only one BBM button, and + * at least one RTC, so use nr_rtc as sources number + */ + return pi->nr_rtc; +} + static int scmi_imx_bbm_set_notify_enabled(const struct scmi_protocol_handle *ph, u8 evt_id, u32 src_id, bool enable) { @@ -220,6 +234,7 @@ static const struct scmi_event scmi_imx_bbm_events[] = { }; static const struct scmi_event_ops scmi_imx_bbm_event_ops = { + .get_num_sources = scmi_imx_bbm_get_num_sources, .set_notify_enabled = scmi_imx_bbm_set_notify_enabled, .fill_custom_report = scmi_imx_bbm_fill_custom_report, }; @@ -229,7 +244,6 @@ static const struct scmi_protocol_events scmi_imx_bbm_protocol_events = { .ops = &scmi_imx_bbm_event_ops, .evts = scmi_imx_bbm_events, .num_events = ARRAY_SIZE(scmi_imx_bbm_events), - .num_sources = 1, }; static int scmi_imx_bbm_rtc_time_set(const struct scmi_protocol_handle *ph,