msm: footswitch: Move to new clock APIs
What was once done by just clk_enable() is being split into two
functions: clk_prepare() and clk_enable(), where the prepare
function may sleep but the enable function will not. The same
is true for the clk_disable() function.
Replace use of clk_enable() and clk_disable() with calls to
clk_prepare_enable() and clk_disable_unprepare(), respectively.
These macros are combinations of the APIs described above and
are safe to use in the footswitch driver since they are not
called from atomic context.
Change-Id: Ic51e17304f0a046d213226b1e93c7f71ef3d9a9b
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/footswitch-8x60.c b/arch/arm/mach-msm/footswitch-8x60.c
index 7f63dc8..cd6e582 100644
--- a/arch/arm/mach-msm/footswitch-8x60.c
+++ b/arch/arm/mach-msm/footswitch-8x60.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -103,7 +103,8 @@
clock->name, clock->rate);
for (clock--; clock >= fs->clk_data; clock--) {
if (clock->enabled)
- clk_disable(clock->clk);
+ clk_disable_unprepare(
+ clock->clk);
clk_set_rate(clock->clk, clock->rate);
}
return rc;
@@ -115,7 +116,7 @@
* we don't try to disable them later and crash due to
* unbalanced calls.
*/
- clock->enabled = !clk_enable(clock->clk);
+ clock->enabled = !clk_prepare_enable(clock->clk);
}
return 0;
@@ -128,7 +129,7 @@
/* Restore clocks to their orignal states before setup_clocks(). */
for (clock = fs->clk_data; clock->clk; clock++) {
if (clock->enabled)
- clk_disable(clock->clk);
+ clk_disable_unprepare(clock->clk);
if (clock->rate && clk_set_rate(clock->clk, clock->rate))
pr_err("Failed to restore %s rate to %lu Hz.\n",
clock->name, clock->rate);
@@ -327,7 +328,7 @@
}
/* Disable core clock. */
- clk_disable(fs->core_clk);
+ clk_disable_unprepare(fs->core_clk);
/*
* (Re-)Assert resets for all clocks in the clock domain, since
@@ -357,7 +358,7 @@
udelay(RESET_DELAY_US);
/* Re-enable core clock. */
- clk_enable(fs->core_clk);
+ clk_prepare_enable(fs->core_clk);
/* Return clocks to their state before this function. */
restore_clocks(fs);
@@ -396,7 +397,7 @@
}
/* Disable core clock. */
- clk_disable(fs->core_clk);
+ clk_disable_unprepare(fs->core_clk);
/*
* Assert resets for all clocks in the clock domain so that
@@ -421,7 +422,7 @@
writel_relaxed(regval, fs->gfs_ctl_reg);
/* Re-enable core clock. */
- clk_enable(fs->core_clk);
+ clk_prepare_enable(fs->core_clk);
/* Return clocks to their state before this function. */
restore_clocks(fs);
diff --git a/arch/arm/mach-msm/footswitch-pcom.c b/arch/arm/mach-msm/footswitch-pcom.c
index 8eec807..c48c141 100644
--- a/arch/arm/mach-msm/footswitch-pcom.c
+++ b/arch/arm/mach-msm/footswitch-pcom.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -92,10 +92,10 @@
fs->is_rate_set = !!(clk_get_rate(fs->src_clk));
if (!fs->is_rate_set)
clk_set_rate(fs->src_clk, fs->src_clk_init_rate);
- clk_enable(fs->core_clk);
+ clk_prepare_enable(fs->core_clk);
if (fs->ahb_clk)
- clk_enable(fs->ahb_clk);
+ clk_prepare_enable(fs->ahb_clk);
return 0;
}
@@ -103,8 +103,8 @@
static void disable_clocks(struct footswitch *fs)
{
if (fs->ahb_clk)
- clk_disable(fs->ahb_clk);
- clk_disable(fs->core_clk);
+ clk_disable_unprepare(fs->ahb_clk);
+ clk_disable_unprepare(fs->core_clk);
}
static int footswitch_is_enabled(struct regulator_dev *rdev)