summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPadmanabhan Komanduru <pkomandu@codeaurora.org>2014-02-24 01:58:26 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:41:13 -0700
commitc888a41e21ffc3b73926270fb773b10ef6e73004 (patch)
tree199c2b5da27fa8c021cbccef62274f20ebb9abce
parent7a625cd32dbae45425527b1ca146348211624ab5 (diff)
clk: qcom: mdss: update resource management in PLL driver
Remove mutex and ref count variables that synchronize the resource enable and disable calls since the regulator and clock drivers take care of maintaining the ref count for each resource. Also, remove resource enable and disable calls from mux_set_rate/mux_get_rate/clk_enable context of the DSI branch clocks to avoid warnings. Change-Id: Ieb32141156afcce008b3555af476c20f888f064b Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
-rw-r--r--drivers/clk/msm/mdss/mdss-dsi-pll-28hpm.c16
-rw-r--r--drivers/clk/msm/mdss/mdss-pll-util.c20
-rw-r--r--drivers/clk/msm/mdss/mdss-pll.c9
-rw-r--r--drivers/clk/msm/mdss/mdss-pll.h9
4 files changed, 11 insertions, 43 deletions
diff --git a/drivers/clk/msm/mdss/mdss-dsi-pll-28hpm.c b/drivers/clk/msm/mdss/mdss-dsi-pll-28hpm.c
index 8e6da378c304..b7c698802ed7 100644
--- a/drivers/clk/msm/mdss/mdss-dsi-pll-28hpm.c
+++ b/drivers/clk/msm/mdss/mdss-dsi-pll-28hpm.c
@@ -94,20 +94,12 @@ static struct lpfr_cfg lpfr_lut_struct[] = {
int set_byte_mux_sel(struct mux_clk *clk, int sel)
{
- int rc;
struct mdss_pll_resources *dsi_pll_res = clk->priv;
- rc = mdss_pll_resource_enable(dsi_pll_res, true);
- if (rc) {
- pr_err("Failed to enable mdss dsi pll resources\n");
- return rc;
- }
-
pr_debug("byte mux set to %s mode\n", sel ? "indirect" : "direct");
MDSS_PLL_REG_W(dsi_pll_res->pll_base,
DSI_PHY_PLL_UNIPHY_PLL_VREG_CFG, (sel << 1));
- mdss_pll_resource_enable(dsi_pll_res, false);
return 0;
}
@@ -147,6 +139,13 @@ int dsi_pll_mux_prepare(struct clk *c)
{
struct mux_clk *mux = to_mux_clk(c);
int i, rc, sel = 0;
+ struct mdss_pll_resources *dsi_pll_res = mux->priv;
+
+ rc = mdss_pll_resource_enable(dsi_pll_res, true);
+ if (rc) {
+ pr_err("Failed to enable mdss dsi pll resources\n");
+ return rc;
+ }
for (i = 0; i < mux->num_parents; i++)
if (mux->parents[i].src == c->parent) {
@@ -164,6 +163,7 @@ int dsi_pll_mux_prepare(struct clk *c)
rc = mux->ops->set_mux_sel(mux, sel);
error:
+ mdss_pll_resource_enable(dsi_pll_res, false);
return rc;
}
diff --git a/drivers/clk/msm/mdss/mdss-pll-util.c b/drivers/clk/msm/mdss/mdss-pll-util.c
index c5d5cf385248..918ff0ad2f95 100644
--- a/drivers/clk/msm/mdss/mdss-pll-util.c
+++ b/drivers/clk/msm/mdss/mdss-pll-util.c
@@ -75,11 +75,6 @@ int mdss_pll_util_resource_enable(struct mdss_pll_resources *pll_res,
struct dss_module_power *mp = &pll_res->mp;
if (enable) {
- if (pll_res->resource_refcount) {
- pll_res->resource_refcount++;
- return 0;
- }
-
rc = msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, enable);
if (rc) {
pr_err("Failed to enable vregs rc=%d\n", rc);
@@ -97,21 +92,10 @@ int mdss_pll_util_resource_enable(struct mdss_pll_resources *pll_res,
pr_err("clock enable failed rc:%d\n", rc);
goto clk_err;
}
- pll_res->resource_refcount++;
} else {
- if (pll_res->resource_refcount) {
- pll_res->resource_refcount--;
- } else {
- pr_err("Trying to disable the resources without enabling them\n");
- return -EINVAL;
- }
+ msm_dss_enable_clk(mp->clk_config, mp->num_clk, enable);
- if (!pll_res->resource_refcount) {
- msm_dss_enable_clk(mp->clk_config, mp->num_clk, enable);
-
- msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg,
- enable);
- }
+ msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, enable);
}
return rc;
diff --git a/drivers/clk/msm/mdss/mdss-pll.c b/drivers/clk/msm/mdss/mdss-pll.c
index b2de68eab067..60b742e2cba3 100644
--- a/drivers/clk/msm/mdss/mdss-pll.c
+++ b/drivers/clk/msm/mdss/mdss-pll.c
@@ -39,18 +39,16 @@ int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
* 1 refcount.
*/
if (pll_res->handoff_resources &&
- (!enable || (enable && pll_res->resource_refcount == 1))) {
+ (!enable || (enable & pll_res->resource_enable))) {
pr_debug("Do not turn on/off pll resources during handoff case\n");
return rc;
}
- mutex_lock(&pll_res->resource_lock);
rc = mdss_pll_util_resource_enable(pll_res, enable);
if (rc)
pr_err("Resource update failed rc=%d\n", rc);
else
pll_res->resource_enable = enable;
- mutex_unlock(&pll_res->resource_lock);
return rc;
}
@@ -191,9 +189,6 @@ static int mdss_pll_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, pll_res);
- mutex_init(&pll_res->resource_lock);
- pll_res->resource_refcount = 0;
-
pll_base_reg = platform_get_resource_byname(pdev,
IORESOURCE_MEM, "pll_base");
if (!pll_base_reg) {
@@ -259,7 +254,6 @@ phy_io_error:
res_parse_error:
iounmap(pll_res->pll_base);
io_error:
- mutex_destroy(&pll_res->resource_lock);
devm_kfree(&pdev->dev, pll_res);
error:
return rc;
@@ -280,7 +274,6 @@ static int mdss_pll_remove(struct platform_device *pdev)
iounmap(pll_res->phy_base);
mdss_pll_resource_release(pdev, pll_res);
iounmap(pll_res->pll_base);
- mutex_destroy(&pll_res->resource_lock);
devm_kfree(&pdev->dev, pll_res);
return 0;
}
diff --git a/drivers/clk/msm/mdss/mdss-pll.h b/drivers/clk/msm/mdss/mdss-pll.h
index 023eb0bbb4f6..27b7b4fd4d1b 100644
--- a/drivers/clk/msm/mdss/mdss-pll.h
+++ b/drivers/clk/msm/mdss/mdss-pll.h
@@ -64,15 +64,6 @@ struct mdss_pll_resources {
* feature is disabled.
*/
bool handoff_resources;
-
- /*
- * Keep refrence count of pll resource client to avoid releasing them
- * before all clients are finished with their tasks
- */
- unsigned int resource_refcount;
-
- /* Lock status to provide updated resource status to all clients */
- struct mutex resource_lock;
};
int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable);