From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH 2/6] ASoC: omap-pcm: Request the DMA channel by name when dma_name is set for the dai Date: Thu, 11 Jul 2013 13:13:45 +0200 Message-ID: <51DE9369.7090703@metafoo.de> References: <1373537930-10467-1-git-send-email-peter.ujfalusi@ti.com> <1373537930-10467-3-git-send-email-peter.ujfalusi@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-out-052.synserver.de (smtp-out-052.synserver.de [212.40.185.52]) by alsa0.perex.cz (Postfix) with ESMTP id 0C8F82657DD for ; Thu, 11 Jul 2013 13:13:07 +0200 (CEST) In-Reply-To: <1373537930-10467-3-git-send-email-peter.ujfalusi@ti.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Peter Ujfalusi Cc: alsa-devel@alsa-project.org, Mark Brown , Liam Girdwood , Jarkko Nikula List-Id: alsa-devel@alsa-project.org On 07/11/2013 12:18 PM, Peter Ujfalusi wrote: > When booting with DT the platform_get_resource_byname() is not available to > get the DMA resource. In this case the DAI drivers will configure the dma_name > and omap-pcm can use this name to request the DMA channel. > > Signed-off-by: Peter Ujfalusi > --- > sound/soc/omap/omap-pcm.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c > index c28e042..00168ab 100644 > --- a/sound/soc/omap/omap-pcm.c > +++ b/sound/soc/omap/omap-pcm.c > @@ -113,14 +113,24 @@ static int omap_pcm_open(struct snd_pcm_substream *substream) > { > struct snd_soc_pcm_runtime *rtd = substream->private_data; > struct snd_dmaengine_dai_dma_data *dma_data; > + int ret; > > snd_soc_set_runtime_hwparams(substream, &omap_pcm_hardware); > > dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); > > - return snd_dmaengine_pcm_open_request_chan(substream, > - omap_dma_filter_fn, > - dma_data->filter_data); > + if (dma_data->dma_name) { I'd prefer not having to have to add a field for a OMAP specific hack to the generic struct. Two options which are in my opinion better: 1) Just use filter_data in both cases and check rtd->cpu_dai->dev.of_node to see whether to use it as the name to dma_request_slave_channel or as filter_data for snd_dmaengine_pcm_open_request_chan. 2) Add a omap_pcm_filter_data struct which looks like this struct omap_pcm_filter_data { int req; const char *dma_name; } And use that as the filter_data. > + struct dma_chan *chan; > + > + chan = dma_request_slave_channel(rtd->cpu_dai->dev, > + dma_data->dma_name); > + ret = snd_dmaengine_pcm_open(substream, chan); > + } else { > + ret = snd_dmaengine_pcm_open_request_chan(substream, > + omap_dma_filter_fn, > + dma_data->filter_data); > + } > + return ret; > } > > static int omap_pcm_mmap(struct snd_pcm_substream *substream,