[ARM] tegra: cpufreq: Take an extra reference to pllx
authorColin Cross <ccross@android.com>
Thu, 21 Oct 2010 00:47:59 +0000 (17:47 -0700)
committerColin Cross <ccross@android.com>
Mon, 25 Oct 2010 20:11:47 +0000 (13:11 -0700)
During cpu frequency changes, take an extra reference to pllx so
that it doesn't turn off and on while the cpu is on pllp.

Change-Id: I574d399a67aab21f99473296a29aa1eedc0eedb9
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/mach-tegra/tegra2_clocks.c

index 125881e9fe2245bad30244c8f931d51486c7ae9f..0c3dfc9f0eb206d94992954417131c9d04614cf5 100644 (file)
@@ -378,10 +378,16 @@ static void tegra2_cpu_clk_disable(struct clk *c)
 static int tegra2_cpu_clk_set_rate(struct clk *c, unsigned long rate)
 {
        int ret;
+       /*
+        * Take an extra reference to the main pll so it doesn't turn
+        * off when we move the cpu off of it
+        */
+       clk_enable_locked(c->main);
+
        ret = clk_set_parent_locked(c->parent, c->backup);
        if (ret) {
                pr_err("Failed to switch cpu to clock %s\n", c->backup->name);
-               return ret;
+               goto out;
        }
 
        if (rate == c->backup->rate)
@@ -390,17 +396,18 @@ static int tegra2_cpu_clk_set_rate(struct clk *c, unsigned long rate)
        ret = clk_set_rate_locked(c->main, rate);
        if (ret) {
                pr_err("Failed to change cpu pll to %lu\n", rate);
-               return ret;
+               goto out;
        }
 
        ret = clk_set_parent_locked(c->parent, c->main);
        if (ret) {
                pr_err("Failed to switch cpu to clock %s\n", c->main->name);
-               return ret;
+               goto out;
        }
 
 out:
-       return 0;
+       clk_disable_locked(c->main);
+       return ret;
 }
 
 static struct clk_ops tegra_cpu_ops = {