mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 16:47:42 +00:00
clk: qcom: Support attaching GDSCs to multiple parents
When a clock-controller lists multiple power-domains we need make each GDSC a subdomain of each of the clock-controller's listed power-domains. GDSCs without an explicitly defined parent should be a subdomain of each of the clock-controller's listed power-domains. GDSCs with an explicitly defined parent should attach only to the parent GDSC and not the listed power-domains. Any votes will trickle through the hierarchy up to the external power-domains. ======================================== :: arch/arm64/boot/dts/example.dtsi :: ======================================== clockcc: clock-controller@0 { compat ="qcom,example-clockcc"; power-domains = <&pd_a, &pd_b>; } ======================================== :: drivers/clk/qcom/example-clockcc.c :: ======================================== static struct gdsc parent_gdsc = { .pd = { .name = "parent_gdsc", }, }; static struct gdsc child0_gdsc = { .pd = { .name = "child0_gdsc", }, .parent = &parent_gdsc.pd, }; static struct gdsc child1_gdsc = { .pd = { .name = "child1_gdsc", }, .parent = &parent_gdsc.pd, }; ======================================== :: power-subdomains :: ======================================== pm-domain::pd_a └── pm-subdomain::clockcc::parent_gdsc ├── pm-subdomain::clockcc::child0_gdsc └── pm-subdomain::clockcc::child1_gdsc pm-domain::pd_b └── pm-subdomain::clockcc::parent_gdsc ├── pm-subdomain::clockcc::child1_gdsc └── pm-subdomain::clockcc::child2_gdsc The performance states will percolate through the pm-domain hierarchy to the domains that handle the relevant states. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Link: https://lore.kernel.org/r/20250117-b4-linux-next-24-11-18-clock-multiple-power-domains-v10-4-13f2bb656dad@linaro.org Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
parent
ed5a0d065f
commit
b489235b4d
@ -323,6 +323,7 @@ int qcom_cc_really_probe(struct device *dev,
|
||||
scd->dev = dev;
|
||||
scd->scs = desc->gdscs;
|
||||
scd->num = desc->num_gdscs;
|
||||
scd->pd_list = cc->pd_list;
|
||||
ret = gdsc_register(scd, &reset->rcdev, regmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -506,6 +506,36 @@ err_disable_supply:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int gdsc_add_subdomain_list(struct dev_pm_domain_list *pd_list,
|
||||
struct generic_pm_domain *subdomain)
|
||||
{
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < pd_list->num_pds; i++) {
|
||||
struct device *dev = pd_list->pd_devs[i];
|
||||
struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
|
||||
|
||||
ret = pm_genpd_add_subdomain(genpd, subdomain);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gdsc_remove_subdomain_list(struct dev_pm_domain_list *pd_list,
|
||||
struct generic_pm_domain *subdomain)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pd_list->num_pds; i++) {
|
||||
struct device *dev = pd_list->pd_devs[i];
|
||||
struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
|
||||
|
||||
pm_genpd_remove_subdomain(genpd, subdomain);
|
||||
}
|
||||
}
|
||||
|
||||
static void gdsc_pm_subdomain_remove(struct gdsc_desc *desc, size_t num)
|
||||
{
|
||||
struct device *dev = desc->dev;
|
||||
@ -520,6 +550,8 @@ static void gdsc_pm_subdomain_remove(struct gdsc_desc *desc, size_t num)
|
||||
pm_genpd_remove_subdomain(scs[i]->parent, &scs[i]->pd);
|
||||
else if (!IS_ERR_OR_NULL(dev->pm_domain))
|
||||
pm_genpd_remove_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd);
|
||||
else if (desc->pd_list)
|
||||
gdsc_remove_subdomain_list(desc->pd_list, &scs[i]->pd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,6 +607,9 @@ int gdsc_register(struct gdsc_desc *desc,
|
||||
ret = pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd);
|
||||
else if (!IS_ERR_OR_NULL(dev->pm_domain))
|
||||
ret = pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd);
|
||||
else if (desc->pd_list)
|
||||
ret = gdsc_add_subdomain_list(desc->pd_list, &scs[i]->pd);
|
||||
|
||||
if (ret)
|
||||
goto err_pm_subdomain_remove;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ struct gdsc_desc {
|
||||
struct device *dev;
|
||||
struct gdsc **scs;
|
||||
size_t num;
|
||||
struct dev_pm_domain_list *pd_list;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_QCOM_GDSC
|
||||
|
Loading…
x
Reference in New Issue
Block a user