mfd: pmic8901: Add delay after disabling regulators in shutdown function

Add delay after disabling each FTSMPS regulator in
pm8901_reset_pwr_off.  Add additional delay between disabling the
last regulator and when PS_HOLD is lowered to shutdown or restart
the system.

This delay is necessary to limit transient loading on LDO 7 and
dVdd regulators during the PMIC power off sequence.

Change-Id: Ia95894a6a032a254b7ca3f8a251b4984e1432818
Signed-off-by: David Collins <collinsd@codeaurora.org>
diff --git a/drivers/mfd/pmic8901.c b/drivers/mfd/pmic8901.c
index 07bba8b..3d87f0b 100644
--- a/drivers/mfd/pmic8901.c
+++ b/drivers/mfd/pmic8901.c
@@ -19,6 +19,7 @@
 #include <linux/mfd/pmic8901.h>
 #include <linux/platform_device.h>
 #include <linux/debugfs.h>
+#include <linux/delay.h>
 
 /* PMIC8901 Revision */
 #define SSBI_REG_REV			0x002  /* PMIC4 revision */
@@ -65,6 +66,10 @@
 #define REGULATOR_PMR_STATE_MASK	0x60
 #define REGULATOR_PMR_STATE_OFF		0x20
 
+/* Shutdown/restart delays to allow for LDO 7/dVdd regulator load settling. */
+#define DELAY_AFTER_REG_DISABLE_MS	4
+#define DELAY_BEFORE_SHUTDOWN_MS	8
+
 struct pm8901_chip {
 	struct pm8901_platform_data	pdata;
 	struct device			*dev;
@@ -225,10 +230,12 @@
 				       "\n", __func__, pmr_addr[i], pmr, rc);
 				goto get_out;
 			}
+			mdelay(DELAY_AFTER_REG_DISABLE_MS);
 		}
 	}
 
 get_out:
+	mdelay(DELAY_BEFORE_SHUTDOWN_MS);
 	return rc;
 }
 EXPORT_SYMBOL(pm8901_reset_pwr_off);