pmdomain: core: Extend statistics for domain idle states with s2idle data

To allow user space to monitor the selection of the domain idle state
during s2idle for a CPU PM domain, let's extend the debugfs support in
genpd with this information.

Suggested-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Ulf Hansson
2026-01-19 15:31:15 +01:00
parent 68831a9ef9
commit f67866701d
2 changed files with 11 additions and 3 deletions

View File

@@ -1438,6 +1438,13 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
return;
} else {
genpd->states[genpd->state_idx].usage++;
/*
* The ->system_power_down_ok() callback is currently used only
* for s2idle. Use it to know when to update the usage counter.
*/
if (genpd->gov && genpd->gov->system_power_down_ok)
genpd->states[genpd->state_idx].usage_s2idle++;
}
genpd->status = GENPD_STATE_OFF;
@@ -3772,7 +3779,7 @@ static int idle_states_show(struct seq_file *s, void *data)
if (ret)
return -ERESTARTSYS;
seq_puts(s, "State Time(ms) Usage Rejected Above Below\n");
seq_puts(s, "State Time(ms) Usage Rejected Above Below S2idle\n");
for (i = 0; i < genpd->state_count; i++) {
struct genpd_power_state *state = &genpd->states[i];
@@ -3790,9 +3797,9 @@ static int idle_states_show(struct seq_file *s, void *data)
snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
do_div(idle_time, NSEC_PER_MSEC);
seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %llu\n",
seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %-10llu %llu\n",
state_name, idle_time, state->usage, state->rejected,
state->above, state->below);
state->above, state->below, state->usage_s2idle);
}
genpd_unlock(genpd);