twl-regulator: Add turnon delay to reg_enable
authorJuha Keski-Saari <ext-juha.1.keski-saari@nokia.com>
Wed, 16 Dec 2009 12:55:26 +0000 (14:55 +0200)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Thu, 17 Dec 2009 10:27:29 +0000 (10:27 +0000)
This change implements a basic turnon delay in the regulator enable function
to make it less probable that reg_enable returns before the regulator
output is at target level

Signed-off-by: Juha Keski-Saari <ext-juha.1.keski-saari@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/twl-regulator.c

index 6c464b86b29cb07ff5260cfe46bf715310844bd6..9bcea4d131be5e074f9b4b2870e018fcac2c92b6 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/err.h>
+#include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
@@ -134,6 +135,7 @@ static int twlreg_enable(struct regulator_dev *rdev)
 {
        struct twlreg_info      *info = rdev_get_drvdata(rdev);
        int                     grp;
+       int                     ret;
 
        grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
        if (grp < 0)
@@ -144,7 +146,11 @@ static int twlreg_enable(struct regulator_dev *rdev)
        else
                grp |= P1_GRP_6030;
 
-       return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
+       ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
+
+       udelay(info->delay);
+
+       return ret;
 }
 
 static int twlreg_disable(struct regulator_dev *rdev)