From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avaneesh Kumar Dwivedi Subject: [PATCH v4 05/10] remoteproc: qcom: Separate out regulator disable routine in two Date: Wed, 16 Nov 2016 22:31:31 +0530 Message-ID: <1479315696-15490-6-git-send-email-akdwived@codeaurora.org> References: <1479315696-15490-1-git-send-email-akdwived@codeaurora.org> Return-path: Received: from smtp.codeaurora.org ([198.145.29.96]:57388 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932811AbcKPRCC (ORCPT ); Wed, 16 Nov 2016 12:02:02 -0500 In-Reply-To: <1479315696-15490-1-git-send-email-akdwived@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: bjorn.andersson@linaro.org Cc: sboyd@codeaurora.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, Avaneesh Kumar Dwivedi 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 --- drivers/remoteproc/qcom_q6v5_pil.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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; } -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.