* [PATCH] clocksource/drivers/timer-ti-dm: Clear settings on probe and free
@ 2022-10-28 10:38 Tony Lindgren
2022-12-09 15:47 ` [tip: timers/core] " tip-bot2 for Tony Lindgren
0 siblings, 1 reply; 2+ messages in thread
From: Tony Lindgren @ 2022-10-28 10:38 UTC (permalink / raw)
To: Daniel Lezcano, Thomas Gleixner
Cc: Grygorii Strashko, Keerthy, Ladislav Michl, Nishanth Menon,
Suman Anna, Vignesh Raghavendra, linux-kernel, linux-omap,
linux-arm-kernel
Clear the timer control register on driver probe and omap_dm_timer_free().
Otherwise we assume the consumer driver takes care of properly
initializing timer interrupts on PWM driver module reload for example.
AFAIK this is not currently needed as a fix, I just happened to run into
this while cleaning up things.
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/clocksource/timer-ti-dm.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -633,6 +633,8 @@ static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *n
static int omap_dm_timer_free(struct omap_dm_timer *cookie)
{
struct dmtimer *timer;
+ struct device *dev;
+ int rc;
timer = to_dmtimer(cookie);
if (unlikely(!timer))
@@ -640,6 +642,17 @@ static int omap_dm_timer_free(struct omap_dm_timer *cookie)
WARN_ON(!timer->reserved);
timer->reserved = 0;
+
+ dev = &timer->pdev->dev;
+ rc = pm_runtime_resume_and_get(dev);
+ if (rc)
+ return rc;
+
+ /* Clear timer configuration */
+ dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
+
+ pm_runtime_put_sync(dev);
+
return 0;
}
@@ -1135,6 +1148,10 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
goto err_disable;
}
__omap_dm_timer_init_regs(timer);
+
+ /* Clear timer configuration */
+ dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
+
pm_runtime_put(dev);
}
--
2.37.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip: timers/core] clocksource/drivers/timer-ti-dm: Clear settings on probe and free
2022-10-28 10:38 [PATCH] clocksource/drivers/timer-ti-dm: Clear settings on probe and free Tony Lindgren
@ 2022-12-09 15:47 ` tip-bot2 for Tony Lindgren
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Tony Lindgren @ 2022-12-09 15:47 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Tony Lindgren, Daniel Lezcano, x86, linux-kernel
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 822963b96dfdb72ec4fb1395fbdfa778656b49d1
Gitweb: https://git.kernel.org/tip/822963b96dfdb72ec4fb1395fbdfa778656b49d1
Author: Tony Lindgren <tony@atomide.com>
AuthorDate: Fri, 28 Oct 2022 13:38:13 +03:00
Committer: Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Fri, 02 Dec 2022 13:16:46 +01:00
clocksource/drivers/timer-ti-dm: Clear settings on probe and free
Clear the timer control register on driver probe and omap_dm_timer_free().
Otherwise we assume the consumer driver takes care of properly
initializing timer interrupts on PWM driver module reload for example.
AFAIK this is not currently needed as a fix, I just happened to run into
this while cleaning up things.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20221028103813.40783-1-tony@atomide.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
---
drivers/clocksource/timer-ti-dm.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index eeeeb3c..b24b903 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -633,6 +633,8 @@ static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *n
static int omap_dm_timer_free(struct omap_dm_timer *cookie)
{
struct dmtimer *timer;
+ struct device *dev;
+ int rc;
timer = to_dmtimer(cookie);
if (unlikely(!timer))
@@ -640,6 +642,17 @@ static int omap_dm_timer_free(struct omap_dm_timer *cookie)
WARN_ON(!timer->reserved);
timer->reserved = 0;
+
+ dev = &timer->pdev->dev;
+ rc = pm_runtime_resume_and_get(dev);
+ if (rc)
+ return rc;
+
+ /* Clear timer configuration */
+ dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
+
+ pm_runtime_put_sync(dev);
+
return 0;
}
@@ -1135,6 +1148,10 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
goto err_disable;
}
__omap_dm_timer_init_regs(timer);
+
+ /* Clear timer configuration */
+ dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0);
+
pm_runtime_put(dev);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-09 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 10:38 [PATCH] clocksource/drivers/timer-ti-dm: Clear settings on probe and free Tony Lindgren
2022-12-09 15:47 ` [tip: timers/core] " tip-bot2 for Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®