Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756949AbcKBS6k (ORCPT ); Wed, 2 Nov 2016 14:58:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52478 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756602AbcKBS6i (ORCPT ); Wed, 2 Nov 2016 14:58:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org A99E06120F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=spjoshi@codeaurora.org Subject: Re: [PATCH v2 1/1] remoteproc: Add support for xo clock To: Bjorn Andersson References: <1477429046-26855-1-git-send-email-spjoshi@codeaurora.org> <20161101000555.GK25787@tuxbot> Cc: Ohad Ben-Cohen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephen Boyd , Trilok Soni From: Sarangdhar Joshi Message-ID: <8284ee04-1e59-fd20-a215-7d0e22026cdc@codeaurora.org> Date: Wed, 2 Nov 2016 11:58:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161101000555.GK25787@tuxbot> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3167 Lines: 116 On 10/31/2016 05:05 PM, Bjorn Andersson wrote: > On Tue 25 Oct 13:57 PDT 2016, Sarangdhar Joshi wrote: > >> Add xo clock support required to boot up Qualcomm ADSP processor. >> The ADSP remoteproc driver keeps xo clock enabled until the >> driver receives "handover" irq, in order to allow ADSP processor >> to vote for xo clock with rpm. > > Looks good, thanks. > > We have to add the clock to the DT binding and run that by Rob again, > before merging the driver and this patch. > > Regards, > Bjorn Sure, will add it to the DT bindings. Thanks for reviewing. Regards, Sarang > >> >> Signed-off-by: Sarangdhar Joshi >> --- >> drivers/remoteproc/qcom_adsp_pil.c | 30 +++++++++++++++++++++++++++++- >> 1 file changed, 29 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c >> index 9141633..5bb25d1 100644 >> --- a/drivers/remoteproc/qcom_adsp_pil.c >> +++ b/drivers/remoteproc/qcom_adsp_pil.c >> @@ -15,6 +15,7 @@ >> * GNU General Public License for more details. >> */ >> >> +#include >> #include >> #include >> #include >> @@ -48,6 +49,8 @@ struct qcom_adsp { >> struct qcom_smem_state *state; >> unsigned stop_bit; >> >> + struct clk *xo; >> + >> struct regulator *cx_supply; >> >> struct completion start_done; >> @@ -102,10 +105,14 @@ static int adsp_start(struct rproc *rproc) >> struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; >> int ret; >> >> - ret = regulator_enable(adsp->cx_supply); >> + ret = clk_prepare_enable(adsp->xo); >> if (ret) >> return ret; >> >> + ret = regulator_enable(adsp->cx_supply); >> + if (ret) >> + goto disable_clocks; >> + >> ret = qcom_scm_pas_auth_and_reset(ADSP_PAS_ID); >> if (ret) { >> dev_err(adsp->dev, >> @@ -126,6 +133,8 @@ static int adsp_start(struct rproc *rproc) >> >> disable_regulators: >> regulator_disable(adsp->cx_supply); >> +disable_clocks: >> + clk_disable_unprepare(adsp->xo); >> >> return ret; >> } >> @@ -223,6 +232,21 @@ static irqreturn_t adsp_stop_ack_interrupt(int irq, void *dev) >> return IRQ_HANDLED; >> } >> >> +static int adsp_init_clock(struct qcom_adsp *adsp) >> +{ >> + int ret; >> + >> + adsp->xo = devm_clk_get(adsp->dev, "xo"); >> + if (IS_ERR(adsp->xo)) { >> + ret = PTR_ERR(adsp->xo); >> + if (ret != -EPROBE_DEFER) >> + dev_err(adsp->dev, "failed to get xo clock"); >> + return ret; >> + } >> + >> + return 0; >> +} >> + >> static int adsp_init_regulator(struct qcom_adsp *adsp) >> { >> adsp->cx_supply = devm_regulator_get(adsp->dev, "cx"); >> @@ -320,6 +344,10 @@ static int adsp_probe(struct platform_device *pdev) >> if (ret) >> goto free_rproc; >> >> + ret = adsp_init_clock(adsp); >> + if (ret) >> + goto free_rproc; >> + >> ret = adsp_init_regulator(adsp); >> if (ret) >> goto free_rproc; >> -- >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, >> a Linux Foundation Collaborative Project >> -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project