Skip to content

Commit

Permalink
ASoC: soc-compress: Deduce stream direction
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Charles Keepax authored and Takashi Iwai committed Apr 21, 2013
1 parent 49bb640 commit daa2db5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sound/soc/soc-compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit daa2db5

Please sign in to comment.