From 9d867d567a4a97f3e5e55802cf6b98bd814cc06b Mon Sep 17 00:00:00 2001 From: Hien Dang Date: Wed, 18 May 2016 17:28:40 +0700 Subject: [PATCH] dmaengine: rcar-dmac: Support S2RAM It is not necessary to backup/restore module registers. They will be set when a new transaction starts. Signed-off-by: Hien Dang --- drivers/dma/sh/rcar-dmac.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index fd188fec9c9113..8e647cdf5c9f71 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1638,16 +1638,26 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec, #ifdef CONFIG_PM_SLEEP static int rcar_dmac_sleep_suspend(struct device *dev) { - /* - * TODO: Wait for the current transfer to complete and stop the device. - */ + struct rcar_dmac *dmac = dev_get_drvdata(dev); + int i; + + for (i = 0; i < dmac->n_channels; ++i) { + if (!dmac->channels[i].iomem) + break; + + spin_lock(&dmac->channels[i].lock); + rcar_dmac_chan_halt(&dmac->channels[i]); + spin_unlock(&dmac->channels[i].lock); + } + return 0; } static int rcar_dmac_sleep_resume(struct device *dev) { - /* TODO: Resume transfers, if any. */ - return 0; + struct rcar_dmac *dmac = dev_get_drvdata(dev); + + return rcar_dmac_init(dmac); } #endif