[alsa-devel] [RFC PATCH 2/2] ASoC: add compress stream support

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Aug 2 20:09:27 CEST 2012


On Tue, Jul 31, 2012 at 12:11:40PM +0530, Vinod Koul wrote:
> From: Namarta Kohli <namartax.kohli at intel.com>
> 
> This patch adds the support to parse the compress dai's and then also adds the
> soc-compress.c file while handles the compress stream operations, mostly analogous 
> to what is done in the soc-pcm.c and additional handling of the compress
> operations

This is all mostly fine, though it's very sad that there's so much code
duplication between this and the regular PCM streams.  Some smallish
comments below.

> +	if (cstream->direction == SND_COMPRESS_PLAYBACK) {
> +		cpu_dai->playback_active++;
> +		codec_dai->playback_active++;
> +	} else {
> +		cpu_dai->capture_active++;
> +		codec_dai->capture_active++;
> +	}
> +	cpu_dai->active++;
> +	codec_dai->active++;

In quite a few places in the code there's missing blanks between blocks
of code.

> +int soc_compr_set_params(struct snd_compr_stream *cstream,
> +					struct snd_compr_params *params)
> +{

> +	snd_soc_dai_digital_mute(codec_dai, 0);

This looks wrong - the unmute should be associated with the start of the
data transfer rather than the configuration.  But we don't have any
other ops...  can we have one, or a non-atomic trigger?

> +	/* check client and interface hw capabilities */
> +	snprintf(new_name, sizeof(new_name), "%s %s-%d",
> +			rtd->dai_link->stream_name, codec_dai->name, num);
> +	/* TODO add support for cature */

Meow :)

> +	printk(KERN_INFO "asoc: %s <-> %s mapping ok\n", codec_dai->name,
> +		cpu_dai->name);

Say it's a compressed mapping?

> +	if (cpu_dai->driver->compress_dai) {
> +		/*create compress device*/
> +		ret = soc_new_compress(rtd, num);
> +		if (ret < 0 ) {
> +			printk(KERN_ERR "asoc: can't create offload %s\n",
> +					 dai_link->stream_name);
> +			return ret;
> +		}

Should we be complaining here if there's PCM operations too?
Alternatively, should we support mixed PCM and compressed DAIs (possibly
be creating two pcms from a single dai_link)?


More information about the Alsa-devel mailing list