From patchwork Sun Oct 27 12:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13852512 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 837FDD116E8 for ; Sun, 27 Oct 2024 12:09:36 +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=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=KPNVoDAu64Eci7FueXQtupNtvn wKwkDTPbNBSnPJ/1KCzYZh7RYyjZ4S2MzYn0ZuQE6ujLxPQktA0T8QoL5PsJQJPzqL/su6tDcG3bJ 33R31ERitYvOAnKj+wMcBQlUUx0FETHTJTtoyovUFvFvEFnqjJMfR6W7MC7gHfFJ5yixpIgZ2Z2Aa XgUGmy6RD1uo3MqUD2vraNWo4Kr915557zXCPoM7ksDQsU4R834oKa+8WjlhdxevPxgXjBHgVSFj+ 8+81kG24jW9qq1079ez2lusF/+TZKmnn+cvwNj/KsJ5zDFgPcTR5HISJ05+QE1KOO87UgqySdbXg4 H1LVJnBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t525E-00000008Bxu-4BUj; Sun, 27 Oct 2024 12:09:25 +0000 Received: from mail-db8eur05on20610.outbound.protection.outlook.com ([2a01:111:f403:2614::610] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t522C-00000008BZh-12CJ for linux-arm-kernel@lists.infradead.org; Sun, 27 Oct 2024 12:06:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=emxw4LreFEk71+21SaSWo7nbumo8bCGauwMgFVhFZD5bTFGzqGrLDM4+IxxwDRsvx+bxZt8S4HSPeiyLI859zbYziLlEeVN9CevcO41xNluBWNsTUtNgaBgEzUBAEjdDfgndhJuAKw6viJ+HYcbS1x396O0ira2cUmoqZixn4YeCdMWvVC0Lvl2pKwKWIHXVUgzFsPlqPCZqJ537r7aKWyunYw5eYFFW/aFS9ZwnlsgyEi7ZKIUpq8dyst8h1tITqBsIvlhDvd3kNYcxR+mVAdm+KsMj6KKh/pIY7b+H/VmD8+2jKBNKanenQz+z3ne8F0QnPlavPJ8K5NdNXjJm4Q== 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=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=brYH210vPkX7uoXvCGrqlSOL/qmhAS8IXpIil4bUFHSojPQjcWyf7kg4paOGk5SBrgqpx6VzkNz3lxW1mRWKPGlTAWSctyCLvJjSGf+Ovo3aV3WzOpCd4PRF3L7yGW2AfrIadb6FwKC8QGgcjBpVJJBYQRyObyrNlnlrC5WZ8W030M6xd0kDAIyglkcfD1241wYLZY7EZOkk8/FYyiIq+LyUK6VRWFAW43t6COqM7TNU9MH6mPEmTdiMAMfdF1RyzbUuh+vzm9cLJHQE0ELdwVnLZyzQBkbzJe3yPxqEE/pBIJnBMYQv9/OLxJKv/mSVx7dKLCgHffrflf+3T+wu5g== 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=dKK38nCOci4ZCIoXe5gEa3U4nuztclm+S/58tn7qlss=; b=pbxjIn9m7Zgcj0kCZKmvjiWN23KdZDJ+IrZn7WA7Bvu0kE9iqG8HMnjzj+cdzgyJDW2IeloxeoL3T3tr3WaOqSA8wFC5jgT7LUjwEBI0aumgeweP56M/gRS16FWJ4/YRYlLyTU48sc2ecRm9oXAwnO3yNFCe4E+GFXkZamZ0Nbz+OlGkZfrNeTrdopVDXV7+svKh0/X1aZXUXvwveRwIvauaTg4KcXlBxYbWuOICESrh8t8jZBYejYHgFM7AUKAANR8JH3L8p2XaDLlrB6m6veHG7hDHD808l+iObsjevqdYKgYRBw/cR4dyQXI/6x8fkYD0/bnqIRthXTfQbK77WQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) by AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Sun, 27 Oct 2024 11:50:15 +0000 Received: from DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197]) by DB9PR04MB8461.eurprd04.prod.outlook.com ([fe80::b1b9:faa9:901b:c197%5]) with mapi id 15.20.8069.016; Sun, 27 Oct 2024 11:50:15 +0000 From: "Peng Fan (OSS)" Date: Sun, 27 Oct 2024 20:00:10 +0800 Subject: [PATCH v3 4/5] clk: imx: clk-scu: fix clk enable state save and restore Message-Id: <20241027-imx-clk-v1-v3-4-89152574d1d7@nxp.com> References: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> In-Reply-To: <20241027-imx-clk-v1-v3-0-89152574d1d7@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Abel Vesa , Peng Fan , Carlos Song X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730030419; l=1313; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3X/Qf8yxkbiUb4z7PIwDr4+tntiXC7Iu2g5/3wMx1uE=; b=VI+Lsj5R2/35/vQhujc0PD5alNCf7KHi/4s8314O1YMtpUo1hUYjxxKz0Ns0behxdgRhNha9w 0Z+P3rpe3XLAM6ih9NS+2CfqqyuyxXDq95o3gx7knYeAYB2ghDPG4OE X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096::21) To DB9PR04MB8461.eurprd04.prod.outlook.com (2603:10a6:10:2cf::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB8461:EE_|AS8PR04MB8689:EE_ X-MS-Office365-Filtering-Correlation-Id: ba2e4a91-853e-4efa-cdac-08dcf67d85c1 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|52116014|7416014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0MsaxTi+3jND+nCtgphkZlULNo7EoCb?= =?utf-8?q?8a7sWDpvG/C3HDTjLQcbpvL3hKwnfCZLxxNC9/pa0fMjFHXAuktW9fIScbkcgs2Br?= =?utf-8?q?ponnrGqxIaVoQ4OwFfFWzQDKHcTJsMa6ZnVyu1hKGqCtXydfL18GH7lNX/kpFz90q?= =?utf-8?q?VaQOvpQJMWtMSHE3vC3cJG/q0PvTTlg/FhJiCmhFa2/7Qu9JgbI3ZvfTNLRM2HiIJ?= =?utf-8?q?c7mE1IvVSYCESX/64UruN9QA4cOoQnosL2iiQ/VG03TIJIyOmoK2oVKJQgnNh5NtH?= =?utf-8?q?ZYGvYpLiznETthu+8hNpEKQadHmGVnycF0Bck8qVCEW3wwpkfVSusppZE5E+lrZWe?= =?utf-8?q?KTh4AcPJh5h4AkGj9dD8RjIY9iEyxqUBDV2E+bjHG2yr++czXdbKMv6wsq0kYgFMG?= =?utf-8?q?Y2rCEKDUqQ6pEPuiZCrHBAs/mxfNmLT5UuSpOayUU0Pc5KJpb76PLWPw/al+dypfs?= =?utf-8?q?1GhF+QIQ8SOfIaxq4yxA87S0XdrURaIklT2aOu1Zvwg3MSVkB4knZAkq5MHM5Q5SA?= =?utf-8?q?E8/Le5VMRJAIjWcE4X8PCAIP8CsqCxLwNEQl6mch8NNthy3KPgLE6DBSWTzOnMKOf?= =?utf-8?q?QwulJmICuKGRB+h3MPy2GfIxCtm0lPHo2+Bt6TVfO9xSPfXoK1TIL3vduiri/hNrd?= =?utf-8?q?UvbV/CKOmNgvXVHuswh5tRvlIZyBP4VlK/aJZXQqZRs29oeFJrH9+vRCk0Gcm3b6S?= =?utf-8?q?+3ZGf2LvfW6HH0gaExOj1lz3PLkFrpfYayDIgHtyj02PB0pbT7oCQJZ3f5rx0cZhK?= =?utf-8?q?YbENripaZXYxwEVVwpBc2EvR7cqqS9O1wpCgXqR2MiHE/PhXrRA1G9lwuZm6wnM0C?= =?utf-8?q?WYe1L7ndonNIgBjw1+Xjb/aKlDPoEq8H/3M5FV+i8Wp3awQLL+muHV26wtrO4d2wg?= =?utf-8?q?Er4uHENse7f5oVBlJ2b4vSopdftG6hsaBOjZCms2mEt3sTdqrr9iVLie5ke3FTayB?= =?utf-8?q?m35CEpSTY+lblFnV/TuH/RqIzNrxTsh14U8Blp62BT9yIlJQ5SAvYbZcLpVxLlUu6?= =?utf-8?q?ZCIDfOp5ZopZbPlXifzAP3Jq6IPBgZNstRtt4D79Yl+dhGp4rjhbOfxdbzXp/gRP1?= =?utf-8?q?jJEOR4i/egXGK3NxLGOEM0LIlPE8DiORGUEfQHwAgunlsXH26T2m06dA8L9yjGMl3?= =?utf-8?q?OKzMJv8LRyI6/8HhX+BvEg90bXVnHTcEooEWKpUzYDx3ObBRW4SwPRxRh4qul15og?= =?utf-8?q?6AKsP9C8eZS4yZ9t+SzVnQkN3lJ6Er589RKEf+1F3w6BTEtF3WnC3dKU7kqLLxszm?= =?utf-8?q?v9oxm0RM58rAimCWsMQ8KGBiR3pLLYb5/unnLNmht6poN4891HqpXZyM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB8461.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?n6Lsu/4gu7POt0sEY8yNsZpauCQh?= =?utf-8?q?YXrkgMo0Pzm13Dz00HyEHfVL+ruMJzKqSW0MqG5nhn/pzS3ce20697ZKGhUjqnsSI?= =?utf-8?q?mrRzRunf26OkzNYuREsoKroO7N2+PMrtPEw+atdrCqKP0k2KcmNi4VotVu/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q?= =?utf-8?q?Ocl20m8cloptpBj5bA+iqqap3CqW8z7ZqHdfEc767A5Su5ByWQ65V4f6qY0PXzq1i?= =?utf-8?q?GFOwDr9rxVxee5oYOc/np8Fxd2F/qOOA4kUz5V4ehx231b3VUYlcw5oVLbKAIpHDy?= =?utf-8?q?sMQ9vhjbvQZ14XWMsnOKtCjxZPrGxF3YFNUHNDD31KGrTFJObnSMWLpLYNBk1b3Bv?= =?utf-8?q?LJtY2wKMzNondB55Op0lm/tXY9RKbnBlbQiWy+MXOLsLVkmIHF6PrgE4y8Mun6k87?= =?utf-8?q?OqDqS5jow28n4GPgQbhOX1n9Z/TweuHhyymXZ/CTFMrPH7vrD4JK0Aq2X3g4BZOve?= =?utf-8?q?xQPpvtMGYCVk5loF1dQVis6QvuQTuhELLPwoVySl2epOb/naXPmkL99TYIp6z5BE7?= =?utf-8?q?+dvx+7DeBlr+mRWNd5pyt4vbY62jAIwtWNacDm4Moy53RQhcnuVLAEsk5gs3+x7Pm?= =?utf-8?q?ep5f4LxM4FUMiD97AgIycCq4omAUAgomIHjsyernhtvF8u12/klWboLHMIO3/yPOR?= =?utf-8?q?nE6WUwjbG43O?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba2e4a91-853e-4efa-cdac-08dcf67d85c1 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB8461.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2024 11:50:15.6191 (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: tUs9iwsibw6nou/HZ6q7KRcPtFO6optK/8m5oCo6awU2ZlnDwXQaGEM/xiGLSRWA24ROMNCCTQOHQc+ABIYhaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241027_050616_298095_4AD04AE9 X-CRM114-Status: GOOD ( 11.10 ) 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: Dong Aisheng The scu clk_ops only inplements prepare() and unprepare() callback. Saving the clock state during suspend by checking clk_hw_is_enabled() is not safe as it's possible that some device drivers may only disable the clocks without unprepare. Then the state retention will not work for such clocks. Fixing it by checking clk_hw_is_prepared() which is more reasonable and safe. Fixes: d0409631f466 ("clk: imx: scu: add suspend/resume support") Reviewed-by: Peng Fan Tested-by: Carlos Song Signed-off-by: Dong Aisheng --- drivers/clk/imx/clk-scu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index b1dd0c08e091b6b61f6972eb630adacaa4f288c2..b27186aaf2a15628910ea6a3d4aaa5320ec4295a 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -596,7 +596,7 @@ static int __maybe_unused imx_clk_scu_suspend(struct device *dev) clk->rate = clk_scu_recalc_rate(&clk->hw, 0); else clk->rate = clk_hw_get_rate(&clk->hw); - clk->is_enabled = clk_hw_is_enabled(&clk->hw); + clk->is_enabled = clk_hw_is_prepared(&clk->hw); if (clk->parent) dev_dbg(dev, "save parent %s idx %u\n", clk_hw_get_name(clk->parent),