[PATCH 1/2] regulator: support operating mode in the device treestructure

From: Kim, Milo
Date: Tue May 07 2013 - 09:09:36 EST


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@xxxxxx>
---
.../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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/