From: Viresh Kumar <viresh.kumar@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Viresh Kumar <vireshk@kernel.org>,
dmaengine@vger.kernel.org, Vinod Koul <vkoul@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Serge Semin <Sergey.Semin@baikalelectronics.ru>
Subject: Re: [PATCH v1] dmaengine: dw: Enable runtime PM
Date: Wed, 4 Nov 2020 08:35:22 +0530 [thread overview]
Message-ID: <20201104030522.rwvs6vxkqpnzectk@vireshk-i7> (raw)
In-Reply-To: <20201103183938.64752-1-andriy.shevchenko@linux.intel.com>
On 03-11-20, 20:39, Andy Shevchenko wrote:
> When consumer requests channel power on the DMA controller device
> and otherwise on the freeing channel resources.
>
> Note, in some cases consumer acquires channel at the ->probe() stage and
> releases it at the ->remove() stage. It will mean that DMA controller device
> will be powered during all this time if there is no assist from hardware
> to idle it. The above mentioned cases should be investigated separately
> and individually.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/dma/dw/core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index 7ab83fe601ed..19a23767533a 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -982,8 +982,11 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
>
> dev_vdbg(chan2dev(chan), "%s\n", __func__);
>
> + pm_runtime_get_sync(dw->dma.dev);
> +
> /* ASSERT: channel is idle */
> if (dma_readl(dw, CH_EN) & dwc->mask) {
> + pm_runtime_put_sync_suspend(dw->dma.dev);
> dev_dbg(chan2dev(chan), "DMA channel not idle?\n");
> return -EIO;
> }
> @@ -1000,6 +1003,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
> * We need controller-specific data to set up slave transfers.
> */
> if (chan->private && !dw_dma_filter(chan, chan->private)) {
> + pm_runtime_put_sync_suspend(dw->dma.dev);
> dev_warn(chan2dev(chan), "Wrong controller-specific data\n");
> return -EINVAL;
> }
> @@ -1043,6 +1047,8 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
> if (!dw->in_use)
> do_dw_dma_off(dw);
>
> + pm_runtime_put_sync_suspend(dw->dma.dev);
> +
> dev_vdbg(chan2dev(chan), "%s: done\n", __func__);
> }
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2020-11-04 3:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 18:39 [PATCH v1] dmaengine: dw: Enable runtime PM Andy Shevchenko
2020-11-04 3:05 ` Viresh Kumar [this message]
2020-11-09 11:49 ` Vinod Koul
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=20201104030522.rwvs6vxkqpnzectk@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=vireshk@kernel.org \
--cc=vkoul@kernel.org \
/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