[PATCH 2/2] regulator: Parse ramp_delay in while parsing DT for regulators.

From: Yadwinder Singh Brar
Date: Fri Jun 08 2012 - 05:48:02 EST


For some hardwares ramp_delay for BUCKs is a configurable parameter which can
be configured through DT.This patch adds support for parsing ramp_delay also
while parsing DT for regulators.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@xxxxxxxxxxx>
---
.../devicetree/bindings/regulator/regulator.txt | 1 +
drivers/regulator/of_regulator.c | 6 ++++++
include/linux/regulator/machine.h | 2 ++
3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 5b7a408..d0a7b12 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -10,6 +10,7 @@ Optional properties:
- regulator-always-on: boolean, regulator should never be disabled
- regulator-boot-on: bootloader/firmware enabled regulator
- <name>-supply: phandle to the parent supply/regulator node
+- regulator-ramp-delay: ramp delay for regulator(in mV/uS)

Example:

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 56593b7..8b9cb53 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -74,6 +74,7 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev,
struct device_node *node)
{
struct regulator_init_data *init_data;
+ const __be32 *ramp_delay;

if (!node)
return NULL;
@@ -83,6 +84,11 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev,
return NULL; /* Out of memory? */

of_get_regulation_constraints(node, &init_data);
+
+ ramp_delay = of_get_property(node, "regulator-ramp_delay", NULL);
+ if (ramp_delay)
+ init_data->ramp_delay = be32_to_cpu(*ramp_delay);
+
return init_data;
}
EXPORT_SYMBOL_GPL(of_get_regulator_init_data);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index b021084..bb29a6b 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -177,6 +177,8 @@ struct regulator_init_data {
int num_consumer_supplies;
struct regulator_consumer_supply *consumer_supplies;

+ int ramp_delay; /* unit:mV/us */
+
/* optional regulator machine specific init */
int (*regulator_init)(void *driver_data);
void *driver_data; /* core does not touch this */
--
1.7.0.4

--
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/