Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Timur Tabi <timur@freescale.com>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: multi-component: determine which DAI is active?
Date: Thu, 22 Jul 2010 09:09:35 +0100	[thread overview]
Message-ID: <1279786175.3083.14.camel@odin> (raw)
In-Reply-To: <4C4778E5.6090200@freescale.com>

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

  reply	other threads:[~2010-07-22  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 22:47 multi-component: determine which DAI is active? Timur Tabi
2010-07-22  8:09 ` Liam Girdwood [this message]
2010-07-22  9:37 ` Mark Brown

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=1279786175.3083.14.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=timur@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox