multi-component: determine which DAI is active?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux