From: Juha Keski-Saari Date: Wed, 16 Dec 2009 12:55:26 +0000 (+0200) Subject: twl-regulator: Add turnon delay to reg_enable X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=53b8a9d92a713fa82316bf418dcc19d6da32ca05;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 6c464b86b29c..9bcea4d131be 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -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)