From: Kevin Hilman <khilman@baylibre.com>
To: Rob Herring <robh@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org
Subject: Re: [PATCH RFC v2 2/2] pmdomain: core: use DT map to support hierarchy
Date: Fri, 13 Jun 2025 15:43:16 -0700 [thread overview]
Message-ID: <7h1prnqn3v.fsf@baylibre.com> (raw)
In-Reply-To: <7hecvwld95.fsf@baylibre.com>
Kevin Hilman <khilman@baylibre.com> writes:
> Hi Rob,
>
> Rob Herring <robh@kernel.org> writes:
>
>> On Wed, May 28, 2025 at 02:58:52PM -0700, Kevin Hilman wrote:
>>> Currently, PM domains can only support hierarchy for simple
>>> providers (e.g. ones with #power-domain-cells = 0).
>>>
>>> Add support for oncell providers as well by adding support for a nexus
>>> node map, as described in section 2.5.1 of the DT spec.
>>>
>>> For example, an SCMI PM domain provider might be a subdomain of
>>> multiple parent domains. In this example, the parent domains are
>>> MAIN_PD and WKUP_PD:
>>>
>>> scmi_pds: protocol@11 {
>>> reg = <0x11>;
>>> #power-domain-cells = <1>;
>>> power-domain-map = <15 &MAIN_PD>,
>>> <19 &WKUP_PD>;
>>> };
>>>
>>> With the new map, child domain 15 (scmi_pds 15) becomes a
>>> subdomain of MAIN_PD, and child domain 19 (scmi_pds 19) becomes a
>>> subdomain of WKUP_PD.
>>>
>>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>
> [...]
>
>>> +/**
>>> + * of_genpd_parse_domains_map() - Parse power-domains-map property for Nexus mapping
>>> + * @np: Device node pointer associated with the PM domain provider.
>>> + * @data: Pointer to the onecell data associated with the PM domain provider.
>>> + *
>>> + * Parse the power-domains-map property to establish parent-child relationships
>>> + * for PM domains using Nexus node mapping as defined in the device tree
>>> + * specification section v2.5.1.
>>> + *
>>> + * The power-domains-map property format is:
>>> + * power-domains-map = <child_specifier target_phandle [target_specifier]>, ...;
>>> + *
>>> + * Where:
>>> + * - child_specifier: The child domain ID that should be mapped
>>> + * - target_phandle: Phandle to the parent PM domain provider
>>> + * - target_specifier: Optional arguments for the parent provider (if it has #power-domain-cells > 0)
>>> + *
>>> + * Returns 0 on success, -ENOENT if property doesn't exist, or negative error code.
>>> + */
>>> +static int of_genpd_parse_domains_map(struct device_node *np,
>>> + struct genpd_onecell_data *data)
>>> +{
>>> + struct of_phandle_args parent_args;
>>> + struct generic_pm_domain *parent_genpd, *child_genpd;
>>> + u32 *map_entries;
>>> + int map_len, child_cells, i, ret;
>>> + u32 child_id;
>>> +
>>> + /* Check if power-domains-map property exists */
>>> + map_len = of_property_count_u32_elems(np, "power-domains-map");
>>> + if (map_len <= 0)
>>> + return -ENOENT;
>>
>> Don't implement your own map parsing. Use or extend
>> of_parse_phandle_with_args_map().
>
> So I've been wrestling with this for a bit, and I need some guidance.
> TBH, these "nexus node maps" and of_parse_phandle_with_args_map() are
> breaking my brain.
OK, nevermind. I *think* I have a better grasp on how they should be used
now. I've submitted a v3 of the RFC[1], but could defintely still use
some guidance.
Kevin
[1] https://lore.kernel.org/linux-pm/20250613-pmdomain-hierarchy-onecell-v3-0-5c770676fce7@baylibre.com/
next prev parent reply other threads:[~2025-06-13 22:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 21:58 [PATCH RFC v2 0/2] pmdomains: core: add support for domain hierarchies in DT Kevin Hilman
2025-05-28 21:58 ` [PATCH RFC v2 1/2] dt-bindings: power: add nexus map for power-domains Kevin Hilman
2025-05-28 23:32 ` Rob Herring (Arm)
2025-05-30 9:31 ` Ulf Hansson
2025-05-28 21:58 ` [PATCH RFC v2 2/2] pmdomain: core: use DT map to support hierarchy Kevin Hilman
2025-05-30 13:57 ` Rob Herring
2025-06-06 22:24 ` Kevin Hilman
2025-06-13 22:43 ` Kevin Hilman [this message]
2025-06-02 10:04 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7h1prnqn3v.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=arm-scmi@vger.kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=robh@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®