summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaniya Das <tdas@codeaurora.org>2015-12-21 13:57:58 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:16:08 -0700
commitdb1150ac25b8f8cc4ec459795dfdfd44593960b4 (patch)
treead2286464757c44d0f54247fe4ad240e55353103
parentb554ca06c9a18a70dd881d3507bac2937104b8f8 (diff)
clk: qcom: clock-generic: Fix handoff for mux_div clock
The current implementation would check for the parent rate and decide the handoff state of the clock, which is not true for mux clocks. With this logic the function returns 'enabled' even when the clock downstream of this clock is disabled. The handoff code will unnecessarily enable the current parent of this clock. If this function always returns 'disabled' and a clock downstream is on, the clock handoff code will bump up the ref count for this clock and its current parent as necessary. The clocks without an actual HW gate can always return handoff disabled. Change-Id: I1f06842e2761b336b49a9390a556064de44f2e36 Signed-off-by: Taniya Das <tdas@codeaurora.org>
-rw-r--r--drivers/clk/msm/clock-generic.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/clk/msm/clock-generic.c b/drivers/clk/msm/clock-generic.c
index dbe378407885..087beacd55a7 100644
--- a/drivers/clk/msm/clock-generic.c
+++ b/drivers/clk/msm/clock-generic.c
@@ -865,8 +865,6 @@ static enum handoff mux_div_clk_handoff(struct clk *c)
unsigned int numer;
parent_rate = clk_get_rate(c->parent);
- if (!parent_rate)
- return HANDOFF_DISABLED_CLK;
/*
* div values are doubled for half dividers.
* Adjust for that by picking a numer of 2.
@@ -880,10 +878,20 @@ static enum handoff mux_div_clk_handoff(struct clk *c)
return HANDOFF_DISABLED_CLK;
}
- if (!md->ops->is_enabled)
- return HANDOFF_DISABLED_CLK;
- if (md->ops->is_enabled(md))
- return HANDOFF_ENABLED_CLK;
+ if (md->en_mask && md->ops && md->ops->is_enabled)
+ return md->ops->is_enabled(md)
+ ? HANDOFF_ENABLED_CLK
+ : HANDOFF_DISABLED_CLK;
+
+ /*
+ * If this function returns 'enabled' even when the clock downstream
+ * of this clock is disabled, then handoff code will unnecessarily
+ * enable the current parent of this clock. If this function always
+ * returns 'disabled' and a clock downstream is on, the clock handoff
+ * code will bump up the ref count for this clock and its current
+ * parent as necessary. So, clocks without an actual HW gate can
+ * always return disabled.
+ */
return HANDOFF_DISABLED_CLK;
}