diff mbox

clk: qcom: Make oxili GDSC parent of oxili_cx GDSC

Message ID 1443035362-10914-1-git-send-email-sboyd@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stephen Boyd Sept. 23, 2015, 7:09 p.m. UTC
The oxili_cx GDSC is inside the power domain of the oxili GDSC.
Add the dependency so that the CX domain can properly power up.

Reported-by: Rob Clark <robdclark@gmail.com>
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Rajendra Nayak Oct. 1, 2015, 8:23 a.m. UTC | #1
On 09/24/2015 12:39 AM, Stephen Boyd wrote:
> The oxili_cx GDSC is inside the power domain of the oxili GDSC.
> Add the dependency so that the CX domain can properly power up.
>
> Reported-by: Rob Clark <robdclark@gmail.com>
> Cc: Rajendra Nayak <rnayak@codeaurora.org>
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>   drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c
> index fe8320dc41db..3613db0a73e3 100644
> --- a/drivers/clk/qcom/mmcc-msm8974.c
> +++ b/drivers/clk/qcom/mmcc-msm8974.c
> @@ -2615,6 +2615,7 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);
>   static int mmcc_msm8974_probe(struct platform_device *pdev)
>   {
>   	struct regmap *regmap;
> +	int ret;
>
>   	regmap = qcom_cc_map(pdev, &mmcc_msm8974_desc);
>   	if (IS_ERR(regmap))
> @@ -2623,7 +2624,14 @@ static int mmcc_msm8974_probe(struct platform_device *pdev)
>   	clk_pll_configure_sr_hpm_lp(&mmpll1, regmap, &mmpll1_config, true);
>   	clk_pll_configure_sr_hpm_lp(&mmpll3, regmap, &mmpll3_config, false);
>
> -	return qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
> +	ret = qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_genpd_add_subdomain(&oxili_gdsc.pd, &oxilicx_gdsc.pd);

We'll need pm_genpd_add_subdomain() to be EXPORT_SYMBOL_GPL'ed so
clk-qcom can be built as a module.

It would also be nicer if this parent/child relationship can
somehow be represented in data (struct gdsc) that gets passed to
the gdsc driver which then sets it up, instead of individual
clock drivers doing it.

> +	if (ret)
> +		qcom_cc_remove(pdev);
> +	return ret;
>   }
>
>   static int mmcc_msm8974_remove(struct platform_device *pdev)
>
Stephen Boyd Oct. 1, 2015, 5:52 p.m. UTC | #2
On 10/01, Rajendra Nayak wrote:
> On 09/24/2015 12:39 AM, Stephen Boyd wrote:
> >The oxili_cx GDSC is inside the power domain of the oxili GDSC.
> >Add the dependency so that the CX domain can properly power up.
> >
> >Reported-by: Rob Clark <robdclark@gmail.com>
> >Cc: Rajendra Nayak <rnayak@codeaurora.org>
> >Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> >---
> >  drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c
> >index fe8320dc41db..3613db0a73e3 100644
> >--- a/drivers/clk/qcom/mmcc-msm8974.c
> >+++ b/drivers/clk/qcom/mmcc-msm8974.c
> >@@ -2615,6 +2615,7 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);
> >  static int mmcc_msm8974_probe(struct platform_device *pdev)
> >  {
> >  	struct regmap *regmap;
> >+	int ret;
> >
> >  	regmap = qcom_cc_map(pdev, &mmcc_msm8974_desc);
> >  	if (IS_ERR(regmap))
> >@@ -2623,7 +2624,14 @@ static int mmcc_msm8974_probe(struct platform_device *pdev)
> >  	clk_pll_configure_sr_hpm_lp(&mmpll1, regmap, &mmpll1_config, true);
> >  	clk_pll_configure_sr_hpm_lp(&mmpll3, regmap, &mmpll3_config, false);
> >
> >-	return qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
> >+	ret = qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
> >+	if (ret)
> >+		return ret;
> >+
> >+	ret = pm_genpd_add_subdomain(&oxili_gdsc.pd, &oxilicx_gdsc.pd);
> 
> We'll need pm_genpd_add_subdomain() to be EXPORT_SYMBOL_GPL'ed so
> clk-qcom can be built as a module.

Good catch! Do we need to call pm_genpd_remove_subdomain() too?

> 
> It would also be nicer if this parent/child relationship can
> somehow be represented in data (struct gdsc) that gets passed to
> the gdsc driver which then sets it up, instead of individual
> clock drivers doing it.

Agreed. I'd rather that we do nothing besides register domains
and then let the core code handle hooking up domains and
subdomains.
Stephen Boyd Oct. 1, 2015, 7:06 p.m. UTC | #3
On 10/01, Stephen Boyd wrote:
> On 10/01, Rajendra Nayak wrote:
> > On 09/24/2015 12:39 AM, Stephen Boyd wrote:
> > >+
> > >+	ret = pm_genpd_add_subdomain(&oxili_gdsc.pd, &oxilicx_gdsc.pd);
> > 
> > We'll need pm_genpd_add_subdomain() to be EXPORT_SYMBOL_GPL'ed so
> > clk-qcom can be built as a module.
> 
> Good catch! Do we need to call pm_genpd_remove_subdomain() too?

Looks like yes.

> 
> > 
> > It would also be nicer if this parent/child relationship can
> > somehow be represented in data (struct gdsc) that gets passed to
> > the gdsc driver which then sets it up, instead of individual
> > clock drivers doing it.
> 
> Agreed. I'd rather that we do nothing besides register domains
> and then let the core code handle hooking up domains and
> subdomains.

A little closer inspection makes me want to skip this. PM domains
can have multiple "master" domains, and pm_genpd_init() is the
only API that would be able to do the linking. That API is mostly
about initializing things to default values, so it doesn't seem
like a good fit. I'll send a v2 with the remove part and the
exports.
diff mbox

Patch

diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c
index fe8320dc41db..3613db0a73e3 100644
--- a/drivers/clk/qcom/mmcc-msm8974.c
+++ b/drivers/clk/qcom/mmcc-msm8974.c
@@ -2615,6 +2615,7 @@  MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);
 static int mmcc_msm8974_probe(struct platform_device *pdev)
 {
 	struct regmap *regmap;
+	int ret;
 
 	regmap = qcom_cc_map(pdev, &mmcc_msm8974_desc);
 	if (IS_ERR(regmap))
@@ -2623,7 +2624,14 @@  static int mmcc_msm8974_probe(struct platform_device *pdev)
 	clk_pll_configure_sr_hpm_lp(&mmpll1, regmap, &mmpll1_config, true);
 	clk_pll_configure_sr_hpm_lp(&mmpll3, regmap, &mmpll3_config, false);
 
-	return qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
+	ret = qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
+	if (ret)
+		return ret;
+
+	ret = pm_genpd_add_subdomain(&oxili_gdsc.pd, &oxilicx_gdsc.pd);
+	if (ret)
+		qcom_cc_remove(pdev);
+	return ret;
 }
 
 static int mmcc_msm8974_remove(struct platform_device *pdev)