mfd: pmic8058: add pm8058_stay_on API

PMIC stay-on feature allows PMIC to ignore MSM PS_HOLD=low
signal so that some special functions like debugging could be
performed.

This feature should not be used in any product release.

Signed-off-by: Willie Ruan <wruan@codeaurora.org>
diff --git a/drivers/mfd/pmic8058.c b/drivers/mfd/pmic8058.c
index 72c1f19..ee5294b 100644
--- a/drivers/mfd/pmic8058.c
+++ b/drivers/mfd/pmic8058.c
@@ -133,6 +133,10 @@
 #define PM8058_SLEEP_SMPL_SEL_MIN	0
 #define PM8058_SLEEP_SMPL_SEL_MAX	3
 
+/* GP_TEST1 register */
+#define SSBI_REG_ADDR_GP_TEST_1		0x07A
+
+/* IRQ */
 #define	MAX_PM_IRQ		256
 #define	MAX_PM_BLOCKS		(MAX_PM_IRQ / 8 + 1)
 #define	MAX_PM_MASTERS		(MAX_PM_BLOCKS / 8 + 1)
@@ -631,6 +635,28 @@
 }
 EXPORT_SYMBOL(pm8058_reset_pwr_off);
 
+/**
+ * pm8058_stay_on - enables stay_on feature
+ *
+ * PMIC stay-on feature allows PMIC to ignore MSM PS_HOLD=low
+ * signal so that some special functions like debugging could be
+ * performed.
+ *
+ * This feature should not be used in any product release.
+ *
+ * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
+ */
+int pm8058_stay_on(void)
+{
+	u8	ctrl = 0x92;
+	int	rc;
+
+	rc = ssbi_write(pmic_chip->dev, SSBI_REG_ADDR_GP_TEST_1, &ctrl, 1);
+	pr_info("%s: set stay-on: rc = %d\n", __func__, rc);
+	return rc;
+}
+EXPORT_SYMBOL(pm8058_stay_on);
+
 /*
    power on hard reset configuration
    config = DISABLE_HARD_RESET to disable hard reset