All of lore.kernel.org
 help / color / mirror / Atom feed
* multi-component: determine which DAI is active?
@ 2010-07-21 22:47 Timur Tabi
  2010-07-22  8:09 ` Liam Girdwood
  2010-07-22  9:37 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Timur Tabi @ 2010-07-21 22:47 UTC (permalink / raw)
  To: Liam Girdwood, ALSA development

Liam,

In order to get fsl_dma.c to work with the WM8776, which has separate DAIs
for playback and capture, I've had to do this:

if (pcm->streams[0].substream) {
	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
		fsl_dma_hardware.buffer_bytes_max,
		&pcm->streams[0].substream->dma_buffer);
	if (ret) {
		dev_err(card->dev, "can't allocate playback dma buffer\n");
		return ret;
	}
}

if (pcm->streams[1].substream) {
	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
		fsl_dma_hardware.buffer_bytes_max,
		&pcm->streams[1].substream->dma_buffer);
	if (ret) {
		snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
		dev_err(card->dev, "can't allocate capture dma buffer\n");
		return ret;
	}
}

That is, I need to check if the 'substream' pointer has been initialized.

This looks ugly to me.  In an earlier version of ASoC, I would have done this:

if (dai->playback.channels_min) {
...

if (dai->capture.channels_min) {
...


But dai->playback and dai->capture no longer exist.  How should I handle this?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multi-component: determine which DAI is active?
  2010-07-21 22:47 multi-component: determine which DAI is active? Timur Tabi
@ 2010-07-22  8:09 ` Liam Girdwood
  2010-07-22  9:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-07-22  8:09 UTC (permalink / raw)
  To: Timur Tabi; +Cc: ALSA development

On Wed, 2010-07-21 at 17:47 -0500, Timur Tabi wrote:
> Liam,
> 
> In order to get fsl_dma.c to work with the WM8776, which has separate DAIs
> for playback and capture, I've had to do this:
> 
> if (pcm->streams[0].substream) {
> 	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
> 		fsl_dma_hardware.buffer_bytes_max,
> 		&pcm->streams[0].substream->dma_buffer);
> 	if (ret) {
> 		dev_err(card->dev, "can't allocate playback dma buffer\n");
> 		return ret;
> 	}
> }
> 
> if (pcm->streams[1].substream) {
> 	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
> 		fsl_dma_hardware.buffer_bytes_max,
> 		&pcm->streams[1].substream->dma_buffer);
> 	if (ret) {
> 		snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);
> 		dev_err(card->dev, "can't allocate capture dma buffer\n");
> 		return ret;
> 	}
> }
> 
> That is, I need to check if the 'substream' pointer has been initialized.
> 
> This looks ugly to me.  In an earlier version of ASoC, I would have done this:
> 
> if (dai->playback.channels_min) {
> ...
> 
> if (dai->capture.channels_min) {
> ...
> 
> 
> But dai->playback and dai->capture no longer exist.  How should I handle this?
> 

Since the DAI driver max/min supported number of channels is driver
specific and static, it's now in the DAI driver :-

if (dai->driver->playback.channels_min) {

Liam

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multi-component: determine which DAI is active?
  2010-07-21 22:47 multi-component: determine which DAI is active? Timur Tabi
  2010-07-22  8:09 ` Liam Girdwood
@ 2010-07-22  9:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-07-22  9:37 UTC (permalink / raw)
  To: Timur Tabi; +Cc: ALSA development, Liam Girdwood

On Wed, Jul 21, 2010 at 05:47:01PM -0500, Timur Tabi wrote:

> In order to get fsl_dma.c to work with the WM8776, which has separate DAIs
> for playback and capture, I've had to do this:

Please CC me on ASoC stuff even if it's multi-component (which hopefully
will be mainline very soon anyway!).  Liam will probably be the one to
answer still but it helps to have visibility.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-22  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 22:47 multi-component: determine which DAI is active? Timur Tabi
2010-07-22  8:09 ` Liam Girdwood
2010-07-22  9:37 ` Mark Brown

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.