aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-02-13 20:34:36 -0500
committerMark Brown <broonie@linaro.org>2014-02-23 00:26:37 -0500
commit6ff62eedce4f7756b092d276165d8e11edab9f28 (patch)
treeb52cfb38d78ce03aa49ac270d556b5d0e099c69f
parentff2878644eed7765a917a02d0af864697ceaf73e (diff)
ASoC: simple-card: add slot information parsing supports
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>
-rw-r--r--Documentation/devicetree/bindings/sound/simple-card.txt5
-rw-r--r--include/sound/simple_card.h2
-rw-r--r--sound/soc/generic/simple-card.c18
3 files changed, 25 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index 05273583490c..b30c222f9cd3 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -18,6 +18,8 @@ Optional properties:
18 Each entry is a pair of strings, the first being the 18 Each entry is a pair of strings, the first being the
19 connection's sink, the second being the connection's 19 connection's sink, the second being the connection's
20 source. 20 source.
21- dai-tdm-slot-num : Please refer to tdm-slot.txt.
22- dai-tdm-slot-width : Please refer to tdm-slot.txt.
21 23
22Required subnodes: 24Required subnodes:
23 25
@@ -56,6 +58,9 @@ sound {
56 "Headphone Jack", "HP_OUT", 58 "Headphone Jack", "HP_OUT",
57 "External Speaker", "LINE_OUT"; 59 "External Speaker", "LINE_OUT";
58 60
61 dai-tdm-slot-num = <2>;
62 dai-tdm-slot-width = <8>;
63
59 simple-audio-card,cpu { 64 simple-audio-card,cpu {
60 sound-dai = <&sh_fsi2 0>; 65 sound-dai = <&sh_fsi2 0>;
61 }; 66 };
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index e1ac996c8feb..9b0ac77177b6 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -18,6 +18,8 @@ struct asoc_simple_dai {
18 const char *name; 18 const char *name;
19 unsigned int fmt; 19 unsigned int fmt;
20 unsigned int sysclk; 20 unsigned int sysclk;
21 int slots;
22 int slot_width;
21}; 23};
22 24
23struct asoc_simple_card_info { 25struct asoc_simple_card_info {
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 4fe8abc6e216..bdd176ddff07 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -9,11 +9,14 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/device.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/of.h> 14#include <linux/of.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <sound/simple_card.h> 17#include <sound/simple_card.h>
18#include <sound/soc-dai.h>
19#include <sound/soc.h>
17 20
18struct simple_card_data { 21struct simple_card_data {
19 struct snd_soc_card snd_card; 22 struct snd_soc_card snd_card;
@@ -44,6 +47,16 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
44 } 47 }
45 } 48 }
46 49
50 if (set->slots) {
51 ret = snd_soc_dai_set_tdm_slot(dai, 0, 0,
52 set->slots,
53 set->slot_width);
54 if (ret && ret != -ENOTSUPP) {
55 dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
56 goto err;
57 }
58 }
59
47 ret = 0; 60 ret = 0;
48 61
49err: 62err:
@@ -94,6 +107,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
94 if (ret < 0) 107 if (ret < 0)
95 goto parse_error; 108 goto parse_error;
96 109
110 /* parse TDM slot */
111 ret = snd_soc_of_parse_tdm_slot(np, &dai->slots, &dai->slot_width);
112 if (ret)
113 goto parse_error;
114
97 /* 115 /*
98 * bitclock-inversion, frame-inversion 116 * bitclock-inversion, frame-inversion
99 * bitclock-master, frame-master 117 * bitclock-master, frame-master