All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Jonathan Corbet <corbet@lwn.net>,
	Russell King <linux@arm.linux.org.uk>,
	Dan Williams <dan.j.williams@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	dmaengine@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
	Michal Simek <michal.simek@xilinx.com>,
	Kevin Hilman <khilman@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v9 3/4] dma: pl330: add Power Management support
Date: Wed, 5 Nov 2014 19:31:16 +0530	[thread overview]
Message-ID: <20141105140116.GN1870@intel.com> (raw)
In-Reply-To: <1415105570-7871-4-git-send-email-k.kozlowski@samsung.com>

On Tue, Nov 04, 2014 at 01:52:49PM +0100, Krzysztof Kozlowski wrote:
>  bool pl330_filter(struct dma_chan *chan, void *param)
> @@ -2073,6 +2097,7 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
>  
>  	switch (cmd) {
>  	case DMA_TERMINATE_ALL:
> +		pm_runtime_get_sync(pl330->ddma.dev);
Why do we need _get() here? If we are terminating then channel is already in
use so should be active?

>  		spin_lock_irqsave(&pch->lock, flags);
>  
>  		spin_lock(&pl330->lock);
> @@ -2099,10 +2124,15 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
>  			dma_cookie_complete(&desc->txd);
>  		}
>  
> +		if (!list_empty(&pch->work_list))
> +			pm_runtime_put(pl330->ddma.dev);
Well else should be error here, so I would expect loud complains in that
case here
> +
>  		list_splice_tail_init(&pch->submitted_list, &pl330->desc_pool);
>  		list_splice_tail_init(&pch->work_list, &pl330->desc_pool);
>  		list_splice_tail_init(&pch->completed_list, &pl330->desc_pool);
>  		spin_unlock_irqrestore(&pch->lock, flags);
> +		pm_runtime_mark_last_busy(pl330->ddma.dev);
> +		pm_runtime_put_autosuspend(pl330->ddma.dev);
>  		break;
>  	case DMA_SLAVE_CONFIG:
>  		slave_config = (struct dma_slave_config *)arg;
> @@ -2138,6 +2168,7 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
>  
>  	tasklet_kill(&pch->task);
>  
> +	pm_runtime_get_sync(pch->dmac->ddma.dev);
Again why do we need _get() in free callback.

>  	spin_lock_irqsave(&pch->lock, flags);
>  
>  	pl330_release_channel(pch->thread);
> @@ -2147,6 +2178,8 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
>  		list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
>  
>  	spin_unlock_irqrestore(&pch->lock, flags);
> +	pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
> +	pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
>  }

> +
> +static int __maybe_unused pl330_resume(struct device *dev)
> +{
> +	struct amba_device *pcdev = to_amba_device(dev);
> +
> +	amba_pclk_prepare(pcdev);
> +
> +	/*
> +	 * TODO: Idea for future. The device should not be woken up after
> +	 * system resume if it is not needed. It could stay runtime suspended
> +	 * waiting for DMA requests. However for safe suspend and resume we
> +	 * forcibly resume the device here.
> +	 */
> +	return pm_runtime_force_resume(dev);
> +}
> +
> +static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume);
IIUC this sets .suspend and .resume, aren't you trying to add runtime
support as well?
Did you want UNIVERSAL_DEV_PM_OPS() ?

> +
>  static int
>  pl330_probe(struct amba_device *adev, const struct amba_id *id)
>  {
> @@ -2738,6 +2815,12 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>  		pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan,
>  		pcfg->num_peri, pcfg->num_events);
>  
> +	pm_runtime_irq_safe(&adev->dev);
> +	pm_runtime_use_autosuspend(&adev->dev);
> +	pm_runtime_set_autosuspend_delay(&adev->dev, PL330_AUTOSUSPEND_DELAY);
> +	pm_runtime_mark_last_busy(&adev->dev);
> +	pm_runtime_put_autosuspend(&adev->dev);
> +
>  	return 0;
>  probe_err3:
>  	/* Idle the DMAC */
> @@ -2764,6 +2847,8 @@ static int pl330_remove(struct amba_device *adev)
>  	struct pl330_dmac *pl330 = amba_get_drvdata(adev);
>  	struct dma_pl330_chan *pch, *_p;
>  
> +	pm_runtime_get_noresume(pl330->ddma.dev);
> +
>  	if (adev->dev.of_node)
>  		of_dma_controller_free(adev->dev.of_node);
>  
> @@ -2802,6 +2887,7 @@ static struct amba_driver pl330_driver = {
>  	.drv = {
>  		.owner = THIS_MODULE,
>  		.name = "dma-pl330",
> +		.pm = &pl330_pm,
>  	},
>  	.id_table = pl330_ids,
>  	.probe = pl330_probe,
> -- 
> 1.9.1
> 

Last please use the right subsystem name, dmaengine is patches.

-- 
~Vinod

  reply	other threads:[~2014-11-05 14:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 12:52 [PATCH v9 0/4] amba/dma: pl330: add Power Management support Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 1/4] amba: Add helpers for (un)preparing AMBA clock Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 2/4] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Krzysztof Kozlowski
2014-11-04 19:06   ` Ulf Hansson
2014-11-05  8:48     ` Krzysztof Kozlowski
2014-11-04 20:18   ` Pavel Machek
2014-11-05  8:42     ` Krzysztof Kozlowski
2014-11-07 12:13       ` Pavel Machek
2014-11-07 12:18         ` Krzysztof Kozlowski
2014-11-07 12:28           ` Pavel Machek
2014-11-07 13:21             ` Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 3/4] dma: pl330: add Power Management support Krzysztof Kozlowski
2014-11-05 14:01   ` Vinod Koul [this message]
2014-11-05 14:21     ` Krzysztof Kozlowski
2014-11-05 16:46       ` Vinod Koul
2014-11-04 12:52 ` [PATCH v9 4/4] amba: Remove unused amba_pclk_enable/disable macros Krzysztof Kozlowski

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=20141105140116.GN1870@intel.com \
    --to=vinod.koul@intel.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=michal.simek@xilinx.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=stern@rowland.harvard.edu \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.