ASoC: soc-pcm: Allow to specify unidirectional dai_link
authorFabio Estevam <fabio.estevam@freescale.com>
Thu, 29 Aug 2013 13:32:13 +0000 (10:32 -0300)
committerMark Brown <broonie@linaro.org>
Sun, 1 Sep 2013 15:29:27 +0000 (16:29 +0100)
Add 'playback_only' and 'capture_only' fields that can be used for specifying
that a dai_link has a unidirectional capability.

The motivation for this is for the cases of systems, such as Freescale MX28,
that has two unidirectional DAIs.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
include/sound/soc.h
sound/soc/soc-pcm.c

index c0ac3bc7b7f41919e5dbff8496f8ca394958fa18..65414e82c762407a25d689266d25ad66a315ef72 100644 (file)
@@ -936,6 +936,10 @@ struct snd_soc_dai_link {
        /* machine stream operations */
        const struct snd_soc_ops *ops;
        const struct snd_soc_compr_ops *compr_ops;
+
+       /* For unidirectional dai links */
+       bool playback_only;
+       bool capture_only;
 };
 
 struct snd_soc_codec_conf {
index b6c640332a1722c95c27fa8aa99b4d8b135d456f..9abaa52efb2e682146eeaf4af481c25e5345f167 100644 (file)
@@ -2027,6 +2027,16 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
                        capture = 1;
        }
 
+       if (rtd->dai_link->playback_only) {
+               playback = 1;
+               capture = 0;
+       }
+
+       if (rtd->dai_link->capture_only) {
+               playback = 0;
+               capture = 1;
+       }
+
        /* create the PCM */
        if (rtd->dai_link->no_pcm) {
                snprintf(new_name, sizeof(new_name), "(%s)",