summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2013-04-18 11:02:38 +0100
committerTakashi Iwai <tiwai@suse.de>2013-04-21 09:53:43 +0200
commitdaa2db59ce7e36011a6c92a0342cd0919b9fb7d3 (patch)
tree30238f3c030a82cdb2f41e8d43dc7bbf81198668 /sound/soc
parent49bb6402f1aa1effa9d9c5df39d91a86ca8fd736 (diff)
downloadlinux-3.10-daa2db59ce7e36011a6c92a0342cd0919b9fb7d3.tar.gz
linux-3.10-daa2db59ce7e36011a6c92a0342cd0919b9fb7d3.tar.bz2
linux-3.10-daa2db59ce7e36011a6c92a0342cd0919b9fb7d3.zip
ASoC: soc-compress: Deduce stream direction
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>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-compress.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index da83e5658f6..3853f7eb3f2 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");