All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
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	[thread overview]
Message-ID: <51DE9369.7090703@metafoo.de> (raw)
In-Reply-To: <1373537930-10467-3-git-send-email-peter.ujfalusi@ti.com>

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 <peter.ujfalusi@ti.com>

> ---
>  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,

  reply	other threads:[~2013-07-11 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 10:18 [PATCH 0/6] ASoC: Regression fix for OMAP in DT boot (3.11) Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 1/6] ASoC: dmaengine_pcm: Add dma_name to snd_dmaengine_dai_dma_data Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 2/6] ASoC: omap-pcm: Request the DMA channel by name when dma_name is set for the dai Peter Ujfalusi
2013-07-11 11:13   ` Lars-Peter Clausen [this message]
2013-07-11 12:30     ` Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 3/6] ASoC: omap-mcpdm: Do not use platform_get_resource_byname() for DMA Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 4/6] ASoC: omap-dmic: " Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 5/6] ASoC: omap-mcbsp: Use different method for DMA request when booted with DT Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 6/6] ASoC: omap-dmic: Cleanup the probe function Peter Ujfalusi
2013-07-11 11:10   ` Lars-Peter Clausen
2013-07-11 12:31     ` Peter Ujfalusi

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=51DE9369.7090703@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lgirdwood@gmail.com \
    --cc=peter.ujfalusi@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.