clk: qcom: mdss: update PLL resources based on ref count
At present, the PLL resources are updated based on the enable/disable parameter that is passed to the API. Add support to update the PLL resources based on a ref count. This avoids additional delay due to repeated enable/disable of the resources and also maintains proper state of the PLL resources. Change-Id: I39b7ee2b33acb81acdb7dc1f4f387dc71381a464 Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
This commit is contained in:
parent
269cc0b104
commit
6ec05813a9
2 changed files with 25 additions and 5 deletions
|
@ -29,6 +29,7 @@
|
||||||
int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
|
int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
int changed = 0;
|
||||||
if (!pll_res) {
|
if (!pll_res) {
|
||||||
pr_err("Invalid input parameters\n");
|
pr_err("Invalid input parameters\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -44,11 +45,27 @@ int mdss_pll_resource_enable(struct mdss_pll_resources *pll_res, bool enable)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = mdss_pll_util_resource_enable(pll_res, enable);
|
if (enable) {
|
||||||
if (rc)
|
if (pll_res->resource_ref_cnt == 0)
|
||||||
pr_err("Resource update failed rc=%d\n", rc);
|
changed++;
|
||||||
else
|
pll_res->resource_ref_cnt++;
|
||||||
pll_res->resource_enable = enable;
|
} else {
|
||||||
|
if (pll_res->resource_ref_cnt) {
|
||||||
|
pll_res->resource_ref_cnt--;
|
||||||
|
if (pll_res->resource_ref_cnt == 0)
|
||||||
|
changed++;
|
||||||
|
} else {
|
||||||
|
pr_err("PLL Resources already OFF\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,9 @@ struct mdss_pll_resources {
|
||||||
/* HW recommended delay during configuration of vco clock rate */
|
/* HW recommended delay during configuration of vco clock rate */
|
||||||
u32 vco_delay;
|
u32 vco_delay;
|
||||||
|
|
||||||
|
/* Ref-count of the PLL resources */
|
||||||
|
u32 resource_ref_cnt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep track to resource status to avoid updating same status for the
|
* Keep track to resource status to avoid updating same status for the
|
||||||
* pll from different paths
|
* pll from different paths
|
||||||
|
|
Loading…
Add table
Reference in a new issue