mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: support operating mode in the device tree structure
@ 2013-05-07 13:09 Kim, Milo
  2013-05-07 16:04 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Kim, Milo @ 2013-05-07 13:09 UTC (permalink / raw)
  To: broonie; +Cc: Liam Girdwood, linux-kernel

For better power efficiency, regulator subsystem provides operating mode.
(fast, normal, idle and standby)
The operating mode is selective by a regulator consumer.

With this patch, regulator operating mode can be set in the DT structure.
If any operating mode is configured, then 'valid_ops_mask' should be set with
REGULATOR_CHANGE_MODE.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
 .../devicetree/bindings/regulator/regulator.txt    |    4 ++++
 drivers/regulator/of_regulator.c                   |   13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index ecfc6cc..2b89616 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -11,6 +11,10 @@ Optional properties:
 - regulator-boot-on: bootloader/firmware enabled regulator
 - <name>-supply: phandle to the parent supply/regulator node
 - regulator-ramp-delay: ramp delay for regulator(in uV/uS)
+- regulator-mode-fast: fast operating mode
+- regulator-mode-normal: normal operating mode
+- regulator-mode-idle: idle operating mode
+- regulator-mode-standby: standby operating mode
 
 Deprecated properties:
 - regulator-compatible: If a regulator chip contains multiple
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 66ca769..aebe9a4 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -64,6 +64,19 @@ static void of_get_regulation_constraints(struct device_node *np,
 	ramp_delay = of_get_property(np, "regulator-ramp-delay", NULL);
 	if (ramp_delay)
 		constraints->ramp_delay = be32_to_cpu(*ramp_delay);
+
+	/* Operation mode configuration */
+	if (of_find_property(np, "regulator-mode-fast", NULL))
+		constraints->valid_modes_mask |= REGULATOR_MODE_FAST;
+	if (of_find_property(np, "regulator-mode-normal", NULL))
+		constraints->valid_modes_mask |= REGULATOR_MODE_NORMAL;
+	if (of_find_property(np, "regulator-mode-idle", NULL))
+		constraints->valid_modes_mask |= REGULATOR_MODE_IDLE;
+	if (of_find_property(np, "regulator-mode-standby", NULL))
+		constraints->valid_modes_mask |= REGULATOR_MODE_STANDBY;
+
+	if (constraints->valid_modes_mask)
+		constraints->valid_ops_mask |= REGULATOR_CHANGE_MODE;
 }
 
 /**
-- 
1.7.9.5


Best Regards,
Milo



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-08 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07 13:09 [PATCH 1/2] regulator: support operating mode in the device tree structure Kim, Milo
2013-05-07 16:04 ` Mark Brown
2013-05-07 23:46   ` Kim, Milo
2013-05-08 11:12     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®