From: Suman Anna <s-anna@ti.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>, <ohad@wizery.com>,
<bjorn.andersson@linaro.org>, <paul@crapouillou.net>
Cc: <linux-remoteproc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] remoteproc: ingenic: Move clock handling to prepare/unprepare callbacks
Date: Wed, 1 Jul 2020 16:27:24 -0500 [thread overview]
Message-ID: <8d089532-19a7-d687-d087-a3a48df16407@ti.com> (raw)
In-Reply-To: <20200630163118.3830422-2-mathieu.poirier@linaro.org>
Hi Mathieu,
On 6/30/20 11:31 AM, Mathieu Poirier wrote:
> This patch moves clock related operations to the remoteproc prepare()
> and unprepare() callbacks so that the PM runtime framework doesn't
> have to be involved needlessly. This provides a simpler approach and
> requires less code.
>
> Based on the work from Paul Cercueil published here:
> https://lore.kernel.org/linux-remoteproc/20191116170846.67220-4-paul@crapouillou.net/
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
> drivers/remoteproc/ingenic_rproc.c | 84 +++++++++---------------------
> 1 file changed, 26 insertions(+), 58 deletions(-)
>
> diff --git a/drivers/remoteproc/ingenic_rproc.c b/drivers/remoteproc/ingenic_rproc.c
> index 189020d77b25..b0fc8eace6ec 100644
> --- a/drivers/remoteproc/ingenic_rproc.c
> +++ b/drivers/remoteproc/ingenic_rproc.c
> @@ -11,7 +11,6 @@
> #include <linux/io.h>
> #include <linux/module.h>
> #include <linux/platform_device.h>
> -#include <linux/pm_runtime.h>
> #include <linux/remoteproc.h>
>
> #include "remoteproc_internal.h"
> @@ -62,6 +61,28 @@ struct vpu {
> struct device *dev;
> };
>
> +static int ingenic_rproc_prepare(struct rproc *rproc)
> +{
> + struct vpu *vpu = rproc->priv;
> + int ret;
> +
> + /* The clocks must be enabled for the firmware to be loaded in TCSM */
> + ret = clk_bulk_prepare_enable(ARRAY_SIZE(vpu->clks), vpu->clks);
> + if (ret)
> + dev_err(vpu->dev, "Unable to start clocks: %d", ret);
Minor nit, add a newline character at the end of the trace statement.
With that,
Reviewed-by: Suman Anna <s-anna@ti.com>
> +
> + return ret;
> +}
> +
> +static int ingenic_rproc_unprepare(struct rproc *rproc)
> +{
> + struct vpu *vpu = rproc->priv;
> +
> + clk_bulk_disable_unprepare(ARRAY_SIZE(vpu->clks), vpu->clks);
> +
> + return 0;
> +}
> +
> static int ingenic_rproc_start(struct rproc *rproc)
> {
> struct vpu *vpu = rproc->priv;
> @@ -115,6 +136,8 @@ static void *ingenic_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len)
> }
>
> static struct rproc_ops ingenic_rproc_ops = {
> + .prepare = ingenic_rproc_prepare,
> + .unprepare = ingenic_rproc_unprepare,
> .start = ingenic_rproc_start,
> .stop = ingenic_rproc_stop,
> .kick = ingenic_rproc_kick,
> @@ -135,16 +158,6 @@ static irqreturn_t vpu_interrupt(int irq, void *data)
> return rproc_vq_interrupt(rproc, vring);
> }
>
> -static void ingenic_rproc_disable_clks(void *data)
> -{
> - struct vpu *vpu = data;
> -
> - pm_runtime_resume(vpu->dev);
> - pm_runtime_disable(vpu->dev);
> -
> - clk_bulk_disable_unprepare(ARRAY_SIZE(vpu->clks), vpu->clks);
> -}
> -
> static int ingenic_rproc_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -206,35 +219,13 @@ static int ingenic_rproc_probe(struct platform_device *pdev)
>
> disable_irq(vpu->irq);
>
> - /* The clocks must be enabled for the firmware to be loaded in TCSM */
> - ret = clk_bulk_prepare_enable(ARRAY_SIZE(vpu->clks), vpu->clks);
> - if (ret) {
> - dev_err(dev, "Unable to start clocks\n");
> - return ret;
> - }
> -
> - pm_runtime_irq_safe(dev);
> - pm_runtime_set_active(dev);
> - pm_runtime_enable(dev);
> - pm_runtime_get_sync(dev);
> - pm_runtime_use_autosuspend(dev);
> -
> - ret = devm_add_action_or_reset(dev, ingenic_rproc_disable_clks, vpu);
> - if (ret) {
> - dev_err(dev, "Unable to register action\n");
> - goto out_pm_put;
> - }
> -
> ret = devm_rproc_add(dev, rproc);
> if (ret) {
> dev_err(dev, "Failed to register remote processor\n");
> - goto out_pm_put;
> + return ret;
> }
>
> -out_pm_put:
> - pm_runtime_put_autosuspend(dev);
> -
> - return ret;
> + return 0;
> }
>
> static const struct of_device_id ingenic_rproc_of_matches[] = {
> @@ -243,33 +234,10 @@ static const struct of_device_id ingenic_rproc_of_matches[] = {
> };
> MODULE_DEVICE_TABLE(of, ingenic_rproc_of_matches);
>
> -static int __maybe_unused ingenic_rproc_suspend(struct device *dev)
> -{
> - struct vpu *vpu = dev_get_drvdata(dev);
> -
> - clk_bulk_disable(ARRAY_SIZE(vpu->clks), vpu->clks);
> -
> - return 0;
> -}
> -
> -static int __maybe_unused ingenic_rproc_resume(struct device *dev)
> -{
> - struct vpu *vpu = dev_get_drvdata(dev);
> -
> - return clk_bulk_enable(ARRAY_SIZE(vpu->clks), vpu->clks);
> -}
> -
> -static const struct dev_pm_ops __maybe_unused ingenic_rproc_pm = {
> - SET_RUNTIME_PM_OPS(ingenic_rproc_suspend, ingenic_rproc_resume, NULL)
> -};
> -
> static struct platform_driver ingenic_rproc_driver = {
> .probe = ingenic_rproc_probe,
> .driver = {
> .name = "ingenic-vpu",
> -#ifdef CONFIG_PM
> - .pm = &ingenic_rproc_pm,
> -#endif
> .of_match_table = ingenic_rproc_of_matches,
> },
> };
>
next prev parent reply other threads:[~2020-07-01 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 16:31 [PATCH 0/2] remoteproc: Address runtime PM issues Mathieu Poirier
2020-06-30 16:31 ` [PATCH 1/2] remoteproc: ingenic: Move clock handling to prepare/unprepare callbacks Mathieu Poirier
2020-07-01 21:27 ` Suman Anna [this message]
2020-06-30 16:31 ` [PATCH 2/2] Revert "remoteproc: Add support for runtime PM" Mathieu Poirier
2020-07-01 21:21 ` Suman Anna
2020-07-01 21:28 ` [PATCH 0/2] remoteproc: Address runtime PM issues Suman Anna
2020-07-07 10:49 ` Paul Cercueil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d089532-19a7-d687-d087-a3a48df16407@ti.com \
--to=s-anna@ti.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
--cc=paul@crapouillou.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).