From patchwork Mon Jan 30 15:03:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dwivedi, Avaneesh Kumar (avani)" X-Patchwork-Id: 9545569 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41AA360417 for ; Mon, 30 Jan 2017 15:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36A202811D for ; Mon, 30 Jan 2017 15:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B96C28159; Mon, 30 Jan 2017 15:04:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE4F22811D for ; Mon, 30 Jan 2017 15:04:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932125AbdA3PDd (ORCPT ); Mon, 30 Jan 2017 10:03:33 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:58944 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932218AbdA3PD0 (ORCPT ); Mon, 30 Jan 2017 10:03:26 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AD82060848; Mon, 30 Jan 2017 15:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1485788605; bh=YPxIj91mimkwLGnfLRen+r6qNKwYCf3uc7so+ujDDmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZSHWAShIltLKZo5TgYVSrrvIY9ixYMweVxDTiG+9OoCazRxxsEc0PzEC1+iq0SzdL FjYwXXK2/AkDH0oSkS/y/EgML445Hn5vV4Uf6y1+88on4lk/iPlPmJ3JLILKfnT/SN cKXpsqDC+fe/7cyFhPcTh1RzNZCyQgDGWDFqE800= Received: from akdwived-linux.qualcomm.com (unknown [202.46.23.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akdwived@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C8F6B60848; Mon, 30 Jan 2017 15:03:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C8F6B60848 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=akdwived@codeaurora.org From: Avaneesh Kumar Dwivedi To: bjorn.andersson@linaro.org Cc: sboyd@codeaurora.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Avaneesh Kumar Dwivedi Subject: [PATCH v3 2/4] remoteproc: qcom: Add additional agree2_clk and px regulator resource. Date: Mon, 30 Jan 2017 20:33:07 +0530 Message-Id: <1485788589-21968-3-git-send-email-akdwived@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1485788589-21968-1-git-send-email-akdwived@codeaurora.org> References: <1485788589-21968-1-git-send-email-akdwived@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add additional clock and regulator resource which are initialized based on compatible and has no impact on existing driver working. This resourse addition enable the existing driver to handle. low pass sensor processor device also. Signed-off-by: Avaneesh Kumar Dwivedi --- drivers/remoteproc/qcom_adsp_pil.c | 43 +++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/qcom_adsp_pil.c b/drivers/remoteproc/qcom_adsp_pil.c index f674301..58cc46d 100644 --- a/drivers/remoteproc/qcom_adsp_pil.c +++ b/drivers/remoteproc/qcom_adsp_pil.c @@ -36,6 +36,7 @@ struct adsp_data { int crash_reason_smem; const char *firmware_name; int pas_id; + bool has_aggre2_clk; }; @@ -53,11 +54,13 @@ struct qcom_adsp { unsigned stop_bit; struct clk *xo; - + struct clk *aggre2_clk; struct regulator *cx_supply; + struct regulator *px_supply; int pas_id; int crash_reason_smem; + bool has_aggre2_clk; struct completion start_done; struct completion stop_done; @@ -115,16 +118,22 @@ static int adsp_start(struct rproc *rproc) ret = clk_prepare_enable(adsp->xo); if (ret) return ret; + ret = clk_prepare_enable(adsp->aggre2_clk); + if (ret) + goto disable_xo_clk; ret = regulator_enable(adsp->cx_supply); if (ret) - goto disable_clocks; + goto disable_aggre2_clk; + ret = regulator_enable(adsp->px_supply); + if (ret) + goto disable_cx_supply; ret = qcom_scm_pas_auth_and_reset(adsp->pas_id); if (ret) { dev_err(adsp->dev, "failed to authenticate image and release reset\n"); - goto disable_regulators; + goto disable_px_supply; } ret = wait_for_completion_timeout(&adsp->start_done, @@ -133,14 +142,18 @@ static int adsp_start(struct rproc *rproc) dev_err(adsp->dev, "start timed out\n"); qcom_scm_pas_shutdown(adsp->pas_id); ret = -ETIMEDOUT; - goto disable_regulators; + goto disable_px_supply; } ret = 0; -disable_regulators: +disable_px_supply: + regulator_disable(adsp->px_supply); +disable_cx_supply: regulator_disable(adsp->cx_supply); -disable_clocks: +disable_aggre2_clk: + clk_disable_unprepare(adsp->aggre2_clk); +disable_xo_clk: clk_disable_unprepare(adsp->xo); return ret; @@ -251,17 +264,31 @@ static int adsp_init_clock(struct qcom_adsp *adsp) return ret; } + if (adsp->has_aggre2_clk) { + adsp->aggre2_clk = devm_clk_get(adsp->dev, "aggre2"); + if (IS_ERR(adsp->aggre2_clk)) { + ret = PTR_ERR(adsp->aggre2_clk); + if (ret != -EPROBE_DEFER) + dev_err(adsp->dev, + "failed to get aggre2 clock"); + return ret; + } + } + return 0; } static int adsp_init_regulator(struct qcom_adsp *adsp) { - adsp->cx_supply = devm_regulator_get(adsp->dev, "cx"); + adsp->cx_supply = devm_regulator_get(adsp->dev, "vdd_cx"); if (IS_ERR(adsp->cx_supply)) return PTR_ERR(adsp->cx_supply); regulator_set_load(adsp->cx_supply, 100000); + adsp->px_supply = devm_regulator_get(adsp->dev, "vdd_px"); + if (IS_ERR(adsp->px_supply)) + return PTR_ERR(adsp->px_supply); return 0; } @@ -358,6 +385,7 @@ static int adsp_probe(struct platform_device *pdev) adsp->pas_id = desc->pas_id; adsp->crash_reason_smem = desc->crash_reason_smem; + adsp->has_aggre2_clk = desc->has_aggre2_clk; ret = adsp_init_clock(adsp); if (ret) goto free_rproc; @@ -425,6 +453,7 @@ static int adsp_remove(struct platform_device *pdev) .crash_reason_smem = 423, .firmware_name = "adsp.mdt", .pas_id = 1, + .has_aggre2_clk = 0, }; static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init},