[PATCH RFC 03/27] PM / Domain: Add additional state specific param

Lina Iyer lina.iyer at linaro.org
Tue Nov 17 14:37:27 PST 2015


Allow domain states to hold additional state related data in a u32
value. This may be used by the platform driver.

Signed-off-by: Lina Iyer <lina.iyer at linaro.org>
---
 Documentation/devicetree/bindings/power/power_domain.txt | 6 ++++++
 drivers/base/power/domain.c                              | 6 ++++++
 include/linux/pm_domain.h                                | 1 +
 3 files changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index e2f542e..ecfaf44 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -67,6 +67,12 @@ have the following properties -
 		If omitted, this is assumed to be equal to:
 			entry-latency-us + exit-latency-us
 
+	- state-param:
+		Usage: Optional
+		Value type: <prop-encoded-array>
+		Definition: A u32 value as defined by the state. May be used
+		by the driver to hold state related u32 data.
+
 Example:
 
 	power: power-controller at 12340000 {
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index fe1be88..3fb4c93 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1245,6 +1245,7 @@ static int genpd_alloc_states_data(struct generic_pm_domain *genpd,
 			st[i].power_on_latency_ns;
 		genpd->states[i].power_off_latency_ns =
 			st[i].power_off_latency_ns;
+		genpd->states[i].param = st[i].param;
 	}
 
 	/*
@@ -1527,6 +1528,7 @@ static int of_get_genpd_power_state(struct genpd_power_state *genpd_state,
 	const struct of_device_id *match_id;
 	int err = 0;
 	u32 latency;
+	u32 param;
 
 	match_id = of_match_node(power_state_match, state_node);
 	if (!match_id)
@@ -1567,6 +1569,10 @@ static int of_get_genpd_power_state(struct genpd_power_state *genpd_state,
 		return -EINVAL;
 	}
 
+	err = of_property_read_u32(state_node, "state-param", &param);
+	if (!err)
+		genpd_state->param = param;
+
 	genpd_state->power_off_latency_ns = 1000 * latency;
 
 	return 0;
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index e425911..15df24c 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -41,6 +41,7 @@ struct genpd_power_state {
 	char *name;
 	s64 power_off_latency_ns;
 	s64 power_on_latency_ns;
+	u32 param;
 };
 
 struct generic_pm_domain {
-- 
2.1.4




More information about the linux-arm-kernel mailing list