From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754579Ab2F1MPn (ORCPT ); Thu, 28 Jun 2012 08:15:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35024 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126Ab2F1MPm (ORCPT ); Thu, 28 Jun 2012 08:15:42 -0400 Date: Thu, 28 Jun 2012 14:15:38 +0200 Message-ID: From: Takashi Iwai To: Lars-Peter Clausen Cc: Laxman Dewangan , perex@perex.cz, broonie@opensource.wolfsonmicro.com, lrg@ti.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, swarren@nvidia.com Subject: Re: [PATCH] ASoC: snd_dmaengine: add common api for pcm_mmap In-Reply-To: <4FEC3B70.5030902@metafoo.de> References: <1340866886-24432-1-git-send-email-ldewangan@nvidia.com> <4FEC3B70.5030902@metafoo.de> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 28 Jun 2012 13:09:36 +0200, Lars-Peter Clausen wrote: > > On 06/28/2012 09:01 AM, Laxman Dewangan wrote: > > The pcm mmap for the substream dma buffer is done using the > > dma_mmap_writecombine(). > > Some of the chip sound driver like Spear, Tegra, Davinci, > > ep93xx,snd_imx, snd_mxs, NUC900, OMAP, Samsung are doing this > > mapping locally. > > Add api in the snd dmaengine driver so that different client of > > snd dmaengine can use this rather than implementing locally. > > > > This is not really related to the dmaengine pcm driver. It's more of a > coincidence that all upstream drivers which use the dmaengine pcm driver > also use write-combined memory. In my opinion it would be better to add this > to the ALSA core. Now that there is a generic dma_mmap_writecombine it may > make sense to integrate this with snd_pcm_lib_default_mmap. Agreed. Also, it must be portable. So far, only ARM has dma_mmap_writecombine(), thus the build on other arch would fail as is. thanks, Takashi > > - Lars > > > Signed-off-by: Laxman Dewangan > > --- > > include/sound/dmaengine_pcm.h | 2 ++ > > sound/soc/soc-dmaengine-pcm.c | 17 +++++++++++++++++ > > 2 files changed, 19 insertions(+), 0 deletions(-) > > > > diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h > > index b877334..15c0d3c 100644 > > --- a/include/sound/dmaengine_pcm.h > > +++ b/include/sound/dmaengine_pcm.h > > @@ -47,4 +47,6 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream); > > > > struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream); > > > > +int snd_dmaengine_pcm_mmap_writecombine(struct snd_pcm_substream *substream, > > + struct vm_area_struct *vma); > > #endif > > diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c > > index 5df529e..6535eb3 100644 > > --- a/sound/soc/soc-dmaengine-pcm.c > > +++ b/sound/soc/soc-dmaengine-pcm.c > > @@ -21,6 +21,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -313,3 +314,19 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream) > > return 0; > > } > > EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close); > > + > > +/** > > + * snd_dmaengine_pcm_mmap_writecombine - mmap stream dma buffer using > > + * dma_mmap_writecombine(). > > + * @substream: PCM substream > > + * @vma: VM area. > > + */ > > +int snd_dmaengine_pcm_mmap_writecombine(struct snd_pcm_substream *substream, > > + struct vm_area_struct *vma) > > +{ > > + struct snd_pcm_runtime *runtime = substream->runtime; > > + > > + return dma_mmap_writecombine(substream->pcm->card->dev, vma, > > + runtime->dma_area, runtime->dma_addr, runtime->dma_bytes); > > +} > > +EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_mmap_writecombine); >