[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241130-topic-idle_state_name-v1-2-d0ff67b0c8e9@oss.qualcomm.com>
Date: Sat, 30 Nov 2024 17:39:37 +0100
From: Konrad Dybcio <konradybcio@...nel.org>
To: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Ulf Hansson <ulf.hansson@...aro.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: Marijn Suijten <marijn.suijten@...ainline.org>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@....qualcomm.com>,
Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Subject: [PATCH 2/2] pmdomain: core: Support naming idle states
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Commit 422f2d418186 ("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 <konrad.dybcio@....qualcomm.com>
---
drivers/pmdomain/core.c | 15 ++++++++++++---
include/linux/pm_domain.h | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index a6c8b85dd02478e227ac74886225a3fbad330eac..6f41ebdbc24fdfdf02021d4db1b2f324736940ae 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -3171,6 +3171,8 @@ 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);
+
genpd_state->power_on_latency_ns = 1000LL * exit_latency;
genpd_state->power_off_latency_ns = 1000LL * entry_latency;
genpd_state->fwnode = &state_node->fwnode;
@@ -3449,7 +3451,10 @@ static int idle_states_show(struct seq_file *s, void *data)
seq_puts(s, "State Time Spent(ms) Usage Rejected\n");
for (i = 0; i < genpd->state_count; i++) {
- idle_time += genpd->states[i].idle_time;
+ struct genpd_power_state *state = &genpd->states[i];
+ char state_name[15];
+
+ idle_time += state->idle_time;
if (genpd->status == GENPD_STATE_OFF && genpd->state_idx == i) {
now = ktime_get_mono_fast_ns();
@@ -3459,9 +3464,13 @@ static int idle_states_show(struct seq_file *s, void *data)
}
}
+ if (!state->name)
+ snprintf(state_name, ARRAY_SIZE(state_name), "S%-13d", i);
+
do_div(idle_time, NSEC_PER_MSEC);
- seq_printf(s, "S%-13i %-14llu %-14llu %llu\n", i, idle_time,
- genpd->states[i].usage, genpd->states[i].rejected);
+ seq_printf(s, "%-14s %-14llu %-14llu %llu\n",
+ state->name ?: state_name, idle_time,
+ state->usage, state->rejected);
}
genpd_unlock(genpd);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 45646bfcaf1a5eb7169e497677c3a2acd9263a9c..1aab31370065caad13bf951179f75ff3cf798a96 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -147,6 +147,7 @@ struct genpd_governor_data {
};
struct genpd_power_state {
+ const char *name;
s64 power_off_latency_ns;
s64 power_on_latency_ns;
s64 residency_ns;
--
2.47.1
Powered by blists - more mailing lists