From patchwork Mon Dec 9 16:48:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13900052 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060.outbound.protection.outlook.com [40.107.20.60]) (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 55BF914884C for ; Mon, 9 Dec 2024 16:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733762961; cv=fail; b=fsYm+UytIZcxb3TT8H3OTkpquARqlnKKnoEzfBiE9IvFgvHlV64dQ9KEd4CSPDX1CdrwfnprYE7M73rQn/TPr2JwzIvXLfTDIVlcvEuyheXd5bDCMHhhuiX+14V7qycbL27aTN8MMhLox/RznAGc4HY2mGccyXhUh5AcZ0IZ58k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733762961; c=relaxed/simple; bh=D4JTDphGZ4L4O9Z5gGHAbxkHNI5pYOCVsTd548796HU=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Xtwm1gVfYg1gGQQo9OeGSR1aFN+u1bkj1INTDK3TxHXTcCo0xMmpmD8iaoeWZ12wRfa1FXg1aYdk3yyR+wMGJdA29jzYX05igQZfvCuXBP6HodriW6X/cV6gKgb585eZhByTeTQSr69l6gha/lBUXmwHd/O6JnWIJ9MVQBjJPcg= 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=DcqQ5rGX; arc=fail smtp.client-ip=40.107.20.60 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="DcqQ5rGX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IOGU4K0gB7352R9AP10J2MwqQFnwKkvdJHY0EqP/n8WWdR6aubpug9Pa+IFFs64+p7vHQzxx5VvfZ71SwuITt6WBeWlpTLiaC5MlfMs89QDyqImclpVYJ4d7OE7cy0W+lTk+rxqUcaOnZQnBzwV6iIKgW341I9t+foGVlAll/PWcx0fVmDicSGNeFB/wLzPG/kTb5waA/56uNWJAUVwxnGW6BFTxl3afziJgZPvFo0ufCJ2R+5O+DDsKSX5QGiPmq+1eTcBhYv4X127JjjD0r6raetf2302v6XunEjaTkMW0hByeSJ4gOPJxu8bXEE4MqPY2j2bn4v7UDhO1q9OPlg== 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=7SxbxVIQCHnLKYNw7JPTlbeXM/42LDVc5gzY5r0erRM=; b=OK1w5hb76pqpZq5hp9cOOD/AjRnBWW/O5tbzv3l2OumeUAfBdOqS6JC3oesalr75qvT2bEMjuD+O8g1/GVIjcVlykuXJCxfFQ4VeK51NayMdhfOa6EQFdOM8exoaSMzK3bxIYfxiN1rzevacxwJggAnXTDuq3PFXgxF3b3IXKj9N0r61/8J89KrKvDoNo6YY2EdErZnDw+5cSaPFcMfYAiP8jEG/OgttHj8amzUGK53WBTWCNVcCN1HmT4kO2ZODBCuqg3Oaq3CLmZFiJDyFtLAZg+JjpO3uc6UA9yY42is+/C+YXXF2QSSq3c4l2XSudwXnZ5PX8DfQD4nya3oADg== 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=7SxbxVIQCHnLKYNw7JPTlbeXM/42LDVc5gzY5r0erRM=; b=DcqQ5rGXiHkYNVQarn90DjtCAykZRr0OV8UjIs6Na/EHZpPpMg3IFJ2W91W3rN9I7WJ76bvOFnN6DDnGU5L4QqtMSdUXvuNqANfxiCweiNrNBQg+U8id1Yk9XwyzkEmTSDRxXcb1UpJgZY+hdYkFBI3ssc4Ftp4k0MjB9wWS32t5cDVxQzaeaX2/bmDy/+EDQuEnhnMGvGrxjg8nWMXygQHFAe6XZiNij8vRID8p99AexZQwyEhnPGY/gN0oE6VoAcOiKgf51xYF8VX2AG3DJNGqhXAhtbn54KhTRZdCdeKm/IHFD86URuGz2LBEF75ews0kqu1vVSegOwlRAMNXPg== 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 GVXPR04MB10022.eurprd04.prod.outlook.com (2603:10a6:150:11a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 16:49:15 +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; Mon, 9 Dec 2024 16:49:15 +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) Cc: imx@lists.linux.dev Subject: [PATCH v2 1/2] thermal/drivers/qoriq: Use dev_err_probe() simplify the code Date: Mon, 9 Dec 2024 11:48:58 -0500 Message-Id: <20241209164859.3758906-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR05CA0100.namprd05.prod.outlook.com (2603:10b6:a03:334::15) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB10022:EE_ X-MS-Office365-Filtering-Correlation-Id: c6c558d9-36a8-4b27-ee75-08dd18716a82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Zc9trhIxAoCXSwt0PrUoAw3QYzw55aZH1yl7Syf2G6EAilPqrae/STAqDa1T/SzhFTdT6vcZfTJdFWzrNTPbBIs4xn9x7/qC7aijitrUv59MutiXi6CSHbkcI7MfVMS4XsmWyGdQUaQIUOLgZbs7QTgw0hTsToe4QEKvuMn/FBM+cObN2vW5OyWvIuOonn7mwIHl3tgo+br3dX4RR2xbQYYcsZWlb2ANtjyhjC1/FBysktn7AYrcNkt0Yo34JJlICrq3/9o6A+Zp6fIs4FID3bG7v/2PTNPWF3t36JxTWeoGq4aU7AzMa0DLOwuBiKeOBbdfjLnTJh2eBte7psLQWbjuY/IZzfukXamcl2HYAZnQkURWLAYHFFgua2jeWmHsEFs2Is4tqNwG7+2J6gAymVA5di52YPCyM9RRY22OZFWOGvLDVnaaFmY27OS/m7IvPx/AkQo5Ryutom8wL9lOrrjVQmD2KXb+LF+BwnCqjebW1oTx9wCuIaPWHaQupqjb9EYGCFZKecqbmDM3H4w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Sxs6lMkaOSYhP7KpGT4Fj8jC+VppqPXLDQ7GntIBD5PYv9lagR22+RqCmQiFZ+/pW55nwVtJP8bxo338NFybIfmuq3toorT/RKnL+iABtQfIx+6S679t7Mzj07AL5PxEoV7ChMrVcmU1tW+jRAwrL8RvwevX3eRAjLdOzZn9RH7utQN4X8fKwOCgIYx73dd2/mBozyT1DoiiQfcYcRYXx4SnkY+Dqo4G4oXCqfW0Ab/Ag3qauvWuTIiKzhqq3EWCybmjqNIcKPdurJy/RutEB6VABkR6YOryNwJ4H4QeGaqSrAVaNNos8jo+7CPCVb/bEB1I96NdshaYO7r7rDwno3x5gWmmkl+MclBXkomP74WVW9RqU7cpEGTMqtLW3ZgvrUPc+CN6ZOnvdmn/SQzbIu4pUDhkgCSXaKDGAVMJEqTwtFfayL7cWRSx/X4sia4iPicCL67OehC1q5pIpYENdjw8di4RhVhqfT4rsWL6lr9gmDyFwHyzFNPjldeJ8zgPZNPJmMvas4ZZQqEgY+wIxba/UNkz2/NTJpUu9nJhZmaymw= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6c558d9-36a8-4b27-ee75-08dd18716a82 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 16:49:15.5100 (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: fOj7MpJ/H8EDf6vZnc4gqC2DRZzXk6+1u4C0mTy/EGDHZm6oE++6RemcvHESnJDGaTLVjX86V9EBoF8Ef57rmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10022 Use dev_err_probe() and devm_clk_get_optional_enabled() to simplify the code. Signed-off-by: Frank Li --- change from v1 to v2 - Remove clk_disable_unprepare() in qoriq_tmu_action() --- drivers/thermal/qoriq_thermal.c | 34 ++++++++++----------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 52e26be8c53df..183af15c33769 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -265,7 +265,6 @@ static void qoriq_tmu_action(void *p) struct qoriq_tmu_data *data = p; regmap_write(data->regmap, REGS_TMR, TMR_DISABLE); - clk_disable_unprepare(data->clk); } static int qoriq_tmu_probe(struct platform_device *pdev) @@ -296,38 +295,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 +325,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 Mon Dec 9 16:48:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13900053 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060.outbound.protection.outlook.com [40.107.20.60]) (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 9616314884C for ; Mon, 9 Dec 2024 16:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733762963; cv=fail; b=C9IYx9JsnHFrwYMo+U0sBYTPNgojeE0fAgOBFjYG6ZBrZ3b+0DoI/bnvzAM4qvtGJ3i58CnR/cA4zPQnmT4toxhiRNZdDMyAQ/j408fyRmJwYX0rmTEm5K1HKp3CI2gVdVQDLfozDtdbMuQ1V8yf3v4DkhNhmKDTz8jQsqWUbIM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733762963; c=relaxed/simple; bh=omUIftEP7o+HSDpUoFWR2C6XUlYLpqYpuOa+jDZd1Mw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SAgSsbYu+l6D6uA7ZxyU8nTKaqyNsjon82pzwTnha00/OZiCXEL32GNM6cLNEDPpE7tc8IsfCaWRswaV0+pAB9NmYUMmpvnQ53l8RwpvJ8J9da3wmQLlXWW3MASdg976SzzjqUgCc2POb8T9TDs5wnC3YkZA6KUUXrUfTFR5AFo= 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=RpS01W+V; arc=fail smtp.client-ip=40.107.20.60 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="RpS01W+V" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pJ3gTaO1xTE/+4sxLEHHfBiL/kKsBCwetVRBGJCWdBB1vZHjuOMiZGp4nBrvlm4JN024t8Mll6x6H8i6hsXTinsE0rMjopENM9GYRYyBghBRMSupNy2dqvW/RFU689iBr3rQEiir8aB88qCFc22VMVes2K0DSJ0BBtWvBYXCrPj4dpQuVL1zyw82avhLBLUMQIQh3O+x3wNEqm/dgO1sEQYAzW7i+lH5KsQF8qY5EwsFrFXHJ1sVPsq90LkdAUcLzJYKKUkt/MrGJMANEvarhHZyuEEpVtJB4gLFrpdUJIrBBQ2O86g4RhxjewDnsVrTP9CMOaMCQD9hcUjICwYKww== 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=fGmHhO2fhYcq9dZEIXaDKnN4Ef3FSlUM6IqNGPiIur0=; b=XX3N5a3uT5A3oXQZDkNWB6yql6ar2SjD+eHJPB5oO1gySNjPAOWWQ5dQcellNJ6mn9JOWbcMkcxIEUecLctSy5nlnO6YIzDXUmMlQgta8MlavPJr5KE7upQxr7g9uq6cW1bPOPXBDCJzYAULlkeKELLvPdp8LahFtQdg2IS87V3Tmkb9rYOaQ+FLCaDHmdnt6EXfZDqY3dQntQx21PX0OFFzxUs2K4edh71/QVtqAw4iCmcitjcPrmS5useGAe6ZHzbM2jKG8mz+VBiy1tKHXXBdsv+urtZEotZMElql8XbJZK41WiWF5Tnb85t3YlinfmAHFu8kgtiQ1QI109tIgA== 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=fGmHhO2fhYcq9dZEIXaDKnN4Ef3FSlUM6IqNGPiIur0=; b=RpS01W+VFW2vjNQhaM+LabdePMSpxgFLmzBALjUe4G43XfUSPAXiSmD1uD81UW4oy8LcphbnJ7gY59jEjqXAR8cTB3gfCnAamBI5SjDw5PXu2b2OfDhbremqIGTdVVdf9XlFjXGjmFsDXInPkMAPQoAdUym7P/TEaymsp02JrarilcaK6xx83BPvGWymi2cBUZjitArfiunEhO7t0OOvB0azb61n8VfO9HdX5fRHhvui07utD/T5aPPU97Y72v6SAY/F1xtzx1jvz1b3JnWDUdit3B55kjKwbadlcqi1CRNnlL6nsr5dF15+NalFr1cQ/vC9RyJXA4en4FoyJKEXzA== 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 GVXPR04MB10022.eurprd04.prod.outlook.com (2603:10a6:150:11a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 16:49:18 +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; Mon, 9 Dec 2024 16:49:18 +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) Cc: imx@lists.linux.dev Subject: [PATCH v2 2/2] thermal/drivers/qoriq: Power down TMU on system suspend Date: Mon, 9 Dec 2024 11:48:59 -0500 Message-Id: <20241209164859.3758906-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241209164859.3758906-1-Frank.Li@nxp.com> References: <20241209164859.3758906-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR05CA0100.namprd05.prod.outlook.com (2603:10b6:a03:334::15) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB10022:EE_ X-MS-Office365-Filtering-Correlation-Id: c5a8a512-42ca-4960-5b09-08dd18716c33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: NqFJbPWaIEgPRUms/0DfUoPhHVn631Ioole7ehateJj5LMSN1MA+q0Z081hwWZtH4ZqSgUDm9WqDWav3Tls6uUP6zsb1hmwG7Vfsi69uBu04Fwy51NBZiI51F4ZGqw1feX/eZTPIGId5T1JKpDehxxRToSvlVQpZYVMD3mxEcbejQZREuPIhk6zF+8SiAILTKUd7cKuQrQb/VZ50vR1H6c/O4xefhP+lCNC1y/hfd1UUCJ4zZqNo3gO1hY/IKzht2z9mOi/ESWHLnGfDA7yIHGbOFuo/xC/l0h6CEku3Gkn+HGnirHpgNJ6dBHZqHOjGRi7og/qQ7JWGc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B1mMRS0N3w== 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)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EEzlCFaRX5/7eyv2lkX+mAQvOSRRYVywmXwtpqcr+YHBEGwHLli2qqi5SMgHj4rhBiRrnm5la4p7UMn8Nwm1ChIiE2ehdreNT/ZjgNIu9NxqiKWVCzv7SPqL/4x0hi2C6iIlXCRY3/oZ+ArpCR9BDNVxf49MlUBad1Z5TUJncnxSn8N79u1gAPoKUUbTFwfo6dYp8bVaetaePkPLeauosUUfMzszv8rayZXHrjRZbSDF3VcnTnqxm1r8cGpT87Pv6BetDXhuwR7VeAZzUIAlzFAzKesDG1nGQn/wGaox/aDBSR9faYmcb8H1CgXJNp6A02gija3Yx+rO6OHngUhAiCVZD0Hz6f6+0JJnLCNN3Z9HbPuYppKlW77XX3s9NAESLsyrGfO8tTmrUzBYQqrXPk87xFHHuPlx4G/vNj189R420K+7McTw7bl/0jBSAHYdMddEv5sB+DlNTvxvj3xTS8kfcU8eIOloGa6fk7IckTjGih86HVDI8oYTQV1BR+XkGN+UERzMJXlAKT5TM0YrMJ7cej9iRr+4foHfaFe/pNDRCXbpLFQ4Bx8zoGeEfCBOehToWhkgKwpw5Aapk4/1V/Hhce0VdtBddUqIEhYvoianmHHBsZEEtiOXM6oJIFRXXfGgHuX+67fos7IKHfvP35L+EB1Xc/9v43Q0XueMB9H+nXyd6Uyj1JFWgGEqAIj3qrhWqhMDpCYqQLQPPlzrv6p6a5+qbkGVe3afxdXr2Zv4yv0eVRA2p8cnnMk6Ef/3wB+Vje4TtkOw/+c+/YecpXzqd6p/Tz3CbnXOeBQlZOm+3E+HD+OXBHhybsRgbe7jHjUQzsK+7PZodUwGAw3Vw61ImHE7Ho3R1nVTHxNs2XCpU2NbTeArHrut9Vcd0YMpp/MuINKmuDw2EDVOvI+WrQFh50fAhVL0wZOBxwotSw93/LTOIwxYZYH0HtdsybaejExVbjcLNAMfvPOHU6RDAmUBVrMDIAH4nojh5fuq6n0DCYLo2fr+bysudIw9cznMdLd0k0cJB5TXf8E95HwifWRsx8x0P0ZJCrbqogaFIb2/13Igf4x54FK3IMwV30T3sR7XzqBYt/3fpyx1/VlVUCeTm8QQhdBfpeJGlrr4Bon6F831SyQf5L3BjoZHsL4SkvXpgpGledm+wCm47iQ+KGKt9ngZ42zedNHbPLyjulPNPhjsdM63rOb+gb14vNwQHAfw10Q8T342klpq2/CT+3UjM+8k5QeBxrFAz7vbVX8Mg9IjVywrBHI7DaV375ElL1nhjjAfzMbBHGrBFGlfw1atzPQ9SV0Yvm7b45kGg+hcWmB0JWwjSEat3nZgw5AK7pCl0xocNGvJiQ+mpugYvD8rF6/xoXXXPmR+fG+349LP+sBAxPt4+QT839CevwtGks/ogAsHDCyDdf9JtG9IwmWJkb3p3ZMuc2X1ru9EKowQM2ZMIo5uLlI0SRPncN9AX/y23+8jwURtY7EWx3IV6gGpWJlwFkGXtJcBpppDX7z+dqbF9sj7SxsabOWSXf4gMqBnbczuUgce+ALsdXVfwvnzl1LQbEHYn8hWNCqVoak= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5a8a512-42ca-4960-5b09-08dd18716c33 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 16:49:18.3811 (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: x74o31c2O+Y3OZTqv5P5JjduuwDU6nnyTok1D2DA0BlwjJJHHBuKwTUzZ+Sw7LAKe2B9yh25p3lCnmDoGutGCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10022 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 --- change from v1 to v2 - none --- 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 183af15c33769..01b58be0dcc64 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 @@ -342,6 +343,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; @@ -356,6 +363,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); }