Re: [PATCH RFC v3 2/2] pmdomain: core: add support for subdomains using power-domain-map

From: Kevin Hilman
Date: Wed Jun 18 2025 - 16:00:23 EST


Hi Dan,

Dan Carpenter <dan.carpenter@xxxxxxxxxx> writes:

> On Wed, Jun 18, 2025 at 10:48:09AM -0700, Kevin Hilman wrote:
>> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
>> index 88819659df83..3ede4baa4bee 100644
>> --- a/drivers/pmdomain/core.c
>> +++ b/drivers/pmdomain/core.c
>> @@ -3220,6 +3220,40 @@ int of_genpd_parse_idle_states(struct device_node *dn,
>> }
>> EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states);
>>
>> +int of_genpd_add_subdomain_map(struct device_node *np,
>> + struct generic_pm_domain *domain,
>> + int index)
>> +{
>> + struct of_phandle_args parent_args;
>> + struct generic_pm_domain *parent_pd;
>> + struct device *dev = &domain->dev;
>> + int ret;
>> +
>> + if (!domain)
>> + return -ENODEV;
>> +
>> + /*
>> + * Check for power-domain-map, which implies the primary
>> + * power-doamin is a subdomain of the parent found in the map.
>> + */
>> + ret = of_parse_phandle_with_args_map(np, NULL, "power-domain",
>> + index, &parent_args);
>> + if (!ret && parent_args.np) {
>
> Sorry for the pedanticry but could we flip this around?

Sure. This is early prototype code for discsussing the big-picture
approach, but I appreciate the review. I'll clean that up when I get
past the RFC phase.

Thanks!

Kevin