summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-02-14 09:34:36 +0800
committerDarren Etheridge <detheridge@ti.com>2014-06-20 15:19:06 -0500
commitd4315ad7626d86bea9f96a0fabcddfb44840b8a0 (patch)
tree9b72498a7ca65fc7100e6a122e7eb1ad8abb9051 /sound
parentba5e802c5c1dcc5a2d0e532a4c6eeb76e3c7c7cf (diff)
ASoC: simple-card: add slot information parsing supports
[ Upstream commit 6ff62eedce4f7756b092d276165d8e11edab9f28 ] For some CPU/CODEC DAI devices the slot information maybe needed. This patch adds the slot information parsing for simple-card driver. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org> Signed-off-by: Darren Etheridge <detheridge@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4fe8abc6e21..bdd176ddff0 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,11 +9,14 @@
* published by the Free Software Foundation.
*/
#include <linux/clk.h>
+#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/string.h>
#include <sound/simple_card.h>
+#include <sound/soc-dai.h>
+#include <sound/soc.h>
struct simple_card_data {
struct snd_soc_card snd_card;
@@ -44,6 +47,16 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
}
}
+ if (set->slots) {
+ ret = snd_soc_dai_set_tdm_slot(dai, 0, 0,
+ set->slots,
+ set->slot_width);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+ goto err;
+ }
+ }
+
ret = 0;
err:
@@ -94,6 +107,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
if (ret < 0)
goto parse_error;
+ /* parse TDM slot */
+ ret = snd_soc_of_parse_tdm_slot(np, &dai->slots, &dai->slot_width);
+ if (ret)
+ goto parse_error;
+
/*
* bitclock-inversion, frame-inversion
* bitclock-master, frame-master