Commit 53b8a9d92a713fa82316bf418dcc19d6da32ca05

Authored by Juha Keski-Saari
Committed by Liam Girdwood
1 parent 30010fa52c

twl-regulator: Add turnon delay to reg_enable

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>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

drivers/regulator/twl-regulator.c
... ... @@ -12,6 +12,7 @@
12 12 #include <linux/module.h>
13 13 #include <linux/init.h>
14 14 #include <linux/err.h>
  15 +#include <linux/delay.h>
15 16 #include <linux/platform_device.h>
16 17 #include <linux/regulator/driver.h>
17 18 #include <linux/regulator/machine.h>
... ... @@ -134,6 +135,7 @@
134 135 {
135 136 struct twlreg_info *info = rdev_get_drvdata(rdev);
136 137 int grp;
  138 + int ret;
137 139  
138 140 grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);
139 141 if (grp < 0)
... ... @@ -144,7 +146,11 @@
144 146 else
145 147 grp |= P1_GRP_6030;
146 148  
147   - return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
  149 + ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
  150 +
  151 + udelay(info->delay);
  152 +
  153 + return ret;
148 154 }
149 155  
150 156 static int twlreg_disable(struct regulator_dev *rdev)