@@ -71,6 +71,7 @@ Optional CPU/CODEC subnodes properties:
it can be specified via "clocks" if system has
clock node (= common clock), or "system-clock-frequency"
(if system doens't support common clock)
+- system-clock-direction : "in" or "out", default "in"
Example 1 - single DAI link:
@@ -18,6 +18,7 @@ struct asoc_simple_dai {
const char *name;
unsigned int fmt;
unsigned int sysclk;
+ int sysclk_dir;
int slots;
int slot_width;
};
@@ -64,7 +64,8 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
}
if (set->sysclk) {
- ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
+ ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk,
+ set->sysclk_dir);
if (ret && ret != -ENOTSUPP) {
dev_err(dai->dev, "simple-card: set_sysclk error\n");
goto err;
@@ -116,6 +117,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
{
struct device_node *node;
struct clk *clk;
+ const char *str;
u32 val;
int ret;
@@ -138,6 +140,16 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
if (ret)
return ret;
+ ret = of_property_read_string(np, "system-clock-direction", &str);
+ if (ret == 0) {
+ if (!strcmp(str, "out"))
+ dai->sysclk_dir = SND_SOC_CLOCK_OUT;
+ else if (!strcmp(str, "in"))
+ dai->sysclk_dir = SND_SOC_CLOCK_IN;
+ else
+ return -EINVAL;
+ }
+
/*
* dai->sysclk come from
* "clocks = <&xxx>" (if system has common clock)
Select dir parameters for set_sysclk calls in the card init phase. Signed-off-by: Jyri Sarha <jsarha@ti.com> --- .../devicetree/bindings/sound/simple-card.txt | 1 + include/sound/simple_card.h | 1 + sound/soc/generic/simple-card.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-)