mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Vinod Koul <vinod.koul@intel.com>, Takashi Iwai <tiwai@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Laurent Pinchart <renesas@ideasonboard.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Qiao Zhou <zhouqiao@marvell.com>,
	Shengjiu Wang <shengjiu.wang@freescale.com>,
	Matt Campbell <mcampbell@izotope.com>,
	Jonah Petri <jpetri@izotope.com>,
	dmaengine@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 3/4] dmaengine: axi_dmac: Add synchronization support
Date: Tue, 20 Oct 2015 11:46:30 +0200	[thread overview]
Message-ID: <1445334391-12272-4-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1445334391-12272-1-git-send-email-lars@metafoo.de>

Implement the new device_synchronize() callback to allow proper
synchronization when stopping a channel. Since the driver already makes
sure that no new complete callbacks are scheduled after the
device_terminate_all() callback has been called, all left to do in the
device_synchronize() callback is to wait for all currently running complete
callbacks to finish.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/dma-axi-dmac.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 5b2395e..c346809 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -307,6 +307,13 @@ static int axi_dmac_terminate_all(struct dma_chan *c)
 	return 0;
 }
 
+static void axi_dmac_synchronize(struct dma_chan *c)
+{
+	struct axi_dmac_chan *chan = to_axi_dmac_chan(c);
+
+	vchan_synchronize(&chan->vchan);
+}
+
 static void axi_dmac_issue_pending(struct dma_chan *c)
 {
 	struct axi_dmac_chan *chan = to_axi_dmac_chan(c);
@@ -613,6 +620,7 @@ static int axi_dmac_probe(struct platform_device *pdev)
 	dma_dev->device_prep_dma_cyclic = axi_dmac_prep_dma_cyclic;
 	dma_dev->device_prep_interleaved_dma = axi_dmac_prep_interleaved;
 	dma_dev->device_terminate_all = axi_dmac_terminate_all;
+	dma_dev->device_synchronize = axi_dmac_synchronize;
 	dma_dev->dev = &pdev->dev;
 	dma_dev->chancnt = 1;
 	dma_dev->src_addr_widths = BIT(dmac->chan.src_width);
-- 
2.1.4


  parent reply	other threads:[~2015-10-20  9:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  9:46 [PATCH 0/4] dmaengine: Add transfer termination " Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 1/4] " Lars-Peter Clausen
2015-10-29 21:59   ` Andy Shevchenko
2015-10-30 14:16     ` Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function Lars-Peter Clausen
2015-10-20  9:46 ` Lars-Peter Clausen [this message]
2015-10-20  9:46 ` [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen
2015-10-20 11:17   ` Takashi Iwai
2015-10-20 11:40     ` Lars-Peter Clausen
2015-10-20 12:36       ` Takashi Iwai
2015-10-20 13:01       ` Lars-Peter Clausen
2015-10-29  1:26 ` [PATCH 0/4] dmaengine: Add transfer termination synchronization support 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=1445334391-12272-4-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=jpetri@izotope.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcampbell@izotope.com \
    --cc=renesas@ideasonboard.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=shengjiu.wang@freescale.com \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.com \
    --cc=zhouqiao@marvell.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

all inboxes | Powered by JetHome®