summaryrefslogtreecommitdiff
path: root/drivers/cpuidle/dt_idle_states.c
diff options
context:
space:
mode:
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2014-10-15 19:57:34 +0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2014-11-19 12:16:23 +0300
commitc00bc5df7c01a189843cb048cf29e2a445e0037a (patch)
tree72145cbd8492fd1067b404f5017f6c8b6be1e26d /drivers/cpuidle/dt_idle_states.c
parent97735da074fdd3fe39d975cad8760807df0d4388 (diff)
downloadlinux-c00bc5df7c01a189843cb048cf29e2a445e0037a.tar.xz
drivers: cpuidle: Add idle-state-name description to ARM idle states
On ARM machines, where generally speaking the idle state numbering has no fixed and standard meaning it is useful to provide a description of the idle state inner workings for benchmarking and monitoring purposes. This patch adds a property to the idle states bindings that if present gives platform firmware a means of describing the idle state and export the string description to user space. The patch updates the DT parsing code accordingly to take the description, if present, into consideration. Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/cpuidle/dt_idle_states.c')
-rw-r--r--drivers/cpuidle/dt_idle_states.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index 22840f40283c..5301912cb84e 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -27,6 +27,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
{
int err;
const struct of_device_id *match_id;
+ const char *desc;
match_id = of_match_node(matches, state_node);
if (!match_id)
@@ -73,6 +74,10 @@ static int init_state_node(struct cpuidle_state *idle_state,
return -EINVAL;
}
+ err = of_property_read_string(state_node, "idle-state-name", &desc);
+ if (err)
+ desc = state_node->name;
+
idle_state->flags = CPUIDLE_FLAG_TIME_VALID;
if (of_property_read_bool(state_node, "local-timer-stop"))
idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP;
@@ -82,7 +87,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
* and desc become string pointers
*/
strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1);
- strncpy(idle_state->desc, state_node->name, CPUIDLE_DESC_LEN - 1);
+ strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1);
return 0;
}