regulator: add support for rail to be off during boot
Laxman Dewangan [Wed, 31 Jul 2013 13:48:12 +0000 (18:48 +0530)]
Add option "boot_off" if any rail is require to be OFF
during booting of system.

bug 1326594

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/256343
(cherry picked from commit 92da84c5585a6e96b0df31a5ec1c6d4d35721f3c)

Change-Id: Ic9b52a2d1e22dc8fb1051d752090ce7f2c66cce9
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/265529
GVS: Gerrit_Virtual_Submit

drivers/regulator/core.c
include/linux/regulator/machine.h

index 5a9df93..24f449b 100644 (file)
@@ -1142,6 +1142,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
                }
        }
 
+       if ((rdev->constraints->boot_off) && ops->disable) {
+               ret = ops->disable(rdev);
+               if (ret < 0) {
+                       rdev_err(rdev, "failed to disable\n");
+                       goto out;
+               }
+       }
+
        if (rdev->constraints->ramp_delay && ops->set_ramp_delay) {
                ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay);
                if (ret < 0) {
index 101f804..47c5d42 100644 (file)
@@ -141,6 +141,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 boot_off:1;    /* bootloader/firmware disabled regulator */
 };
 
 /**