[alsa-devel] [PATCH 5/7] ASoC: soc-compress: Deduce stream direction

Vinod Koul vinod.koul at intel.com
Fri Apr 19 15:27:33 CEST 2013


On Thu, Apr 18, 2013 at 11:02:38AM +0100, Charles Keepax wrote:
> Previously we just hard coded all streams as playback streams, this
> patch checks the DAI to see if it is a capture or playback stream. It is
> worth noting that at this time only unidirectional streams are
> supported.
well the intention was the compress device would be either playback or record.
you should have two devices if you support both.

> 
> Signed-off-by: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>
> Signed-off-by: Richard Fitzgerald <rf at opensource.wolfsonmicro.com>
> ---
>  sound/soc/soc-compress.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
> index da83e56..3853f7e 100644
> --- a/sound/soc/soc-compress.c
> +++ b/sound/soc/soc-compress.c
> @@ -384,7 +384,14 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
>  	/* check client and interface hw capabilities */
>  	snprintf(new_name, sizeof(new_name), "%s %s-%d",
>  			rtd->dai_link->stream_name, codec_dai->name, num);
> -	direction = SND_COMPRESS_PLAYBACK;
> +
> +	if (codec_dai->driver->playback.channels_min)
> +		direction = SND_COMPRESS_PLAYBACK;
> +	else if (codec_dai->driver->capture.channels_min)
> +		direction = SND_COMPRESS_CAPTURE;
> +	else
> +		return -EINVAL;
> +
>  	compr = kzalloc(sizeof(*compr), GFP_KERNEL);
>  	if (compr == NULL) {
>  		snd_printk(KERN_ERR "Cannot allocate compr\n");
> -- 
> 1.7.2.5
> 


More information about the Alsa-devel mailing list