Message ID | 1445983540-27155-3-git-send-email-b45815@freescale.com |
---|---|
State | Not Applicable |
Headers | show |
On Tue, Oct 27, 2015 at 8:05 PM, Han Xu <b45815@freescale.com> wrote: > From: Huang Shijie <b32955@freescale.com> > > Deep Sleep Mode(dsm) turns off the power for APBH DMA module, DMA > need to be re-initialized when system resumed back. > > Signed-off-by: Huang Shijie <b32955@freescale.com> Huang's FSL address is no longer valid.
On Tue, Oct 27, 2015 at 05:05:35PM -0500, Han Xu wrote: > > -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) > +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) This change seems unrelated to patch description, can you explain why? > +#ifdef CONFIG_PM_SLEEP > +static int mxs_dma_pm_resume(struct device *dev) > +{ > + struct mxs_dma_engine *mxs_dma = dev_get_drvdata(dev); > + int ret; > + > + ret = mxs_dma_init(mxs_dma); > + if (ret) > + return ret; > + return 0; why not return mxs_dma_init() then!
Vinod, On Sat, 31 Oct 2015 07:12:44 +0530, Vinod Koul wrote: > On Tue, Oct 27, 2015 at 05:05:35PM -0500, Han Xu wrote: > > > > -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) > > +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) > > This change seems unrelated to patch description, can you explain why? It seems related: mxs_dma_init() is now no longer called at initialization time, but also when resuming, as visible... > > > +#ifdef CONFIG_PM_SLEEP > > +static int mxs_dma_pm_resume(struct device *dev) > > +{ > > + struct mxs_dma_engine *mxs_dma = dev_get_drvdata(dev); > > + int ret; > > + > > + ret = mxs_dma_init(mxs_dma); ... here. Thomas
On Mon, Nov 02, 2015 at 04:29:06PM +0100, Thomas Petazzoni wrote: > Vinod, > > On Sat, 31 Oct 2015 07:12:44 +0530, Vinod Koul wrote: > > On Tue, Oct 27, 2015 at 05:05:35PM -0500, Han Xu wrote: > > > > > > -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) > > > +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) > > > > This change seems unrelated to patch description, can you explain why? > > It seems related: mxs_dma_init() is now no longer called at > initialization time, but also when resuming, as visible... Right looks good then
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index 60de352..b8a4822e 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -693,7 +693,7 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, return mxs_chan->status; } -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) { int ret; @@ -835,6 +835,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev) mxs_dma->pdev = pdev; mxs_dma->dma_device.dev = &pdev->dev; + dev_set_drvdata(&pdev->dev, mxs_dma); /* mxs_dma gets 65535 bytes maximum sg size */ mxs_dma->dma_device.dev->dma_parms = &mxs_dma->dma_parms; @@ -872,9 +873,27 @@ static int __init mxs_dma_probe(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int mxs_dma_pm_resume(struct device *dev) +{ + struct mxs_dma_engine *mxs_dma = dev_get_drvdata(dev); + int ret; + + ret = mxs_dma_init(mxs_dma); + if (ret) + return ret; + return 0; +} +#endif /* CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops mxs_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, mxs_dma_pm_resume) +}; + static struct platform_driver mxs_dma_driver = { .driver = { .name = "mxs-dma", + .pm = &mxs_dma_pm_ops, .of_match_table = mxs_dma_dt_ids, }, .id_table = mxs_dma_ids,