msm: clock-rpm: Support clock dependencies for enable/disable
In order to do this, we must fix up rpm_clk_enable() to properly
roll back RPM calls in the event of errors. Otherwise, the
dependency could be disabled while an RPM clock needing it is
still enabled.
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-rpm.h b/arch/arm/mach-msm/clock-rpm.h
index 3490143..0a99a6d 100644
--- a/arch/arm/mach-msm/clock-rpm.h
+++ b/arch/arm/mach-msm/clock-rpm.h
@@ -37,7 +37,7 @@
return container_of(clk, struct rpm_clk, c);
}
-#define DEFINE_CLK_RPM(name, active, r_id) \
+#define DEFINE_CLK_RPM(name, active, r_id, dep) \
static struct rpm_clk active; \
static struct rpm_clk name = { \
.rpm_clk_id = MSM_RPM_ID_##r_id##_CLK, \
@@ -48,6 +48,7 @@
.flags = CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN, \
.dbg_name = #name, \
CLK_INIT(name.c), \
+ .depends = dep, \
}, \
}; \
static struct rpm_clk active = { \
@@ -60,6 +61,7 @@
.flags = CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN, \
.dbg_name = #active, \
CLK_INIT(active.c), \
+ .depends = dep, \
}, \
};