From patchwork Tue Oct 20 09:46:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 7445721 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 087B39F302 for ; Tue, 20 Oct 2015 09:48:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39A3820880 for ; Tue, 20 Oct 2015 09:48:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EE1DC2064E for ; Tue, 20 Oct 2015 09:48:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 984CC266867; Tue, 20 Oct 2015 11:48:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 55B0E2665A9; Tue, 20 Oct 2015 11:46:53 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7CE09266579; Tue, 20 Oct 2015 11:46:50 +0200 (CEST) Received: from smtp-out-188.synserver.de (smtp-out-200.synserver.de [212.40.185.200]) by alsa0.perex.cz (Postfix) with ESMTP id E64EC2664B2 for ; Tue, 20 Oct 2015 11:46:44 +0200 (CEST) Received: (qmail 2930 invoked by uid 0); 20 Oct 2015 09:46:43 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 2410 Received: from pd9e2f76f.dip0.t-ipconnect.de (HELO lars-laptop.ad.analog.com) [217.226.247.111] by 217.119.54.77 with SMTP; 20 Oct 2015 09:46:42 -0000 From: Lars-Peter Clausen To: Vinod Koul , Takashi Iwai Date: Tue, 20 Oct 2015 11:46:30 +0200 Message-Id: <1445334391-12272-4-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445334391-12272-1-git-send-email-lars@metafoo.de> References: <1445334391-12272-1-git-send-email-lars@metafoo.de> Cc: Shengjiu Wang , Lars-Peter Clausen , Kuninori Morimoto , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Qiao Zhou , Laurent Pinchart , Matt Campbell , dmaengine@vger.kernel.org, Russell King , Dan Williams , Jonah Petri Subject: [alsa-devel] [PATCH 3/4] dmaengine: axi_dmac: Add synchronization support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);