[PATCH] pmdomain: core: Fall back to node name for idle states

Maulik Shah posted 1 patch 1 week, 4 days ago
drivers/pmdomain/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[PATCH] pmdomain: core: Fall back to node name for idle states
Posted by Maulik Shah 1 week, 4 days ago
The dt_idle_states uses idle-state-name when available and when missing
falls back to the node name. Do the same for domain-idle-states.

This lets pmdomain idle_states_desc debugfs show a name even when
idle-state-name is omitted.

Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
---
 drivers/pmdomain/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 052ec478dfcc..d0bcb4897477 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -3583,7 +3583,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
 	if (!err)
 		genpd_state->residency_ns = 1000LL * residency;
 
-	of_property_read_string(state_node, "idle-state-name", &genpd_state->name);
+	err = of_property_read_string(state_node, "idle-state-name",
+				      &genpd_state->name);
+	if (err)
+		genpd_state->name = state_node->name;
 
 	genpd_state->power_on_latency_ns = 1000LL * exit_latency;
 	genpd_state->power_off_latency_ns = 1000LL * entry_latency;
@@ -4006,7 +4009,7 @@ static int idle_states_desc_show(struct seq_file *s, void *data)
 		snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
 		seq_printf(s, "%-6s %-12llu %-14llu %s\n",
 			   state_name, latency, residency,
-			   state->name ?: "N/A");
+			   state->name);
 	}
 
 	genpd_unlock(genpd);

---
base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
change-id: 20260914-pmdomain-idle-state-name-fallback-3bb5db520a30

Best regards,
--  
Maulik Shah <maulik.shah@oss.qualcomm.com>
Re: [PATCH] pmdomain: core: Fall back to node name for idle states
Posted by Ulf Hansson 3 days, 19 hours ago
On Mon, Sep 14, 2026 at 8:54 AM Maulik Shah
<maulik.shah@oss.qualcomm.com> wrote:
>
> The dt_idle_states uses idle-state-name when available and when missing
> falls back to the node name. Do the same for domain-idle-states.
>
> This lets pmdomain idle_states_desc debugfs show a name even when
> idle-state-name is omitted.
>
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
>  drivers/pmdomain/core.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 052ec478dfcc..d0bcb4897477 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -3583,7 +3583,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
>         if (!err)
>                 genpd_state->residency_ns = 1000LL * residency;
>
> -       of_property_read_string(state_node, "idle-state-name", &genpd_state->name);
> +       err = of_property_read_string(state_node, "idle-state-name",
> +                                     &genpd_state->name);
> +       if (err)
> +               genpd_state->name = state_node->name;
>
>         genpd_state->power_on_latency_ns = 1000LL * exit_latency;
>         genpd_state->power_off_latency_ns = 1000LL * entry_latency;
> @@ -4006,7 +4009,7 @@ static int idle_states_desc_show(struct seq_file *s, void *data)
>                 snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
>                 seq_printf(s, "%-6s %-12llu %-14llu %s\n",
>                            state_name, latency, residency,
> -                          state->name ?: "N/A");
> +                          state->name);

As pointed out by Sashiko, state->name may still be NULL in some
cases, so I decided to keep this as is.

>         }
>
>         genpd_unlock(genpd);
>
> ---
> base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
> change-id: 20260914-pmdomain-idle-state-name-fallback-3bb5db520a30
>
> Best regards,
> --
> Maulik Shah <maulik.shah@oss.qualcomm.com>
>

With the minor amendment above, applied for next, thanks!

Kind regards
Uffe
Re: [PATCH] pmdomain: core: Fall back to node name for idle states
Posted by Konrad Dybcio 1 week, 3 days ago
On 9/14/26 8:54 AM, Maulik Shah wrote:
> The dt_idle_states uses idle-state-name when available and when missing
> falls back to the node name. Do the same for domain-idle-states.
> 
> This lets pmdomain idle_states_desc debugfs show a name even when
> idle-state-name is omitted.

These are often 'idle-state-N', so I'm not sure there's much value
(but certainly don't treat that as a nack)

Konrad
Re: [PATCH] pmdomain: core: Fall back to node name for idle states
Posted by Abel Vesa 1 week, 4 days ago
On 26-09-14 12:24:25, Maulik Shah wrote:
> The dt_idle_states uses idle-state-name when available and when missing
> falls back to the node name. Do the same for domain-idle-states.
> 
> This lets pmdomain idle_states_desc debugfs show a name even when
> idle-state-name is omitted.
> 
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>

Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>