[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231110100726.2930218-3-vigneshr@ti.com>
Date: Fri, 10 Nov 2023 15:37:26 +0530
From: Vignesh Raghavendra <vigneshr@...com>
To: Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>
CC: Tero Kristo <t-kristo@...nel.org>,
<linux-watchdog@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Vignesh Raghavendra <vigneshr@...com>,
<linux-arm-kernel@...ts.infradead.org>, <afd@...com>,
<n-francis@...com>
Subject: [PATCH 2/2] watchdog: rti_wdt: Drop RPM watchdog when unused
Do a RPM put if watchdog is not already started during probe and re
enable it in watchdog start.
On K3 SoCs, watchdogs and their corresponding CPUs are under same PD, so
if the reference count of unused watchdogs aren't dropped, it will lead
to CPU hotplug failures as Device Management firmware won't allow to
turn off the PD due to dangling reference count.
Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
Signed-off-by: Vignesh Raghavendra <vigneshr@...com>
---
drivers/watchdog/rti_wdt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index 163bdeb6929a..87f2c333a41d 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -78,6 +78,9 @@ static int rti_wdt_start(struct watchdog_device *wdd)
u32 timer_margin;
struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
+ if (pm_runtime_suspended(wdd->parent))
+ pm_runtime_get_sync(wdd->parent);
+
/* set timeout period */
timer_margin = (u64)wdd->timeout * wdt->freq;
timer_margin >>= WDT_PRELOAD_SHIFT;
@@ -337,6 +340,9 @@ static int rti_wdt_probe(struct platform_device *pdev)
if (last_ping)
watchdog_set_last_hw_keepalive(wdd, last_ping);
+ if (!watchdog_hw_running(wdd))
+ pm_runtime_put_sync(&pdev->dev);
+
return 0;
}
@@ -345,6 +351,9 @@ static void rti_wdt_remove(struct platform_device *pdev)
struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
watchdog_unregister_device(&wdt->wdd);
+
+ if (!pm_runtime_suspended(&pdev->dev))
+ pm_runtime_put_sync(&pdev->dev);
}
static const struct of_device_id rti_wdt_of_match[] = {
--
2.42.0
Powered by blists - more mailing lists