From 0fb9265a5911d60051fd181b04f568d937286f19 Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Tue, 7 Aug 2018 08:54:30 +0530 Subject: [PATCH] scsi: ufs: set load before setting voltage in regulators This sequence change is required to avoid dips in voltage during boot-up. Apparently, this dip is caused because in the original sequence, the regulators are initialized in lpm mode. And then when the load is set to high, and more current is drawn, than is allowed in lpm, the dip is seen. CRs-fixed: 2279027 Change-Id: Ic531a1e6788d6288071f93d5002613855c2667f5 Signed-off-by: Asutosh Das --- drivers/scsi/ufs/ufshcd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 6af0ca6eb7e2..707da4ae8185 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -7997,6 +7997,11 @@ static int ufshcd_config_vreg(struct device *dev, name = vreg->name; if (regulator_count_voltages(reg) > 0) { + uA_load = on ? vreg->max_uA : 0; + ret = ufshcd_config_vreg_load(dev, vreg, uA_load); + if (ret) + goto out; + min_uV = on ? vreg->min_uV : 0; ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); if (ret) { @@ -8004,11 +8009,6 @@ static int ufshcd_config_vreg(struct device *dev, __func__, name, ret); goto out; } - - uA_load = on ? vreg->max_uA : 0; - ret = ufshcd_config_vreg_load(dev, vreg, uA_load); - if (ret) - goto out; } out: return ret;