msm: clock-local: Support enable dependencies for branch clocks
rcg clocks already support implicit enablement of a chain of
dependent clocks. Add similar support for branch clocks.
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-local.c b/arch/arm/mach-msm/clock-local.c
index d71bffa..cc883f0 100644
--- a/arch/arm/mach-msm/clock-local.c
+++ b/arch/arm/mach-msm/clock-local.c
@@ -877,9 +877,14 @@
int branch_clk_enable(struct clk *clk)
{
+ int rc;
unsigned long flags;
struct branch_clk *branch = to_branch_clk(clk);
+ rc = clk_enable(branch->depends);
+ if (rc)
+ return rc;
+
spin_lock_irqsave(&local_clock_reg_lock, flags);
__branch_clk_enable_reg(&branch->b, branch->c.dbg_name);
branch->enabled = true;
@@ -897,6 +902,8 @@
__branch_clk_disable_reg(&branch->b, branch->c.dbg_name);
branch->enabled = false;
spin_unlock_irqrestore(&local_clock_reg_lock, flags);
+
+ clk_disable(branch->depends);
}
struct clk *branch_clk_get_parent(struct clk *clk)
diff --git a/arch/arm/mach-msm/clock-local.h b/arch/arm/mach-msm/clock-local.h
index 58c76e9..a19277b 100644
--- a/arch/arm/mach-msm/clock-local.h
+++ b/arch/arm/mach-msm/clock-local.h
@@ -251,6 +251,7 @@
bool enabled;
struct branch b;
struct clk *parent;
+ struct clk *depends;
struct clk c;
};