]> Pileus Git - ~andy/linux/commitdiff
regulator: core: Add support for disabling ramp delay
authorYadwinder Singh Brar <yadi.brar@samsung.com>
Sat, 29 Jun 2013 12:51:15 +0000 (18:21 +0530)
committerMark Brown <broonie@linaro.org>
Mon, 15 Jul 2013 10:27:48 +0000 (11:27 +0100)
Some hardwares support disabling ramp delay, so adding ramp_disable flag to
constraints. It will be used to figure out whether ramp_delay in constraints
is explicitly set to zero or its unintialized (zero by default).
And we don't need to call set_voltage_time_sel() for regulators for whom ramp
delay is disabled in constraints.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Documentation/devicetree/bindings/regulator/regulator.txt
drivers/regulator/core.c
drivers/regulator/of_regulator.c
include/linux/regulator/machine.h

index 48a3b8e5d6bde80fce883c7db83f99dc4bcc7da7..2bd8f09787659269bb03847b3517cff2b52cfca9 100644 (file)
@@ -12,6 +12,8 @@ Optional properties:
 - regulator-allow-bypass: allow the regulator to go into bypass mode
 - <name>-supply: phandle to the parent supply/regulator node
 - regulator-ramp-delay: ramp delay for regulator(in uV/uS)
+  For hardwares which support disabling ramp rate, it should be explicitly
+  intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
 
 Deprecated properties:
 - regulator-compatible: If a regulator chip contains multiple
index 288c75abc19034c06e62772ea6b6cc62242da473..6e6371c2346ca24fbae7f615ca52602e0d44ca1a 100644 (file)
@@ -984,7 +984,8 @@ static int set_machine_constraints(struct regulator_dev *rdev,
                }
        }
 
-       if (rdev->constraints->ramp_delay && ops->set_ramp_delay) {
+       if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable)
+               && ops->set_ramp_delay) {
                ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay);
                if (ret < 0) {
                        rdev_err(rdev, "failed to set ramp_delay\n");
@@ -2438,7 +2439,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
        }
 
        /* Call set_voltage_time_sel if successfully obtained old_selector */
-       if (ret == 0 && _regulator_is_enabled(rdev) && old_selector >= 0 &&
+       if (ret == 0 && !rdev->constraints->ramp_disable &&
+           _regulator_is_enabled(rdev) && old_selector >= 0 &&
            old_selector != selector && rdev->desc->ops->set_voltage_time_sel) {
 
                delay = rdev->desc->ops->set_voltage_time_sel(rdev,
index f3c8f8f9dc39d48e8b586cb808cfdc568ae67d27..7827384680d64a7f62b5e248d687953e5ca8ae7b 100644 (file)
@@ -21,6 +21,7 @@ static void of_get_regulation_constraints(struct device_node *np,
 {
        const __be32 *min_uV, *max_uV, *uV_offset;
        const __be32 *min_uA, *max_uA, *ramp_delay;
+       struct property *prop;
        struct regulation_constraints *constraints = &(*init_data)->constraints;
 
        constraints->name = of_get_property(np, "regulator-name", NULL);
@@ -64,9 +65,14 @@ static void of_get_regulation_constraints(struct device_node *np,
        if (of_property_read_bool(np, "regulator-allow-bypass"))
                constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
 
-       ramp_delay = of_get_property(np, "regulator-ramp-delay", NULL);
-       if (ramp_delay)
-               constraints->ramp_delay = be32_to_cpu(*ramp_delay);
+       prop = of_find_property(np, "regulator-ramp-delay", NULL);
+       if (prop && prop->value) {
+               ramp_delay = prop->value;
+               if (*ramp_delay)
+                       constraints->ramp_delay = be32_to_cpu(*ramp_delay);
+               else
+                       constraints->ramp_disable = true;
+       }
 }
 
 /**
index 36adbc82de6ae6c58c3a224f62e5d385ce7a35ba..999b20ce06cf349185f008388e12e64c70518196 100644 (file)
@@ -134,6 +134,7 @@ struct regulation_constraints {
        unsigned always_on:1;   /* regulator never off when system is on */
        unsigned boot_on:1;     /* bootloader/firmware enabled regulator */
        unsigned apply_uV:1;    /* apply uV constraint if min == max */
+       unsigned ramp_disable:1; /* disable ramp delay */
 };
 
 /**