Skip to contentSkip to conversation

clk: qcom: Make oxili GDSC parent of oxili_cx GDSC

PATCH Superseded Stephen Boyd 3 participants 8 messages Sep 23, 2015 – Oct 5, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: qcom: Make oxili GDSC parent of oxili_cx GDSC

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.

---
 drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/qcom/mmcc-msm8974.c +9 -1
index fe8320dc41db..3613db0a73e3 100644
@@ -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)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw
Quoted 23 lines · Stephen Boyd

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.

---
  drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/qcom/mmcc-msm8974.c +1 -0
index fe8320dc41db..3613db0a73e3 100644
@@ -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))

drivers/clk/qcom/mmcc-msm8974.c static int mmcc_msm8974_probe(struct platform_device *pdev) · line 2631

Quoted 9 lines
drivers/clk/qcom/mmcc-msm8974.c +5 -1
@@ -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.

Quoted 7 lines
drivers/clk/qcom/mmcc-msm8974.c +3 -0
+	if (ret)
+		qcom_cc_remove(pdev);
+	return ret;
  }
 
  static int mmcc_msm8974_remove(struct platform_device *pdev)
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#2 lore raw
Quoted 27 lines · Rajendra Nayak
Quoted 26 lines · Stephen Boyd

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.

---
 drivers/clk/qcom/mmcc-msm8974.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/qcom/mmcc-msm8974.c +1 -0
index fe8320dc41db..3613db0a73e3 100644
@@ -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);
 
Quoted 9 lines

drivers/clk/qcom/mmcc-msm8974.c static int mmcc_msm8974_probe(struct platform_device *pdev) · line 2631

Quoted 6 lines
drivers/clk/qcom/mmcc-msm8974.c +5 -1
-	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?

Quoted 5 lines

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.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw
Quoted 9 lines · Stephen Boyd
Quoted 6 lines · Rajendra Nayak

drivers/clk/qcom/mmcc-msm8974.c static int mmcc_msm8974_probe(struct platform_device *pdev) · line 2631

Quoted 2 lines · Stephen Boyd
drivers/clk/qcom/mmcc-msm8974.c +2 -0
+
+	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.

Quoted 10 lines
Quoted 6 lines

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.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

[]...

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

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.

Quoted 6 lines

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.

What I was suggesting is that the qcom gdsc driver handle this instead of the qcom clock drivers.
Something like..

drivers/clk/qcom/gdsc.c +2 -0
index da9fad8..00edb2d 100644
@@ -226,6 +226,8 @@ int gdsc_register(struct device *dev, struct gdsc **scs, size_t num,
 		if (ret)
 			return ret;
 		data->domains[i] = &scs[i]->pd;
+		if (scs[i]->parent)
+			pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd);
 	}
 
 	return of_genpd_add_provider_onecell(dev->of_node, data);
drivers/clk/qcom/gdsc.h +1 -0
index 5ded268..bc5791f 100644
@@ -49,6 +49,7 @@ struct gdsc {
 	struct reset_controller_dev	*rcdev;
 	unsigned int			*resets;
 	unsigned int			reset_count;
+	struct generic_pm_domain	*parent;
 };
 
 #ifdef CONFIG_QCOM_GDSC
drivers/clk/qcom/mmcc-msm8974.c +1 -0
index fe8320d..51ad8de 100644
@@ -2400,6 +2400,7 @@ static struct gdsc oxilicx_gdsc = {
 	.pd = {
 		.name = "oxilicx",
 	},
+	.parent = &oxili_gdsc.pd,
 	.pwrsts = PWRSTS_OFF_ON,
 };
 
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#5 lore raw
config: i386-allmodconfig (attached as .config) reproduce:

Hi Rajendra,

[auto build test ERROR on next-20151002 -- if it's inappropriate base, please ignore]

config: i386-allmodconfig (attached as .config)
reproduce:

        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "pm_genpd_add_subdomain" undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw
In reply to Rajendra Nayak
config: x86_64-randconfig-r0-10051645 (attached as .config) reproduce:

Hi Rajendra,

[auto build test ERROR on next-20151002 -- if it's inappropriate base, please ignore]

config: x86_64-randconfig-r0-10051645 (attached as .config) reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> ERROR: "pm_genpd_add_subdomain" [drivers/clk/qcom/clk-qcom.ko] undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#7 lore raw
In reply to Rajendra Nayak
Quoted 18 lines · Rajendra Nayak

[]...

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

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.

Quoted 6 lines

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.

Quoted 3 lines

What I was suggesting is that the qcom gdsc driver handle this instead of the qcom clock drivers.
Something like..

Ah ok. This patch will still need the gdscs to be in a certain order though so that we don't add a subdomain on an uninitialized domain. So I guess some list of pointer pairs to call the function on could be done in the qcom_cc_desc structure if we need to do this more than a couple times.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project