Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c00bc5df authored by Lorenzo Pieralisi's avatar Lorenzo Pieralisi Committed by Daniel Lezcano
Browse files

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: default avatarKevin Hilman <khilman@linaro.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 97735da0
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -331,6 +331,12 @@ follows:
			    If the property is not present the idle-state must
			    If the property is not present the idle-state must
			    be considered operational.
			    be considered operational.


	- idle-state-name:
		Usage: Optional
		Value type: <string>
		Definition: A string used as a descriptive name for the idle
			    state.

	In addition to the properties listed above, a state node may require
	In addition to the properties listed above, a state node may require
	additional properties specifics to the entry-method defined in the
	additional properties specifics to the entry-method defined in the
	idle-states node, please refer to the entry-method bindings
	idle-states node, please refer to the entry-method bindings
+6 −1
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ static int init_state_node(struct cpuidle_state *idle_state,
{
{
	int err;
	int err;
	const struct of_device_id *match_id;
	const struct of_device_id *match_id;
	const char *desc;


	match_id = of_match_node(matches, state_node);
	match_id = of_match_node(matches, state_node);
	if (!match_id)
	if (!match_id)
@@ -73,6 +74,10 @@ static int init_state_node(struct cpuidle_state *idle_state,
		return -EINVAL;
		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;
	idle_state->flags = CPUIDLE_FLAG_TIME_VALID;
	if (of_property_read_bool(state_node, "local-timer-stop"))
	if (of_property_read_bool(state_node, "local-timer-stop"))
		idle_state->flags |= CPUIDLE_FLAG_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
	 *	and desc become string pointers
	 */
	 */
	strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1);
	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;
	return 0;
}
}