diff mbox

[v4,05/10] remoteproc: qcom: Separate out regulator disable routine in two

Message ID 1479315696-15490-6-git-send-email-akdwived@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Dwivedi, Avaneesh Kumar (avani) Nov. 16, 2016, 5:01 p.m. UTC
It is needed that one disable proxy regulators when handover interrupt
is received from mss subsystem while on certain chip there are few
regulator which are never disabled. So separating out disable interface
in two separate routine.

Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
---
 drivers/remoteproc/qcom_q6v5_pil.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
index 8843605..57c67e1 100644
--- a/drivers/remoteproc/qcom_q6v5_pil.c
+++ b/drivers/remoteproc/qcom_q6v5_pil.c
@@ -255,8 +255,42 @@  static int q6v5_regulator_enable(struct q6v5 *qproc,
 	return rc;
 }
 
+static void q6v5_proxy_regulator_disable(struct q6v5 *qproc)
+{
+	int i;
+	struct reg_info *regs = qproc->proxy_regs;
+
+	for (i = 0; i < qproc->proxy_reg_count; i++) {
+		if (regs[i].uV > 0)
+			regulator_set_voltage(regs[i].reg, 0, INT_MAX);
+
+		if (regs[i].uA > 0)
+			regulator_set_load(regs[i].reg, 0);
+
+		regulator_disable(regs[i].reg);
+	}
+}
+
+static void q6v5_active_regulator_disable(struct q6v5 *qproc)
+{
+	int i;
+	struct reg_info *regs = qproc->active_regs;
+
+	for (i = 0; i < qproc->active_reg_count; i++) {
+		if (regs[i].uV > 0)
+			regulator_set_voltage(regs[i].reg, 0, INT_MAX);
+
+		if (regs[i].uA > 0)
+			regulator_set_load(regs[i].reg, 0);
+
+		regulator_disable(regs[i].reg);
+	}
+}
+
 static void q6v5_regulator_disable(struct q6v5 *qproc)
 {
+	q6v5_proxy_regulator_disable(qproc);
+	q6v5_active_regulator_disable(qproc);
 }
 
 static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
@@ -629,7 +663,7 @@  static int q6v5_start(struct rproc *rproc)
 assert_reset:
 	reset_control_assert(qproc->mss_restart);
 disable_vdd:
-	q6v5_regulator_disable(qproc);
+	q6v5_active_regulator_disable(qproc);
 disable_proxy_clk:
 	return ret;
 }