From patchwork Thu Aug 25 08:32:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alice Guo (OSS)" X-Patchwork-Id: 12954364 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 D21C9C04AA5 for ; Thu, 25 Aug 2022 08:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236525AbiHYIcx (ORCPT ); Thu, 25 Aug 2022 04:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234992AbiHYIcw (ORCPT ); Thu, 25 Aug 2022 04:32:52 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2047.outbound.protection.outlook.com [40.107.22.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2E45A5C5B; Thu, 25 Aug 2022 01:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KBFIBcQnw5i93inwyHBQ5bNCVBk6dHincKhnsWqHDXriTBU0+YwowXFAqVIt8mE16/ybndWYvprXq8WcaG/sTRHsn5bKoI1JcuxBHkTxV73ItYitw+WBodZUDXmLee7JVOj3onbvB2I8RM15Z4J4wnJT/fbnQb3lcGFaSVS4eHN1n7O3L+fd3e/I8286kXm2jaS1OdgxyodO9yuzSifek/196fzo6+wfM6TrwfoKDkMKscEN6DHd0t2PDo+xYwKuNpP31ZC23Z9zNwaB18EZwZkJuogQH+9dZZMUoXRUa8CFT22PmMJUUT1swgVmjSq/KzeVUC1YWBt84WLJr2Ezfg== 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=akDfNw95eqR6I7DNNZM4xG36aZqW3v9+dobNicjVgrY=; b=KkUjBepvq6mCEI9Pp6rBnvWHqITzQtAdR0fHfOJhfAXMFhZNCwf3Bk+JMOyH35z7xqEDJttgcobjRH5nNghQyT9MU3tUv2s7MAJXju30IYdssqH2xEBUxBhmBRdJZrLM+s/Cyug9VhOwy9Un/kMOf5R3WDOMuq60sdraDDiPUTL4nEWrIHviZ5aOB+J4sRoswr4Vx5gpJGk0WR259/mGG2TBgl4vyolR+3Cr2rK4Zut8RQjDs58W4J2aJeXR9ZbypSdjQYBYBeuUJXTehxnrAgA+sRDATKkZtPRAnU1WZWRa4iHAkYGcEogdVaHcZjiRPrPHf7etXQTtMvVfTCZbJg== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=akDfNw95eqR6I7DNNZM4xG36aZqW3v9+dobNicjVgrY=; b=brWQ0AAUA5KglOIkgMNFoZEavCbPz29CWaVDGoF3FXGyDCyf07CyZKs8X5DYVmeZgf6I9nJ48g4OBcKa35AFLIhzBzdBKmfUFK7dwU9zc78rADFmB4zBIS7ojnUT0ajROhuwA3Gni3RbGwcL3AjUtnmYmIVJvHvSrT8u9zot0g4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB6053.eurprd04.prod.outlook.com (2603:10a6:20b:b9::10) by AM6PR04MB4901.eurprd04.prod.outlook.com (2603:10a6:20b:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 08:32:47 +0000 Received: from AM6PR04MB6053.eurprd04.prod.outlook.com ([fe80::6cd5:f11c:4e5c:d79c]) by AM6PR04MB6053.eurprd04.prod.outlook.com ([fe80::6cd5:f11c:4e5c:d79c%3]) with mapi id 15.20.5566.015; Thu, 25 Aug 2022 08:32:46 +0000 From: "Alice Guo (OSS)" To: m.felsch@pengutronix.de, linux@roeck-us.net, wim@linux-watchdog.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/7] watchdog: imx7ulp: Move suspend/resume to noirq phase Date: Thu, 25 Aug 2022 16:32:50 +0800 Message-Id: <20220825083256.14565-2-alice.guo@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825083256.14565-1-alice.guo@oss.nxp.com> References: <20220825083256.14565-1-alice.guo@oss.nxp.com> X-ClientProxiedBy: SG2PR06CA0225.apcprd06.prod.outlook.com (2603:1096:4:68::33) To AM6PR04MB6053.eurprd04.prod.outlook.com (2603:10a6:20b:b9::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73514314-bcec-4f8f-c402-08da8674634f X-MS-TrafficTypeDiagnostic: AM6PR04MB4901:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5o8J4sxZ85P8ZX0u818vmdlQaP3hnW7gmeRj7bX/gFGYifDd6o1FfCpVPWhcR1ZkvBC58GpmqW+2UAwQrL3Nxq+AQkTs4ywkiadaD7xbgjxCZFZZnwmBTzKfPdZQivXFnX7qqz0WDYQdzC8QDhHMDArFkK8ZMtyQkrxxqYJmZ/aYcvWQmlht17OqHWp5NM9qgYNEyB3hWj/wEQndwDpUVr0XtHRR5WJ8vSH+JtsGiyL35siO585fKb4teUMJEARkVCBS8CyIw38Ma6mrKgboxf2EQHvhYNSc78upJWalE7baGhlW/mRs2/YFo98Mr7GchXWE/Kia/wFOrHcKMMyRvCR4OFhkXqeXuYaImJj6SZr73PpEdaEsrnZYwMtak9wEPvL6ix9dJo9lHonZicblZsgjB8G+rrRND9XnqER7VNnRTQ0VobzBi+cvn+YsF8PzpE4JKRReqIBpt5OhNQTVlANZBMzYZOEP1Onq+niqakmTxwTOOy4dJRE33Ux31uN8C+nj+JkdcQvCHWxiUwZTvYlcAvtEEE6+1+bzDGS6afxyLWDbDSkcvsbfAQGpxn9ojv262z1PCcRj+YPP4Ju5EHcyN3Fj4DpPOWpSUTQxlk8IXU0zFFxHFWDBpYujweeguASWD34jHe+03NYwRSi1o0W8fpnaijz4ng1SwCpUUIYCJK73C2XJEZO4UEPPL3WafK01X7wFhU3r/DfUN7ZKBY3OTu5BPpcCF99axKF4ds5vbtbWItOwBZdkxKELJ+SVC2IBVvk5GUvvpeLy05Fdxg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6053.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(376002)(136003)(346002)(39860400002)(396003)(8936002)(5660300002)(7416002)(38100700002)(38350700002)(4326008)(66946007)(66556008)(66476007)(478600001)(8676002)(6486002)(15650500001)(6666004)(41300700001)(316002)(2616005)(186003)(1076003)(26005)(6512007)(83380400001)(2906002)(52116002)(6506007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-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wOXJmFZdSFHCUTxAMlQox2nwcMNiyrETZOM7WEPk6KkDpKtoI/gQvF32vw6qbMMxyaT94jRP/NM5ln5xcqAR0DUb0BEiLRmtSUBuXCRoFOZApP4mmE2DVPQ+sqR45SjJr8GM24G3L4FjP668LCeReuzRO3u0AmEB0QkL650vREFI6Qg0itWwsS/L6U9Ord1ln5Wqug50qvyJ+mBNw1L1+KnPqWXCRwUsGfhTl24SBjaofyPmDNtYkeOAkOYjbrMxUpbkmpn42zCvSf9OPIhQmWsGClKBZJOXCmrhBu9UUk6aSoScZEz8YU7JCq9h8tO/CCRRwA5YAIevbK9wyuv1nNIP7+YuOEYUEuyXTnsDbI4VvV96jIVp6wpSaJQM83V4yPs5K9svwhXIsPn5T4aB05qg6icb0jaNwsDHAHB7F7SAIZRxTsTuxyaBKOAhWQzeSKrn54wnqmJJQh99+b/ikgenevGeXOPqZZ4hLZx87jrBd+20LntPyD2roo+6/9XkYAt2tzrUHrzlHfC50 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73514314-bcec-4f8f-c402-08da8674634f X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6053.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 08:32:46.8721 (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: UChGg1OrstGaTE6N/clgO13xWFLg0BbXIi7X+KlHW0X6KyXwbfzKYMgdhhwbTyFHiZnPaPj4u5gSJNo1QrgdFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4901 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Anson Huang The i.MX7ULP's watchdog is enabled by default when out of reset, so the resume callback which is to disable watchdog should be called earlier to avoid unexpected timeout, move suspend/resume callback to noirq phase. Signed-off-by: Anson Huang Signed-off-by: Alice Guo Reviewed-by: Jacky Bai Tested-by: Peter Chen Tested-by: Li Jun Reviewed-by: Guenter Roeck --- Changes for v2: - none drivers/watchdog/imx7ulp_wdt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index 922b60374295..014f497ea0dc 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -255,7 +255,7 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev) return devm_watchdog_register_device(dev, wdog); } -static int __maybe_unused imx7ulp_wdt_suspend(struct device *dev) +static int __maybe_unused imx7ulp_wdt_suspend_noirq(struct device *dev) { struct imx7ulp_wdt_device *imx7ulp_wdt = dev_get_drvdata(dev); @@ -267,7 +267,7 @@ static int __maybe_unused imx7ulp_wdt_suspend(struct device *dev) return 0; } -static int __maybe_unused imx7ulp_wdt_resume(struct device *dev) +static int __maybe_unused imx7ulp_wdt_resume_noirq(struct device *dev) { struct imx7ulp_wdt_device *imx7ulp_wdt = dev_get_drvdata(dev); u32 timeout = imx7ulp_wdt->wdd.timeout * WDOG_CLOCK_RATE; @@ -286,8 +286,10 @@ static int __maybe_unused imx7ulp_wdt_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(imx7ulp_wdt_pm_ops, imx7ulp_wdt_suspend, - imx7ulp_wdt_resume); +static const struct dev_pm_ops imx7ulp_wdt_pm_ops = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(imx7ulp_wdt_suspend_noirq, + imx7ulp_wdt_resume_noirq) +}; static const struct of_device_id imx7ulp_wdt_dt_ids[] = { { .compatible = "fsl,imx7ulp-wdt", },