Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256402 > unrolled thread

Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support

Started byVinod Koul <vinod.koul@intel.com>
First post2015-10-27 03:10 +0100
Last post2015-10-28 07:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Vinod Koul <vinod.koul@intel.com> - 2015-10-27 03:10 +0100
    RE: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Yao Yuan <yao.yuan@freescale.com> - 2015-10-27 05:20 +0100
      Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support Vinod Koul <vinod.koul@intel.com> - 2015-10-28 07:50 +0100

#1256402 — Re: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support

FromVinod Koul <vinod.koul@intel.com>
Date2015-10-27 03:10 +0100
SubjectRe: [PATCH v3] dmaengine: fsl-edma: add PM suspend/resume support
Message-ID<qo1S2-7Dy-17@gated-at.bofh.it>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1256451

FromYao Yuan <yao.yuan@freescale.com>
Date2015-10-27 05:20 +0100
Message-ID<qo3TP-Ad-3@gated-at.bofh.it>
In reply to#1256402
Hi Vinod,

Thanks for your review.
I did the test and it seems that it should be ok when CONFIG_PM is not defined.
So I removed the protection code to make it more readable.
Do you think is it ok?

Best Regards,
Yuan Yao

> -----Original Message-----
> From: Vinod Koul [mailto:vinod.koul@intel.com]
> Sent: Tuesday, October 27, 2015 10:01 AM
> To: Yuan Yao-B46683 <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
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1257714

FromVinod Koul <vinod.koul@intel.com>
Date2015-10-28 07:50 +0100
Message-ID<qosIx-7ys-15@gated-at.bofh.it>
In reply to#1256451
On Tue, Oct 27, 2015 at 03:58:31AM +0000, Yao Yuan wrote:
> Hi Vinod,
> 

Please do not top post

> Thanks for your review.
> I did the test and it seems that it should be ok when CONFIG_PM is not defined.
> So I removed the protection code to make it more readable.
> Do you think is it ok?

Yes I did check, this seems okay, pls ignore this comment. You still need to
explain why you use late/early calls

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web