Skip to content

Commit b04b981

Browse files
quic-kdybciostorulf
authored andcommitted
pmdomain: core: Support naming idle states
Commit 422f2d4 ("arm64: dts: qcom: Drop undocumented domain "idle-state-name"") brought to light the common misbelief that idle-state-names also applies to e.g. PSCI power domain idle states. Make that a reality, mimicking the property name used by cpuidle states. Signed-off-by: Konrad Dybcio <[email protected]> Message-ID: <20241130-topic-idle_state_name-v1-2-d0ff67b0c8e9@oss.qualcomm.com> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 11444fb commit b04b981

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

drivers/pmdomain/core.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,6 +3174,8 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
31743174
if (!err)
31753175
genpd_state->residency_ns = 1000LL * residency;
31763176

3177+
of_property_read_string(state_node, "idle-state-name", &genpd_state->name);
3178+
31773179
genpd_state->power_on_latency_ns = 1000LL * exit_latency;
31783180
genpd_state->power_off_latency_ns = 1000LL * entry_latency;
31793181
genpd_state->fwnode = &state_node->fwnode;
@@ -3452,7 +3454,10 @@ static int idle_states_show(struct seq_file *s, void *data)
34523454
seq_puts(s, "State Time Spent(ms) Usage Rejected\n");
34533455

34543456
for (i = 0; i < genpd->state_count; i++) {
3455-
idle_time += genpd->states[i].idle_time;
3457+
struct genpd_power_state *state = &genpd->states[i];
3458+
char state_name[15];
3459+
3460+
idle_time += state->idle_time;
34563461

34573462
if (genpd->status == GENPD_STATE_OFF && genpd->state_idx == i) {
34583463
now = ktime_get_mono_fast_ns();
@@ -3462,9 +3467,13 @@ static int idle_states_show(struct seq_file *s, void *data)
34623467
}
34633468
}
34643469

3470+
if (!state->name)
3471+
snprintf(state_name, ARRAY_SIZE(state_name), "S%-13d", i);
3472+
34653473
do_div(idle_time, NSEC_PER_MSEC);
3466-
seq_printf(s, "S%-13i %-14llu %-14llu %llu\n", i, idle_time,
3467-
genpd->states[i].usage, genpd->states[i].rejected);
3474+
seq_printf(s, "%-14s %-14llu %-14llu %llu\n",
3475+
state->name ?: state_name, idle_time,
3476+
state->usage, state->rejected);
34683477
}
34693478

34703479
genpd_unlock(genpd);

include/linux/pm_domain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct genpd_governor_data {
147147
};
148148

149149
struct genpd_power_state {
150+
const char *name;
150151
s64 power_off_latency_ns;
151152
s64 power_on_latency_ns;
152153
s64 residency_ns;

0 commit comments

Comments
 (0)