* [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers
@ 2025-05-28 20:03 Kevin Hilman
2025-05-28 20:35 ` Rob Herring
2025-05-28 21:16 ` Rob Herring (Arm)
0 siblings, 2 replies; 4+ messages in thread
From: Kevin Hilman @ 2025-05-28 20:03 UTC (permalink / raw)
To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Rafael J. Wysocki
Cc: linux-pm, devicetree, linux-kernel, arm-scmi
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 a new property
`power-domains-child-ids` to describe the parent/child relationship.
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-domains = <&MAIN_PD>, <&WKUP_PD>;
power-domains-child-ids = <15>, <19>;
};
With the new property, 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.
Note: this idea was previously discussed on the arm-scmi mailing
list[1] where this approach was proposed by Ulf. This is my initial
attempt at implementing it for discussion. I'm definitely a noob at
adding support new DT properties, so I got some help from an AI friend
named Claude in writing this code, so feedback on the apprach is
welcomed.
[1] https://lore.kernel.org/arm-scmi/CAPDyKFo_P129sVirHHYjOQT+QUmpymcRJme9obzKJeRgO7B-1A@mail.gmail.com/
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
Documentation/devicetree/bindings/power/power-domain.yaml | 39 ++++++++++++++++++++++++++++++++
drivers/pmdomain/core.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 150 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/power-domain.yaml b/Documentation/devicetree/bindings/power/power-domain.yaml
index 8fdb529d560b..1db82013e407 100644
--- a/Documentation/devicetree/bindings/power/power-domain.yaml
+++ b/Documentation/devicetree/bindings/power/power-domain.yaml
@@ -68,6 +68,21 @@ properties:
by the given provider should be subdomains of the domain specified
by this binding.
+ power-domains-child-ids:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ An array of child domain IDs that correspond to the power-domains
+ property. This property is only applicable to power domain providers
+ with #power-domain-cells > 0 (i.e., providers that supply multiple
+ power domains). It specifies which of the provider's child domains
+ should be associated with each parent domain listed in the power-domains
+ property. The number of elements in this array must match the number of
+ phandles in the power-domains property. Each element specifies the child
+ domain ID (index) that should be made a subdomain of the corresponding
+ parent domain. This enables hierarchical power domain structures where
+ different child domains from the same provider can have different
+ parent domains.
+
required:
- "#power-domain-cells"
@@ -133,3 +148,27 @@ examples:
min-residency-us = <7000>;
};
};
+
+ - |
+ // Example of power-domains-child-ids usage
+ MAIN_PD: main-power-controller {
+ compatible = "foo,main-power-controller";
+ #power-domain-cells = <0>;
+ };
+
+ WKUP_PD: wkup-power-controller {
+ compatible = "foo,wkup-power-controller";
+ #power-domain-cells = <0>;
+ };
+
+ scmi_pds: protocol@11 {
+ reg = <0x11>;
+ #power-domain-cells = <1>;
+ power-domains = <&MAIN_PD>, <&WKUP_PD>;
+ power-domains-child-ids = <15>, <19>;
+ };
+
+ // In the above example:
+ // - Child domain 15 (scmi_pds 15) becomes a subdomain of MAIN_PD
+ // - Child domain 19 (scmi_pds 19) becomes a subdomain of WKUP_PD
+ // - Other child domains (0-14, 16-18, 20+) have no parent relationship
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index d6c1ddb807b2..d9ae4f1d35ca 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -2441,6 +2441,9 @@ static LIST_HEAD(of_genpd_providers);
/* Mutex to protect the list above. */
static DEFINE_MUTEX(of_genpd_mutex);
+static int of_genpd_parse_child_ids(struct device_node *np,
+ struct genpd_onecell_data *data);
+
/**
* genpd_xlate_simple() - Xlate function for direct node-domain mapping
* @genpdspec: OF phandle args to map into a PM domain
@@ -2635,6 +2638,14 @@ int of_genpd_add_provider_onecell(struct device_node *np,
if (ret < 0)
goto error;
+ /* Parse power-domains-child-ids property to establish parent-child relationships */
+ ret = of_genpd_parse_child_ids(np, data);
+ if (ret < 0 && ret != -ENOENT) {
+ pr_err("Failed to parse power-domains-child-ids for %pOF: %d\n", np, ret);
+ of_genpd_del_provider(np);
+ goto error;
+ }
+
return 0;
error:
@@ -2734,6 +2745,106 @@ static struct generic_pm_domain *genpd_get_from_provider(
return genpd;
}
+/**
+ * of_genpd_parse_child_ids() - Parse power-domains-child-ids property
+ * @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 and power-domains-child-ids properties to establish
+ * parent-child relationships for PM domains. The power-domains property lists
+ * parent domains, and power-domains-child-ids lists which child domain IDs
+ * should be associated with each parent.
+ *
+ * Returns 0 on success, -ENOENT if properties don't exist, or negative error code.
+ */
+static int of_genpd_parse_child_ids(struct device_node *np,
+ struct genpd_onecell_data *data)
+{
+ struct of_phandle_args parent_args;
+ struct generic_pm_domain *parent_genpd, *child_genpd;
+ u32 *child_ids;
+ int num_parents, num_child_ids, i, ret;
+
+ /* Check if both properties exist */
+ num_parents = of_count_phandle_with_args(np, "power-domains", "#power-domain-cells");
+ if (num_parents <= 0)
+ return -ENOENT;
+
+ num_child_ids = of_property_count_u32_elems(np, "power-domains-child-ids");
+ if (num_child_ids <= 0)
+ return -ENOENT;
+
+ if (num_parents != num_child_ids) {
+ pr_err("power-domains (%d) and power-domains-child-ids (%d) count mismatch for %pOF\n",
+ num_parents, num_child_ids, np);
+ return -EINVAL;
+ }
+
+ child_ids = kcalloc(num_child_ids, sizeof(*child_ids), GFP_KERNEL);
+ if (!child_ids)
+ return -ENOMEM;
+
+ ret = of_property_read_u32_array(np, "power-domains-child-ids", child_ids, num_child_ids);
+ if (ret) {
+ pr_err("Failed to read power-domains-child-ids for %pOF: %d\n", np, ret);
+ goto out_free;
+ }
+
+ /* For each parent domain, establish parent-child relationship */
+ for (i = 0; i < num_parents; i++) {
+ ret = of_parse_phandle_with_args(np, "power-domains",
+ "#power-domain-cells", i, &parent_args);
+ if (ret) {
+ pr_err("Failed to parse parent domain %d for %pOF: %d\n", i, np, ret);
+ goto out_free;
+ }
+
+ /* Get the parent domain */
+ parent_genpd = genpd_get_from_provider(&parent_args);
+ of_node_put(parent_args.np);
+ if (IS_ERR(parent_genpd)) {
+ pr_err("Failed to get parent domain %d for %pOF: %ld\n",
+ i, np, PTR_ERR(parent_genpd));
+ ret = PTR_ERR(parent_genpd);
+ goto out_free;
+ }
+
+ /* Validate child ID is within bounds */
+ if (child_ids[i] >= data->num_domains) {
+ pr_err("Child ID %u out of bounds (max %u) for parent %d in %pOF\n",
+ child_ids[i], data->num_domains - 1, i, np);
+ ret = -EINVAL;
+ goto out_free;
+ }
+
+ /* Get the child domain */
+ child_genpd = data->domains[child_ids[i]];
+ if (!child_genpd) {
+ pr_err("Child domain %u is NULL for parent %d in %pOF\n",
+ child_ids[i], i, np);
+ ret = -EINVAL;
+ goto out_free;
+ }
+
+ /* Establish parent-child relationship */
+ ret = genpd_add_subdomain(parent_genpd, child_genpd);
+ if (ret) {
+ pr_err("Failed to add child domain %u to parent %d in %pOF: %d\n",
+ child_ids[i], i, np, ret);
+ goto out_free;
+ }
+
+ pr_debug("Added child domain %u (%s) to parent %s for %pOF\n",
+ child_ids[i], child_genpd->name, parent_genpd->name, np);
+ }
+
+ ret = 0;
+
+out_free:
+ kfree(child_ids);
+ return ret;
+}
+
/**
* of_genpd_add_device() - Add a device to an I/O PM domain
* @genpdspec: OF phandle args to use for look-up PM domain
---
base-commit: 0ff41df1cb268fc69e703a08a57ee14ae967d0ca
change-id: 20250528-pmdomain-hierarchy-onecell-a46fad47d855
Best regards,
--
Kevin Hilman <khilman@baylibre.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers
2025-05-28 20:03 [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers Kevin Hilman
@ 2025-05-28 20:35 ` Rob Herring
2025-05-28 22:01 ` Kevin Hilman
2025-05-28 21:16 ` Rob Herring (Arm)
1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2025-05-28 20:35 UTC (permalink / raw)
To: Kevin Hilman
Cc: Ulf Hansson, Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
linux-pm, devicetree, linux-kernel, arm-scmi
On Wed, May 28, 2025 at 01:03:43PM -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 a new property
> `power-domains-child-ids` to describe the parent/child relationship.
>
> 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-domains = <&MAIN_PD>, <&WKUP_PD>;
> power-domains-child-ids = <15>, <19>;
> };
>
> With the new property, 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.
>
> Note: this idea was previously discussed on the arm-scmi mailing
> list[1] where this approach was proposed by Ulf. This is my initial
> attempt at implementing it for discussion. I'm definitely a noob at
> adding support new DT properties, so I got some help from an AI friend
> named Claude in writing this code, so feedback on the apprach is
> welcomed.
>
> [1] https://lore.kernel.org/arm-scmi/CAPDyKFo_P129sVirHHYjOQT+QUmpymcRJme9obzKJeRgO7B-1A@mail.gmail.com/
>
> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
> ---
> Documentation/devicetree/bindings/power/power-domain.yaml | 39 ++++++++++++++++++++++++++++++++
> drivers/pmdomain/core.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 150 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/power-domain.yaml b/Documentation/devicetree/bindings/power/power-domain.yaml
> index 8fdb529d560b..1db82013e407 100644
> --- a/Documentation/devicetree/bindings/power/power-domain.yaml
> +++ b/Documentation/devicetree/bindings/power/power-domain.yaml
> @@ -68,6 +68,21 @@ properties:
> by the given provider should be subdomains of the domain specified
> by this binding.
>
> + power-domains-child-ids:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description:
> + An array of child domain IDs that correspond to the power-domains
> + property. This property is only applicable to power domain providers
> + with #power-domain-cells > 0 (i.e., providers that supply multiple
> + power domains). It specifies which of the provider's child domains
> + should be associated with each parent domain listed in the power-domains
> + property. The number of elements in this array must match the number of
> + phandles in the power-domains property. Each element specifies the child
> + domain ID (index) that should be made a subdomain of the corresponding
> + parent domain. This enables hierarchical power domain structures where
> + different child domains from the same provider can have different
> + parent domains.
> +
> required:
> - "#power-domain-cells"
>
> @@ -133,3 +148,27 @@ examples:
> min-residency-us = <7000>;
> };
> };
> +
> + - |
> + // Example of power-domains-child-ids usage
> + MAIN_PD: main-power-controller {
> + compatible = "foo,main-power-controller";
> + #power-domain-cells = <0>;
> + };
> +
> + WKUP_PD: wkup-power-controller {
> + compatible = "foo,wkup-power-controller";
> + #power-domain-cells = <0>;
> + };
> +
> + scmi_pds: protocol@11 {
> + reg = <0x11>;
> + #power-domain-cells = <1>;
> + power-domains = <&MAIN_PD>, <&WKUP_PD>;
> + power-domains-child-ids = <15>, <19>;
> + };
This all looks like a nexus map which is defined in the DT spec. To
date, the only ones are interrupt-map and gpio-map. Here that would look
like this:
power-domain-map = <15 &MAIN_PD>,
<19 &WKUP_PD>;
Quite simple in this case, but the general form of each entry is:
<<child address> <provider specifier cells> <parent provider> <parent provider specifier cells>>
<child address> is specific to interrupts dating back to the days when
interrupt and bus hierarchies were the same (e.g. ISA).
For the existing cases, there's no s/w involvement by the child
provider. For example, with an interrupt, the device ends up with the
parent provider interrupt and there's no involvement by the child
provider to enable/disable/ack interrupts. That doesn't have to be the
case here if that's not desired.
Rob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers
2025-05-28 20:03 [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers Kevin Hilman
2025-05-28 20:35 ` Rob Herring
@ 2025-05-28 21:16 ` Rob Herring (Arm)
1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2025-05-28 21:16 UTC (permalink / raw)
To: Kevin Hilman
Cc: linux-kernel, linux-pm, Conor Dooley, devicetree,
Rafael J. Wysocki, Ulf Hansson, Krzysztof Kozlowski, arm-scmi
On Wed, 28 May 2025 13:03:43 -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 a new property
> `power-domains-child-ids` to describe the parent/child relationship.
>
> 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-domains = <&MAIN_PD>, <&WKUP_PD>;
> power-domains-child-ids = <15>, <19>;
> };
>
> With the new property, 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.
>
> Note: this idea was previously discussed on the arm-scmi mailing
> list[1] where this approach was proposed by Ulf. This is my initial
> attempt at implementing it for discussion. I'm definitely a noob at
> adding support new DT properties, so I got some help from an AI friend
> named Claude in writing this code, so feedback on the apprach is
> welcomed.
>
> [1] https://lore.kernel.org/arm-scmi/CAPDyKFo_P129sVirHHYjOQT+QUmpymcRJme9obzKJeRgO7B-1A@mail.gmail.com/
>
> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
> ---
> Documentation/devicetree/bindings/power/power-domain.yaml | 39 ++++++++++++++++++++++++++++++++
> drivers/pmdomain/core.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 150 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
./Documentation/devicetree/bindings/power/power-domain.yaml:76:13: [error] missing starting space in comment (comments)
./Documentation/devicetree/bindings/power/power-domain.yaml:77:7: [error] syntax error: expected <block end>, but found '<scalar>' (syntax)
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/power-domain.yaml: ignoring, error parsing file
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/keystone/ti,sci.example.dtb: system-controller@44083000 (ti,k2g-sci): power-controller: {'compatible': ['ti,sci-pm-domain'], '#power-domain-cells': 2} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/keystone/ti,sci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/keystone/ti,sci.example.dtb: power-controller (ti,sci-pm-domain): {'compatible': ['ti,sci-pm-domain'], '#power-domain-cells': 2, '$nodename': ['power-controller']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/soc/ti/sci-pm-domain.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cpu0: {'#power-domain-cells': 0, 'domain-idle-states': [3], 'power-domains': [[4]], 'phandle': 1} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cpu0: Unevaluated properties are not allowed ('#power-domain-cells', 'domain-idle-states', 'power-domains' were unexpected)
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cpu1: {'#power-domain-cells': 0, 'domain-idle-states': [3], 'power-domains': [[4]], 'phandle': 2} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cpu1: Unevaluated properties are not allowed ('#power-domain-cells', 'domain-idle-states', 'power-domains' were unexpected)
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cluster: {'#power-domain-cells': 0, 'domain-idle-states': [5, 6], 'phandle': 4} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.example.dtb: psci (arm,psci-1.0): power-domain-cluster: Unevaluated properties are not allowed ('#power-domain-cells', 'domain-idle-states' were unexpected)
from schema $id: http://devicetree.org/schemas/arm/psci.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23b700000 (apple,t8103-pmgr): power-controller@1c0: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[448, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['sio'], 'apple,always-on': True, 'phandle': 1} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23b700000 (apple,t8103-pmgr): power-controller@220: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[544, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['uart_p'], 'power-domains': [[1]], 'phandle': 2} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23b700000 (apple,t8103-pmgr): power-controller@270: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[624, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['uart0'], 'power-domains': [[2]]} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@1c0 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[448, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['sio'], 'apple,always-on': True, 'phandle': 1, '$nodename': ['power-controller@1c0']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@220 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[544, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['uart_p'], 'power-domains': [[1]], 'phandle': 2, '$nodename': ['power-controller@220']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@270 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[624, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['uart0'], 'power-domains': [[2]], '$nodename': ['power-controller@270']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23d280000 (apple,t8103-pmgr): power-controller@4000: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16384, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_filter'], 'phandle': 3} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23d280000 (apple,t8103-pmgr): power-controller@4010: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16400, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_base'], 'power-domains': [[3]], 'phandle': 4} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23d280000 (apple,t8103-pmgr): power-controller@4038: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16440, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_shim'], 'power-domains': [[4]], 'phandle': 5} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-management@23d280000 (apple,t8103-pmgr): power-controller@4048: {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16456, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_uart0'], 'power-domains': [[5]]} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/arm/apple/apple,pmgr.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@4000 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16384, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_filter'], 'phandle': 3, '$nodename': ['power-controller@4000']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@4010 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16400, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_base'], 'power-domains': [[3]], 'phandle': 4, '$nodename': ['power-controller@4010']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@4038 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16440, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_shim'], 'power-domains': [[4]], 'phandle': 5, '$nodename': ['power-controller@4038']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/apple/apple,pmgr.example.dtb: power-controller@4048 (apple,t8103-pmgr-pwrstate): {'compatible': ['apple,t8103-pmgr-pwrstate', 'apple,pmgr-pwrstate'], 'reg': [[16456, 8]], '#power-domain-cells': 0, '#reset-cells': 0, 'label': ['aop_uart0'], 'power-domains': [[5]], '$nodename': ['power-controller@4048']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/apple,pmgr-pwrstate.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.example.dtb: power-controller (ti,sci-pm-domain): {'compatible': ['ti,sci-pm-domain'], '#power-domain-cells': 1, '$nodename': ['power-controller']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/soc/ti/sci-pm-domain.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.example.dtb: power-controller (ti,sci-pm-domain): {'compatible': ['ti,sci-pm-domain'], '#power-domain-cells': 2, '$nodename': ['power-controller']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/soc/ti/sci-pm-domain.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/fsl,scu-pd.example.dtb: power-controller (fsl,imx8qxp-scu-pd): {'compatible': ['fsl,imx8qxp-scu-pd', 'fsl,scu-pd'], '#power-domain-cells': 1, '$nodename': ['power-controller']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/fsl,scu-pd.yaml#
make[2]: *** Deleting file 'Documentation/devicetree/bindings/power/power-domain.example.dts'
Documentation/devicetree/bindings/power/power-domain.yaml:77:7: expected <block end>, but found '<scalar>'
make[2]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/power/power-domain.example.dts] Error 1
make[2]: *** Waiting for unfinished jobs....
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/pd-samsung.example.dtb: power-domain@10023c80 (samsung,exynos4210-pd): {'compatible': ['samsung,exynos4210-pd'], 'reg': [[268582016, 32]], '#power-domain-cells': 0, 'label': ['LCD0'], '$nodename': ['power-domain@10023c80']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/pd-samsung.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/pd-samsung.example.dtb: power-domain@10044060 (samsung,exynos4210-pd): {'compatible': ['samsung,exynos4210-pd'], 'reg': [[268714080, 32]], '#power-domain-cells': 0, 'label': ['MFC'], '$nodename': ['power-domain@10044060']} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/power/power-domain.yaml#"}
from schema $id: http://devicetree.org/schemas/power/pd-samsung.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/fsl,scu-pd.yaml:
while parsing a block mapping
in "<unicode string>", line 72, column 5:
$ref: /schemas/types.yaml#/defin ...
^ (line: 72)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 77, column 7:
power domains). It specifies whi ...
^ (line: 77)
./Documentation/devicetree/bindings/power/power-domain.yaml:77:7: expected <block end>, but found '<scalar>'
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/pd-samsung.yaml:
while parsing a block mapping
in "<unicode string>", line 72, column 5:
$ref: /schemas/types.yaml#/defin ...
^ (line: 72)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 77, column 7:
power domains). It specifies whi ...
^ (line: 77)
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/psci.yaml:
while parsing a block mapping
in "<unicode string>", line 72, column 5:
$ref: /schemas/types.yaml#/defin ...
^ (line: 72)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 77, column 7:
power domains). It specifies whi ...
^ (line: 77)
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.yaml:
while parsing a block mapping
in "<unicode string>", line 72, column 5:
$ref: /schemas/types.yaml#/defin ...
^ (line: 72)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 77, column 7:
power domains). It specifies whi ...
^ (line: 77)
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/apple,pmgr-pwrstate.yaml:
while parsing a block mapping
in "<unicode string>", line 72, column 5:
$ref: /schemas/types.yaml#/defin ...
^ (line: 72)
expected <block end>, but found '<scalar>'
in "<unicode string>", line 77, column 7:
power domains). It specifies whi ...
^ (line: 77)
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1519: dt_binding_check] Error 2
make: *** [Makefile:248: __sub-make] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250528-pmdomain-hierarchy-onecell-v1-1-851780700c68@baylibre.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers
2025-05-28 20:35 ` Rob Herring
@ 2025-05-28 22:01 ` Kevin Hilman
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2025-05-28 22:01 UTC (permalink / raw)
To: Rob Herring
Cc: Ulf Hansson, Krzysztof Kozlowski, Conor Dooley, Rafael J. Wysocki,
linux-pm, devicetree, linux-kernel, arm-scmi
Hi Rob,
Rob Herring <robh@kernel.org> writes:
> On Wed, May 28, 2025 at 01:03:43PM -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 a new property
>> `power-domains-child-ids` to describe the parent/child relationship.
>>
>> 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-domains = <&MAIN_PD>, <&WKUP_PD>;
>> power-domains-child-ids = <15>, <19>;
>> };
>>
>> With the new property, 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.
>>
>> Note: this idea was previously discussed on the arm-scmi mailing
>> list[1] where this approach was proposed by Ulf. This is my initial
>> attempt at implementing it for discussion. I'm definitely a noob at
>> adding support new DT properties, so I got some help from an AI friend
>> named Claude in writing this code, so feedback on the apprach is
>> welcomed.
>>
>> [1] https://lore.kernel.org/arm-scmi/CAPDyKFo_P129sVirHHYjOQT+QUmpymcRJme9obzKJeRgO7B-1A@mail.gmail.com/
>>
>> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
>> ---
>> Documentation/devicetree/bindings/power/power-domain.yaml | 39 ++++++++++++++++++++++++++++++++
>> drivers/pmdomain/core.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 150 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power/power-domain.yaml b/Documentation/devicetree/bindings/power/power-domain.yaml
>> index 8fdb529d560b..1db82013e407 100644
>> --- a/Documentation/devicetree/bindings/power/power-domain.yaml
>> +++ b/Documentation/devicetree/bindings/power/power-domain.yaml
>> @@ -68,6 +68,21 @@ properties:
>> by the given provider should be subdomains of the domain specified
>> by this binding.
>>
>> + power-domains-child-ids:
>> + $ref: /schemas/types.yaml#/definitions/uint32-array
>> + description:
>> + An array of child domain IDs that correspond to the power-domains
>> + property. This property is only applicable to power domain providers
>> + with #power-domain-cells > 0 (i.e., providers that supply multiple
>> + power domains). It specifies which of the provider's child domains
>> + should be associated with each parent domain listed in the power-domains
>> + property. The number of elements in this array must match the number of
>> + phandles in the power-domains property. Each element specifies the child
>> + domain ID (index) that should be made a subdomain of the corresponding
>> + parent domain. This enables hierarchical power domain structures where
>> + different child domains from the same provider can have different
>> + parent domains.
>> +
>> required:
>> - "#power-domain-cells"
>>
>> @@ -133,3 +148,27 @@ examples:
>> min-residency-us = <7000>;
>> };
>> };
>> +
>> + - |
>> + // Example of power-domains-child-ids usage
>> + MAIN_PD: main-power-controller {
>> + compatible = "foo,main-power-controller";
>> + #power-domain-cells = <0>;
>> + };
>> +
>> + WKUP_PD: wkup-power-controller {
>> + compatible = "foo,wkup-power-controller";
>> + #power-domain-cells = <0>;
>> + };
>> +
>> + scmi_pds: protocol@11 {
>> + reg = <0x11>;
>> + #power-domain-cells = <1>;
>> + power-domains = <&MAIN_PD>, <&WKUP_PD>;
>> + power-domains-child-ids = <15>, <19>;
>> + };
>
> This all looks like a nexus map which is defined in the DT spec. To
> date, the only ones are interrupt-map and gpio-map. Here that would look
> like this:
>
> power-domain-map = <15 &MAIN_PD>,
> <19 &WKUP_PD>;
>
> Quite simple in this case, but the general form of each entry is:
> <<child address> <provider specifier cells> <parent provider> <parent provider specifier cells>>
>
> <child address> is specific to interrupts dating back to the days when
> interrupt and bus hierarchies were the same (e.g. ISA).
>
> For the existing cases, there's no s/w involvement by the child
> provider. For example, with an interrupt, the device ends up with the
> parent provider interrupt and there's no involvement by the child
> provider to enable/disable/ack interrupts. That doesn't have to be the
> case here if that's not desired.
Hmm, very interesting. I wasn't aware of these nexus node map things.
I have respun a v2 using the nexus map:
https://lore.kernel.org/linux-pm/20250528-pmdomain-hierarchy-onecell-v2-0-7885ae45e59c@baylibre.com/T/#t
Thanks for the review & suggestion,
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-28 22:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 20:03 [PATCH RFC] pmdomain: core: add hierarchy support for onecell providers Kevin Hilman
2025-05-28 20:35 ` Rob Herring
2025-05-28 22:01 ` Kevin Hilman
2025-05-28 21:16 ` Rob Herring (Arm)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.