]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ARM: OMAP2+: Fix dmtimer set source clock failure
authorJon Hunter <jon-hunter@ti.com>
Fri, 13 Jul 2012 20:12:03 +0000 (15:12 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 19 Sep 2012 14:04:26 +0000 (15:04 +0100)
commit20ac628bdcdd48828bdca10e91a8ef29a9aae527
treee5e41b23f46a47978dae8f9bea125be5cc5a5a58
parentccd2951d12243c68b49654b14d54af7821c5eeaa
ARM: OMAP2+: Fix dmtimer set source clock failure

commit 54f32a35f4d3a653a18a2c8c239f19ae060bd803 upstream.

Calling the dmtimer function omap_dm_timer_set_source() fails if following a
call to pm_runtime_put() to disable the timer. For example the following
sequence would fail to set the parent clock ...

omap_dm_timer_stop(gptimer);
omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_32_KHZ);

The following error message would be seen ...

omap_dm_timer_set_source: failed to set timer_32k_ck as parent

The problem is that, by design, pm_runtime_put() simply decrements the usage
count and returns before the timer has actually been disabled. Therefore,
setting the parent clock failed because the timer was still active when the
trying to set the parent clock. Setting a parent clock will fail if the clock
you are setting the parent of has a non-zero usage count. To ensure that this
does not fail use pm_runtime_put_sync() when disabling the timer.

Note that this will not be seen on OMAP1 devices, because these devices do
not use the clock framework for dmtimers.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm/plat-omap/dmtimer.c