From patchwork Wed Feb 27 15:25:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 2193751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id E45E0DF2F2 for ; Wed, 27 Feb 2013 15:32:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAixQ-0002Sa-GL; Wed, 27 Feb 2013 15:30:12 +0000 Received: from co1ehsobe002.messaging.microsoft.com ([216.32.180.185] helo=co1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAitp-0000lO-IM for linux-arm-kernel@lists.infradead.org; Wed, 27 Feb 2013 15:26:30 +0000 Received: from mail5-co1-R.bigfish.com (10.243.78.226) by CO1EHSOBE012.bigfish.com (10.243.66.75) with Microsoft SMTP Server id 14.1.225.23; Wed, 27 Feb 2013 15:26:27 +0000 Received: from mail5-co1 (localhost [127.0.0.1]) by mail5-co1-R.bigfish.com (Postfix) with ESMTP id 9AE861E0543; Wed, 27 Feb 2013 15:26:27 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 7 X-BigFish: VS7(z1039ozzz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275dh8275bhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail5-co1 (localhost.localdomain [127.0.0.1]) by mail5-co1 (MessageSwitch) id 1361978785296268_17745; Wed, 27 Feb 2013 15:26:25 +0000 (UTC) Received: from CO1EHSMHS013.bigfish.com (unknown [10.243.78.253]) by mail5-co1.bigfish.com (Postfix) with ESMTP id 3B9F150004C; Wed, 27 Feb 2013 15:26:25 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS013.bigfish.com (10.243.66.23) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 27 Feb 2013 15:26:23 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.328.11; Wed, 27 Feb 2013 15:26:05 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.230]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r1RFPc0C026592; Wed, 27 Feb 2013 08:26:16 -0700 From: Shawn Guo To: Subject: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper Date: Wed, 27 Feb 2013 23:25:45 +0800 Message-ID: <1361978748-25281-10-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361978748-25281-1-git-send-email-shawn.guo@linaro.org> References: <1361978748-25281-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130227_102629_784066_3E74E5D6 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.185 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Fabio Estevam , alsa-devel@alsa-project.org, Arnd Bergmann , Huang Shijie , Vinod Koul , Mark Brown , Marek Vasut , Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With generic DMA device tree binding and helper function dma_request_slave_channel() in place, dmaengine_pcm should support that in requesting DMA channel for users that support generic DMA device tree binding. Instead of inventing a new API, it defines the parameters needed by dma_request_slave_channel() into struct snd_dma_channel_params, interprets filter_data into snd_dma_channel_params, and calls the helper in case that dmaengine_pcm users pass in a NULL filter_fn. Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL filter_fn and snd_dma_channel_params being filter_data to direct the API to request DMA channel using generic DMA helper. Signed-off-by: Shawn Guo Cc: Mark Brown Cc: alsa-devel@alsa-project.org --- include/sound/dmaengine_pcm.h | 5 +++++ sound/soc/soc-dmaengine-pcm.c | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index b877334..6c0f795 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -18,6 +18,11 @@ #include #include +struct snd_dma_channel_params { + struct device *dev; + char *name; +}; + /** * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM * substream diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c index 111b7d92..7ef8034 100644 --- a/sound/soc/soc-dmaengine-pcm.c +++ b/sound/soc/soc-dmaengine-pcm.c @@ -247,12 +247,19 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_pointer); static int dmaengine_pcm_request_channel(struct dmaengine_pcm_runtime_data *prtd, dma_filter_fn filter_fn, void *filter_data) { - dma_cap_mask_t mask; - - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - dma_cap_set(DMA_CYCLIC, mask); - prtd->dma_chan = dma_request_channel(mask, filter_fn, filter_data); + if (filter_fn) { + dma_cap_mask_t mask; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + dma_cap_set(DMA_CYCLIC, mask); + prtd->dma_chan = dma_request_channel(mask, filter_fn, + filter_data); + } else { + struct snd_dma_channel_params *params = filter_data; + prtd->dma_chan = dma_request_slave_channel(params->dev, + params->name); + } if (!prtd->dma_chan) return -ENXIO;