linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Yuan Yao <yao.yuan@freescale.com>
Cc: stefan@agner.ch, arnd@arndb.de, dan.j.williams@intel.com,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support
Date: Tue, 27 Oct 2015 11:00:36 +0900	[thread overview]
Message-ID: <20151027020035.GC11691@vkoul-mobl.iind.intel.com> (raw)
In-Reply-To: <1445243465-7727-1-git-send-email-yao.yuan@freescale.com>

On Mon, Oct 19, 2015 at 04:31:05PM +0800, Yuan Yao wrote:

The patch overall looks fine, but
>  
> +static int fsl_edma_suspend_late(struct device *dev)

This needs protection and will have build failure when CONFIG_PM is not
defined

> +{
> +	struct fsl_edma_engine *fsl_edma = dev_get_drvdata(dev);
> +	struct fsl_edma_chan *fsl_chan;
> +	unsigned long flags;
> +	int i;
> +
> +	for (i = 0; i < fsl_edma->n_chans; i++) {
> +		fsl_chan = &fsl_edma->chans[i];
> +		spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
> +		/* Make sure chan is idle or will force disable. */
> +		if (unlikely(!fsl_chan->idle)) {
> +			dev_warn(dev, "WARN: There is non-idle channel.");
> +			fsl_edma_disable_request(fsl_chan);
> +			fsl_edma_chan_mux(fsl_chan, 0, false);
> +		}
> +
> +		fsl_chan->pm_state = SUSPENDED;
> +		spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags);
> +	}
> +
> +	return 0;
> +}
> +
> +static int fsl_edma_resume_early(struct device *dev)
> +{
> +	struct fsl_edma_engine *fsl_edma = dev_get_drvdata(dev);
> +	struct fsl_edma_chan *fsl_chan;
> +	int i;
> +
> +	for (i = 0; i < fsl_edma->n_chans; i++) {
> +		fsl_chan = &fsl_edma->chans[i];
> +		fsl_chan->pm_state = RUNNING;
> +		edma_writew(fsl_edma, 0x0, fsl_edma->membase + EDMA_TCD_CSR(i));
> +		if (fsl_chan->slave_id != 0)
> +			fsl_edma_chan_mux(fsl_chan, fsl_chan->slave_id, true);
> +	}
> +
> +	edma_writel(fsl_edma, EDMA_CR_ERGA | EDMA_CR_ERCA,
> +			fsl_edma->membase + EDMA_CR);
> +
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops fsl_edma_pm_ops = {
> +	.suspend_late   = fsl_edma_suspend_late,
> +	.resume_early   = fsl_edma_resume_early,
> +};

This one too, also why use late and early, pls add the note here

>  static const struct of_device_id fsl_edma_dt_ids[] = {
>  	{ .compatible = "fsl,vf610-edma", },
>  	{ /* sentinel */ }
> @@ -969,6 +1042,7 @@ static struct platform_driver fsl_edma_driver = {
>  	.driver		= {
>  		.name	= "fsl-edma",
>  		.of_match_table = fsl_edma_dt_ids,
> +		.pm     = &fsl_edma_pm_ops,
This will fail too if CONFIG_PM is not defined

-- 
~Vinod

  reply	other threads:[~2015-10-27  2:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19  8:31 [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Yuan Yao
2015-10-27  2:00 ` Vinod Koul [this message]
2015-10-27  3:58   ` Yao Yuan
2015-10-28  6: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=20151027020035.GC11691@vkoul-mobl.iind.intel.com \
    --to=vinod.koul@intel.com \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefan@agner.ch \
    --cc=yao.yuan@freescale.com \
    /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).