OMAP: hwmod: Do not disable clocks if hwmod already in idle
authorBenoit Cousson <b-cousson@ti.com>
Tue, 21 Sep 2010 16:34:08 +0000 (10:34 -0600)
committerPaul Walmsley <paul@pwsan.com>
Tue, 21 Sep 2010 21:10:52 +0000 (15:10 -0600)
The disable function was disabling clocks and dependencies
from both enable and idle state. Since idle function is already
disabling both, an enable -> idle -> disable sequence will
try to disable twice the clocks and thus generate a
"Trying disable clock XXX with 0 usecount" warning.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-omap2/omap_hwmod.c

index 8bf19a7efb5c4e4cfc8614f5350e637968a7f537..5bb25e319b76a7a07a059071401459e5b1d28843 100644 (file)
@@ -982,9 +982,13 @@ static int _shutdown(struct omap_hwmod *oh)
 
        if (oh->class->sysc)
                _sysc_shutdown(oh);
-       _del_initiator_dep(oh, mpu_oh);
-       /* XXX what about the other system initiators here? DMA, tesla, d2d */
-       _disable_clocks(oh);
+
+       /* clocks and deps are already disabled in idle */
+       if (oh->_state == _HWMOD_STATE_ENABLED) {
+               _del_initiator_dep(oh, mpu_oh);
+               /* XXX what about the other system initiators here? dma, dsp */
+               _disable_clocks(oh);
+       }
        /* XXX Should this code also force-disable the optional clocks? */
 
        /* XXX mux any associated balls to safe mode */