Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lorenzo Pieralisi and committed by
Daniel Lezcano
c00bc5df 97735da0

+12 -1
+6
Documentation/devicetree/bindings/arm/idle-states.txt
··· 331 331 If the property is not present the idle-state must 332 332 be considered operational. 333 333 334 + - idle-state-name: 335 + Usage: Optional 336 + Value type: <string> 337 + Definition: A string used as a descriptive name for the idle 338 + state. 339 + 334 340 In addition to the properties listed above, a state node may require 335 341 additional properties specifics to the entry-method defined in the 336 342 idle-states node, please refer to the entry-method bindings
+6 -1
drivers/cpuidle/dt_idle_states.c
··· 27 27 { 28 28 int err; 29 29 const struct of_device_id *match_id; 30 + const char *desc; 30 31 31 32 match_id = of_match_node(matches, state_node); 32 33 if (!match_id) ··· 74 73 return -EINVAL; 75 74 } 76 75 76 + err = of_property_read_string(state_node, "idle-state-name", &desc); 77 + if (err) 78 + desc = state_node->name; 79 + 77 80 idle_state->flags = CPUIDLE_FLAG_TIME_VALID; 78 81 if (of_property_read_bool(state_node, "local-timer-stop")) 79 82 idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP; ··· 87 82 * and desc become string pointers 88 83 */ 89 84 strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1); 90 - strncpy(idle_state->desc, state_node->name, CPUIDLE_DESC_LEN - 1); 85 + strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1); 91 86 return 0; 92 87 } 93 88