From patchwork Fri Dec 6 22:56:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13897916 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011038.outbound.protection.outlook.com [52.101.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E132222C6D9; Fri, 6 Dec 2024 22:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.38 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733525816; cv=fail; b=mpIqVj26jdps8KCzV/T+pp0owgsrfTaSBuGnbHSxD+K8m+Iji6G+Gl/GvWUjrxQn6aMXivlHYy+mGM01OZGoo1U1GiwqvqQctEhZBXxnC8hgisg/ZgR9dSx52B8GGNC8K/3HT66mCQ16kl3YCvOUjAanTLjI0wz0D3tKPpihgTE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733525816; c=relaxed/simple; bh=j7wOQdDYOjDgRutV9S6c0uBLOIXLM0FoulivhCdO1b0=; h=From:To:Subject:Date:Message-Id:Content-Type:MIME-Version; b=TfVH0LmTdf775TEuTHZy2gjdOZkzCw7+VnwyrdG2ePuywNAuQZEmcwlxCwjtprbZ+Ds0r09zGdr6KynOgOa1wGG8UW9C+qFjBtE4koN4fHg3TRkccE7RNhuBDBJub/rRjXCHrQLVG2FZu0xBafEGTjYpukFfnQhy4vyMZVQ6VTI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ZTD0oXxd; arc=fail smtp.client-ip=52.101.65.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZTD0oXxd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v04o04LgItfRL27H0elOm7DcsBzMgvMwpLc8OCZ7ldUryk0/rt0Bu2d5DqlAO2UHxmxjqg17ZkJc2Zh9Pf1lFah8rWWMW4FWE+LKe+inoboxnNRNoQvadFbp6dxXDP+fbMvggOeuqJx/MkWg9Mxs0CwWElUUsfTgK1TdRVgz/Or47jw9fHzQxYeEA8gBulOkSNdKuiKz47yMTLoKFfPCiyg7wF/c3OHMLw5s0ovIq2JKflyWJu0McyQpzUb7ef93+mKioQ5CLeSoCaU7R/Ew6O+BgafrvuU6Eb4FPHaqILuB+7WrquoJYcj5PneNHkbaw7oYOyykOP7xppI20rAf3g== 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=/UbVjsUn25a7WNf1SKOR+2RGeSyON1LpUXM+9JfAea0=; b=VeT4IGH+zsif8SV+VECK/jmuIYDcIa6gQ0LTJ+JtOjP/AYGoQpT5Z3adewMlieWB+m0B3IHy/x5/DcaNsqkANrtcESM0PK4mo+mcqY+Cwt07mSDcMkgqb5Qd50gJ9ZkJfT0icVKWTbOEDZb+ylzfF/Gig//B037Y9noRwYYEBb1/welDtLK1vOoelTiFZQcqPAMJBAs7kSGsilZB4+bgKduRxLvNRt28fhd2VspUySVDNGB/8ETcnN6HKo7Bs0/jiBeac7lwdCsii0dmWaZAtYXauBcKquTF+3PaVtlYmKCSUeKd/5RjEkqBXQbQDcF59wkbHt6gXmga/TS+znyY0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/UbVjsUn25a7WNf1SKOR+2RGeSyON1LpUXM+9JfAea0=; b=ZTD0oXxdrm2XolA+RNK7CPhkP9tEyy8N8qevsqYAzo1J04PEKGUYGTFPz1IR++eySjyfX0agE3f8nyMuinQRI8KQlLBd4mkymz2cK1mua4916a3vZiJQVM7svJe8Xl99G4txzZ3AyY3w/CebRCWdrOZabCKDh+Kx2Th1lAzegAtUeu8vEcP3Pr+7BQX9m6vMOCj0gi58MInKyh3lVofh2khX/jcdUxJwqD45YCCVPiHzeAyK2iDNYVg7BJMH+47e/31bR2P6yxSKwGNKSafgTelUskQ9TOd0ZXxfSRakMqU+TUE30S8AXH8MYgBwa2iP7RqpxrOvYXpCrzDPMqRKQA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI0PR04MB10709.eurprd04.prod.outlook.com (2603:10a6:800:262::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Fri, 6 Dec 2024 22:56:50 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8230.010; Fri, 6 Dec 2024 22:56:50 +0000 From: Frank Li To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] thermal/drivers/qoriq: Use dev_err_probe() simplify the code Date: Fri, 6 Dec 2024 17:56:21 -0500 Message-Id: <20241206225624.3744880-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ2PR07CA0007.namprd07.prod.outlook.com (2603:10b6:a03:505::12) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI0PR04MB10709:EE_ X-MS-Office365-Filtering-Correlation-Id: 94b0d223-635a-4cad-9675-08dd164944e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: vL+hbmKALdpITLiii7sy9q9AkbB7ZCXS27rpo4sIZBjVRcNJ2UrRRdqLhmyyCDH8g5eSPnKSOlnKMFmWC3omIRZ2ESqZopnZayyKX2mMlmpnerrfmA3tbq96vHDuei4jwGuE68THiMd5RHyLs4Y7GJb3h+4ZMNoRA9JMB9X61HKzpnlYjAUdN8pRMDytbuDUKohrCN/prbKfrFm8jWNNZHzniVBQc+rXGUfH6Yxxz7geZf45SSzk2SIMZDeOr7447PzlwCB4Z8sAareAnnw7HMzeZQp9sKGKr6VSChMstHLTsRx+WAK2lPxqYWpjwpY35Kag7O4W/8rpt8lpXqPTxIBjMjDoIhX9R9mCug21zUQgRRsR9QOXWJvYzkZ2AIfMX8LAjSc26c8GhG7TAVVINvQZFGwrG6HObCaTddwgXBtwyszcpa5pYioy6VifgadM7v1yG/O9dwT0yvmeHrhnLLkQbxUZ+FF2JBdBIo545AtU9c1yrSp6v9APLwS55n0OMDUJrAFT9id7JvS/+jB+7gyGJh29BjoBAonZ/Z/R3sAqyH5TJMOCOkukEeWdo/eLwbmcnNIQiOrUgjdw+EovWZqtNYuYZ66YA8EfkG0wyrTgnW+lOMJGL0lxmk7ICugnznW92rAYziqQO1AJZPEnGN5hXHpEbJOhbi0ktNRtNLGrhv8FGT94VQFreLdOu/0od0L5EiJBmvIVec+srvlsfwGeRK12EGcmTkxLaleMbmVdbd/E9cMdGvfKUhmnM965CrnXw1poLsoisBiSOxKnvocYax9APTTGlZY6w99+KpqIqcvE1ZHjMjuz6XhkpgD3Ydx3oCa9o9K42anSnjWW4omKwm+4qS2mplv/JZaaQRkVc6F4HwnIh94vZJhxQcCApSBMiVNWP91cdtBIHL2hOJkgc850lrwPaOgtWKNV0ot5XUa/3EyyGuT4IV80HLdsy1TUmeM0ubYqjU9HhExJs7BWyAo0TeqYO69rRIJSIGHSlZnGDzyvLZ7D0grFM44UJVTQqYE+I+TfCqVCYgHnTara2H3GCAGGAFuvB10LDa7AZhcNatNE9ePzbOPObToFA4LUv1gQqQtFpfpd0cGHcpwYFruDGDdRrHgMkTLRaThiL6zSFh52ytcj86Mw9XCqTDI7LvRkrUd0qs99jmfQnDugveWLs3RFhCN1+vGQm8eJ8nnSGIvj6bexx9HY4Nlvx26YduJb/LmUkQf5uJjPTeWaw9oQmk1r4uTFWz8Hnbh+Zw57RswHgB3aZrN135/Nn9ddF2OThPSoOVZw+Tpy4JLfrLreRwT42a7+4deIu8gsrs7dzQme6kTmPwAe7zJHhXDvlb0/lztV0jLM2/vAvTiDRNuExFtpHz4LFiTe2ft9KBMdYqkJkhAnu2fcTkf9ITCLOC05CdVHwGZMr7N0kw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-A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jnJO1k76KmYbHNGp0IzQDuMJU4iZHTEAZdJPwPeKTwAdNzjj6WfRdP6pLL9xSUmoIFIstahwlqCx9JzMEBkZOcScFO6Mwin1AHI7wWiD3VPdE+TYQNb4wbWA33xxq0rCjhGBGzYzG8q9YrrOBAUrz/X1eg/n7dKcVJ++MZ+TN7I7G6SDIxOIRdHXos9CLSBNiPE4iqlL+t24cbige3hrJYbCo3+hqoxmR4wdclQQX/yD+qWzJ2HROMgPQr5GxskyQgIU2gTURgkF2ati8yu28YMW4q7av2A9s1mIPeG/Z8D04pmWNwWqx2UPp9ps4pVwa4LDDsDpEcWfzyhNQcM65XhJh8DhulC2WZ3jbaL6oF8brnVjqjHwgqxbEu25yeunkpS6VIdbcvHaxFwFACEZLwzbUugilEhB2mhJozD6RtsGRnLW0ON4vKjaQ7Zsw+A6JIdpqaw9mcAmnnRJy1H0wYxdFR7CWnbxgLjh/waJnNG9FnQ4qnh/eUJ1A9qK3Bai80nj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94b0d223-635a-4cad-9675-08dd164944e8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 22:56:50.2292 (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: WEyRjmZeSjdnHy4q2IThT2jNgnM/DLbnEZeDoz+fx/0YsWcqyMnD56ngDgBCPGt95GxeNiYv0w2PaXwc4e3epg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10709 Use dev_err_probe() and devm_clk_get_optional_enabled() to simplify the code. Signed-off-by: Frank Li --- drivers/thermal/qoriq_thermal.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 52e26be8c53df..baf1b75b97cbe 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -296,38 +296,27 @@ static int qoriq_tmu_probe(struct platform_device *pdev) base = devm_platform_ioremap_resource(pdev, 0); ret = PTR_ERR_OR_ZERO(base); - if (ret) { - dev_err(dev, "Failed to get memory region\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to get memory region\n"); data->regmap = devm_regmap_init_mmio(dev, base, ®map_config); ret = PTR_ERR_OR_ZERO(data->regmap); - if (ret) { - dev_err(dev, "Failed to init regmap (%d)\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to init regmap\n"); - data->clk = devm_clk_get_optional(dev, NULL); + data->clk = devm_clk_get_optional_enabled(dev, NULL); if (IS_ERR(data->clk)) return PTR_ERR(data->clk); - ret = clk_prepare_enable(data->clk); - if (ret) { - dev_err(dev, "Failed to enable clock\n"); - return ret; - } - ret = devm_add_action_or_reset(dev, qoriq_tmu_action, data); if (ret) return ret; /* version register offset at: 0xbf8 on both v1 and v2 */ ret = regmap_read(data->regmap, REGS_IPBRR(0), &ver); - if (ret) { - dev_err(&pdev->dev, "Failed to read IP block version\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to read IP block version\n"); + data->ver = (ver >> 8) & 0xff; qoriq_tmu_init_device(data); /* TMU initialization */ @@ -337,10 +326,8 @@ static int qoriq_tmu_probe(struct platform_device *pdev) return ret; ret = qoriq_tmu_register_tmu_zone(dev, data); - if (ret < 0) { - dev_err(dev, "Failed to register sensors\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to register sensors\n"); platform_set_drvdata(pdev, data); From patchwork Fri Dec 6 22:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13897917 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011038.outbound.protection.outlook.com [52.101.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5237E1FCD18; Fri, 6 Dec 2024 22:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.38 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733525818; cv=fail; b=b8aeJhiCloGMg+2BIBbYU4E+oPoUnpcBZhn52jDAp8uwVAKc+3iXKZoLNFOg6n5DE8zC3Uv5KtBlFCiwm8uEAyoKL2RB1f57OIPo6z5EPfJXzU5DdVFdduYLMjN2bOBhM6gvnliyGPIWgGIaW2tR4RLYMLT37azAYA2igC5vNfI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733525818; c=relaxed/simple; bh=TEa9fpG06MCn2xXpnGSOftT79fDHkx5qEClt9npvHEI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=cBO/BQUsOR0bob3WtSXOUw2Ms1Qbm5tD3ZMxAApshpSI9/fVINJ1eJ918XzvqKpXREqFvNGY5B9C+uN9+pzIx3rY4UeCfsrLjXOO29dpmGBNVkzX8pXgIx5wSw5v2IeImFQuCfRg/ZLOvXQgFQjCEOEfmmAtlxVnw+As51U8weQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=O57G1RTs; arc=fail smtp.client-ip=52.101.65.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="O57G1RTs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rPpiys0ZyUVkhktIIP5jYeOptJaqoJDkJLnGqAK0vB9NkKpg3aoHPl47J71IaCoEO/LgqS4+DFUspK81J72L5Fqor1WK81JIRQUmrBD+5HJ9bY8SRHRURLpWPjxk9y69OMsSdBcbgiXWn6N+Yq4TzoMfcHdwXTUe+ICw0+Hiy/t9NuxCPIip0DZoxfHGqN4nVT7ldQnDvjteMsh/6MWp8nALjDyE0VIHR46NpMPM6hmz5sfKAIFwh/SYVlAObUNFty6duHNxh14xdlptn6K52JZuKCFgRlYE7n6/KH+HUxXtmxTVTPed64aKL8AVJ8B6s8FMxll8gq+OKPxhaj6j1A== 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=u7tO3a7IIm4SWWKLlTCppg9aJ4XfFcJLOY9+xpMscs4=; b=VLB+wSpQUmapweDWNYqNLkWfvK4aFh3/cHd6Ex99kRCxvnIq3dE0NJbPOSRv9D69XG27eubrXbaEhvVA9yhefPW1OubBfYJfd8L2472j7plI4q4JpA1P+EOf/X7f/+KibwU1mIFpIzyWDLcoHyydDtLrmA2GQKLfcIW1BG6oG1nZ6f5ZyCkm0nK2b7iQrZyIMCfciDakj5MsPzSij3bfjGiDm+ZQTObjIm7fcl9kg5P30jrp0mH6+ia3zGrKSLuhSqcwmeZPXTWy2Sr8PthULI4ECIxomdwsS8gqTcT3Gtfx40uyMvsOtPZ4L03CasHNstmtjWn16Crz+6QiqsR+nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u7tO3a7IIm4SWWKLlTCppg9aJ4XfFcJLOY9+xpMscs4=; b=O57G1RTsxyjlT8HtbIBrO7LGRVMQmHtWrl7QsUM5qPkQxQUsRNsa1hKz6O8xd2/lybUIOLYRowR8k/LC7/uge5L2QSWiV+nPHfKk3BEdVMEN5Os/sRtdAemNmQOx+8bVPJ5oG+at0YxjHGgfBCt3KpBqGguC7RkIgUoxJmfCNf1bkBOLIVpMjo9wEoZe5BnUVZsCkVOSHD7YIZYKwDi38NksCKsSktNN859kTALEqphpC5UYbK1EaDAF8MWwCBCydnuuNTeVShlG9THasdHyFGSXMXPKN4+5yNxxkWG26YUDMgQ4YpWOcwux3JlzYuNdNCAwccEE9gDHG1OI9tOrGA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI0PR04MB10709.eurprd04.prod.outlook.com (2603:10a6:800:262::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Fri, 6 Dec 2024 22:56:52 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8230.010; Fri, 6 Dec 2024 22:56:52 +0000 From: Frank Li To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] thermal/drivers/qoriq: Power down TMU on system suspend Date: Fri, 6 Dec 2024 17:56:22 -0500 Message-Id: <20241206225624.3744880-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241206225624.3744880-1-Frank.Li@nxp.com> References: <20241206225624.3744880-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0007.namprd07.prod.outlook.com (2603:10b6:a03:505::12) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI0PR04MB10709:EE_ X-MS-Office365-Filtering-Correlation-Id: 80893bb5-070f-4d38-0077-08dd1649463a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: FWdvtBVthSXb1TkwIXCHIzoj35QAtEepVyvDKtMRGRZBRBNZP0ZxSPZo0jHfsJVILnfXsZM/YCzpU2wmX/XnwIRTf+Oc4C5NynBS2ucBL6NaoRD8/hBD+rBnZu/7suIzzvGxCW5C4joLPGxaX8YnrRQotMiPuGhnnXrAAkOdbvmP9pptJkbFHdOh0ba3O7ylINPWPFXJO93jdz8OQIGGuwx7i6RQ7iXSGyLhkOSb4hdbs94yW3myHkaZiQq0ugTHNv313jHQMcoyhYgXLv4Q37MvFAjOhX90Gw3GPXBnUFH4kHDuhT4vmc4o3o/prCGINlUKR3B4taZCgC+TAhh579jvBrqVTLS9Uzx0m7dKZlHwMMHJDNzC/z1UIDbMhB4/zxuAc6zYA33vndubkyd14SF7KoOUCaXY8zUir5baWx2bUypDo5x8PuiGxCMd92QURY+HSb4/uoklcY+Cf+q3kh2Gu53/sMrik8c9/4kJIQQdfYiKVGamxpDfZtG0KM3YTydS06hnXjyMb5eNDMr5UZWIXM/e+e8EtL/bBP/R2pwxhCc/Fu9WP4YMcHKk7B4d5EAVNRqmlRi7jgc2eLU7aOUkWxmDQqnKkjiUmGHf1l2GpUSWDcW7r+jRYdft8cJnLFc2zKmlkYcsTO/LoUdZnGMeVLLxH36zMqCzYQa55VSXCirQq+KlRFMXBHufR43gCXD7dsvmnIRy/0B/VQfspqtYnyGKdZG4kUMPERWNJyNfH/XpD22rmzmfl2mnZ0w9Rh+o+7uzHm5FFsabiZtsTGzyZqnfsswkAflFHOSUtOfhvp8CPtN+R0vnaZJ8zqMDzylMgxDX1IBicKmlkXbVlJQslYlyAF6J1EiqGnpxeNCGtSl8I/PKoJTcmcdPklSpRZpCwbK19V1nTSB9naXopDqfOi2etAXWAVs9C341PpBBHc/o4+LhjpIqU1Ps3icHQmxdMxXfcW64wtqzwh5+F4jjNHvOeX3+BgalxA0ysIIFiwO3XuscEEAvBRY+B4p9Jn52eFTh7Nt2h/QnIWyxA7pKwwj0gERlNR0WIIRHVVovC3FhQj6TjzUy2bGRft1707vZEEdwS5+SjKwVS9wO/7HsTf00nzad0xKPwvFOjRWmPTDFEJx9OuukYHZLC7Y0+T4tU5pRZKFefFDoWwFmc9p7ocqka3pa0avoQR8UCW0+1bC6EiFPkDAWc5bUDd9AbGOXPFSXLXtBPu2sOIVQHbHONu+5Y0asNePXCYp0CuiD02REKN18C7j6ggE3cEDAbjy7HJ08szJQ/fyBwAMan608ptqBTxBgFTKz3AgqkfXDjGLeUfMCTlEwEui83IFIYuhVmir52CRyO7cNbF2OV+8WDNmVQFu7mBwlbe/DfSEryw5hz0uTGqpfdo7xVVPiDSNPGNl89QV2XtgJ7SLXGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: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2kdnMRXChSOA/AgRuXe1lyPP6IW4KKqoCfOwfffNh6hEf3UChj1P3khaNSa6+Xu7eP9mKOKJr3YesRqmM9TeieLiHMbqHcy/FT5DwBd66UJSyZ0fGKy8OwzLrxlyKRQPlXnQnEVUfDlDPhhWlG+7aSYhVmd6npRuIiNmHmdeHvyiuNMiGD2bLTni7Q7CsdAB9iJLMOVHhtqjuNEtjvYMMRbz8AyRU+1ryIB2IRa3KNZ06Mz9aLVrPRoho4Vf3Ki6rz2buuBXHsXDg9newQIvl1OA8xB9OSOLfQSCZhWFtNcDMfGeMyGVVnmc50Sj/ixCtgBV+csjyEgi6Gx+3GC3U21KrYv54UKnJ7QbezRDwRUoMwOKBzozeNiumUEMjZyFiWAtxd0zP1qNURcQ8aqvb+uCyuD6eJMbbG3+14qoMyQiRfChnee06h8jtPmH1RkL6FnZx7Gzo29hghkA44roUbVh637g/17tjOjxlu48A4SM3N6L2v7h6+HsTPFrXr8rCnphUqOOSK1oz93sv6oWOlmfUGguC3HVTRtCuuEdnxn1OV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80893bb5-070f-4d38-0077-08dd1649463a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 22:56:52.4496 (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: LUfJhNH0Xs09Qo8423VvOpUZH1ji761jsbQJ7z4hErgeJzbaMamSTTAoX7H/eqPnP1j6aTwZZilZGo0QNtJRTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10709 From: Alice Guo Enable power-down of TMU (Thermal Management Unit) for TMU version 2 during system suspend to save power. Save approximately 4.3mW on VDD_ANA_1P8 on i.MX93 platforms. Signed-off-by: Alice Guo Signed-off-by: Frank Li --- drivers/thermal/qoriq_thermal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index baf1b75b97cbe..d95e949321ce3 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -18,6 +18,7 @@ #define SITES_MAX 16 #define TMR_DISABLE 0x0 #define TMR_ME 0x80000000 +#define TMR_CMD BIT(29) #define TMR_ALPF 0x0c000000 #define TMR_ALPF_V2 0x03000000 #define TMTMIR_DEFAULT 0x0000000f @@ -343,6 +344,12 @@ static int qoriq_tmu_suspend(struct device *dev) if (ret) return ret; + if (data->ver > TMU_VER1) { + ret = regmap_set_bits(data->regmap, REGS_TMR, TMR_CMD); + if (ret) + return ret; + } + clk_disable_unprepare(data->clk); return 0; @@ -357,6 +364,12 @@ static int qoriq_tmu_resume(struct device *dev) if (ret) return ret; + if (data->ver > TMU_VER1) { + ret = regmap_clear_bits(data->regmap, REGS_TMR, TMR_CMD); + if (ret) + return ret; + } + /* Enable monitoring */ return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME); }