]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP: McBSP: Do not enable or disable clocks on failed path
authorEero Nurkkala <ext-eero.nurkkala@nokia.com>
Wed, 18 Mar 2009 11:41:25 +0000 (11:41 +0000)
committerTony Lindgren <tony@atomide.com>
Thu, 26 Mar 2009 22:48:08 +0000 (15:48 -0700)
McBSP clocks are being double enabled in the event the
McBSP is already active. Also, they are unnecessarily
disabled when there's no active McBSP in use. Fix this
phenomenom by enabling and disabling the clocks at the
proper location.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Acked-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/mcbsp.c

index 02b3f2de00e5ac08cbcf0409986dfc86ece3f4dc..e2e8b76483c1b3dfcd09d3cb2e00eb8f1795b461 100644 (file)
@@ -226,9 +226,6 @@ int omap_mcbsp_request(unsigned int id)
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
                mcbsp->pdata->ops->request(id);
 
-       for (i = 0; i < mcbsp->num_clks; i++)
-               clk_enable(mcbsp->clks[i]);
-
        spin_lock(&mcbsp->lock);
        if (!mcbsp->free) {
                dev_err(mcbsp->dev, "McBSP%d is currently in use\n",
@@ -240,6 +237,9 @@ int omap_mcbsp_request(unsigned int id)
        mcbsp->free = 0;
        spin_unlock(&mcbsp->lock);
 
+       for (i = 0; i < mcbsp->num_clks; i++)
+               clk_enable(mcbsp->clks[i]);
+
        /*
         * Enable wakup behavior, smart idle and all wakeups
         * REVISIT: some wakeups may be unnecessary
@@ -319,9 +319,6 @@ void omap_mcbsp_free(unsigned int id)
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
                mcbsp->pdata->ops->free(id);
 
-       for (i = mcbsp->num_clks - 1; i >= 0; i--)
-               clk_disable(mcbsp->clks[i]);
-
        spin_lock(&mcbsp->lock);
        if (mcbsp->free) {
                dev_err(mcbsp->dev, "McBSP%d was not reserved\n",
@@ -329,7 +326,12 @@ void omap_mcbsp_free(unsigned int id)
                spin_unlock(&mcbsp->lock);
                return;
        }
+       spin_unlock(&mcbsp->lock);
 
+       for (i = mcbsp->num_clks - 1; i >= 0; i--)
+               clk_disable(mcbsp->clks[i]);
+
+       spin_lock(&mcbsp->lock);
        mcbsp->free = 1;
        spin_unlock(&mcbsp->lock);