Commit 6ff62eed authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown

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: default avatarXiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent ff287864
...@@ -18,6 +18,8 @@ Optional properties: ...@@ -18,6 +18,8 @@ Optional properties:
Each entry is a pair of strings, the first being the Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's connection's sink, the second being the connection's
source. source.
- dai-tdm-slot-num : Please refer to tdm-slot.txt.
- dai-tdm-slot-width : Please refer to tdm-slot.txt.
Required subnodes: Required subnodes:
...@@ -56,6 +58,9 @@ sound { ...@@ -56,6 +58,9 @@ sound {
"Headphone Jack", "HP_OUT", "Headphone Jack", "HP_OUT",
"External Speaker", "LINE_OUT"; "External Speaker", "LINE_OUT";
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <8>;
simple-audio-card,cpu { simple-audio-card,cpu {
sound-dai = <&sh_fsi2 0>; sound-dai = <&sh_fsi2 0>;
}; };
......
...@@ -18,6 +18,8 @@ struct asoc_simple_dai { ...@@ -18,6 +18,8 @@ struct asoc_simple_dai {
const char *name; const char *name;
unsigned int fmt; unsigned int fmt;
unsigned int sysclk; unsigned int sysclk;
int slots;
int slot_width;
}; };
struct asoc_simple_card_info { struct asoc_simple_card_info {
......
...@@ -9,11 +9,14 @@ ...@@ -9,11 +9,14 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/string.h> #include <linux/string.h>
#include <sound/simple_card.h> #include <sound/simple_card.h>
#include <sound/soc-dai.h>
#include <sound/soc.h>
struct simple_card_data { struct simple_card_data {
struct snd_soc_card snd_card; struct snd_soc_card snd_card;
...@@ -44,6 +47,16 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, ...@@ -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; ret = 0;
err: err:
...@@ -94,6 +107,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np, ...@@ -94,6 +107,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
if (ret < 0) if (ret < 0)
goto parse_error; 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-inversion, frame-inversion
* bitclock-master, frame-master * bitclock-master, frame-master
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment