diff options
author | Vitaly Wool <vitalywool@gmail.com> | 2017-08-17 07:42:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-09-01 06:34:23 -0400 |
commit | a728f56094e7cf60a1dc0642fe86901d1a4dfb4e (patch) | |
tree | 0474d29ca412711f5bd23b9456c90407b6d04f33 | |
parent | 0995fb7c9802dd76422db384991f32296f8fbe1f (diff) |
ASoC: make clock direction configurable in asoc-simple
Some CPU drivers (e. g. davinci-mcasp) may require the system clock to
be configured as OUT, while there's no good way currently to set
SND_SOC_CLK_OUT in simple-soc driver if the clock is fixed-rate.
This patch makes asoc_simple_card_init_dai() initialize clock to
SND_SOCK_CLK_OUT if explicitly stated in the relevant dts file. This
change is transparent and doesn't change the default behavior.
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | Documentation/devicetree/bindings/sound/simple-card.txt | 3 | ||||
-rw-r--r-- | include/sound/simple_card_utils.h | 1 | ||||
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 9 |
3 files changed, 11 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c7a93931fad2..166f2290233b 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt | |||
@@ -86,6 +86,9 @@ Optional CPU/CODEC subnodes properties: | |||
86 | in dai startup() and disabled with | 86 | in dai startup() and disabled with |
87 | clk_disable_unprepare() in dai | 87 | clk_disable_unprepare() in dai |
88 | shutdown(). | 88 | shutdown(). |
89 | - system-clock-direction-out : specifies clock direction as 'out' on | ||
90 | initialization. It is useful for some aCPUs with | ||
91 | fixed clocks. | ||
89 | 92 | ||
90 | Example 1 - single DAI link: | 93 | Example 1 - single DAI link: |
91 | 94 | ||
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 42c6a6ac3ce6..7e25afce6566 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h | |||
@@ -15,6 +15,7 @@ | |||
15 | struct asoc_simple_dai { | 15 | struct asoc_simple_dai { |
16 | const char *name; | 16 | const char *name; |
17 | unsigned int sysclk; | 17 | unsigned int sysclk; |
18 | int clk_direction; | ||
18 | int slots; | 19 | int slots; |
19 | int slot_width; | 20 | int slot_width; |
20 | unsigned int tx_slot_mask; | 21 | unsigned int tx_slot_mask; |
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 26d64fa40c9c..af44c8c52a19 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -196,7 +196,11 @@ int asoc_simple_card_parse_clk(struct device *dev, | |||
196 | simple_dai->sysclk = clk_get_rate(clk); | 196 | simple_dai->sysclk = clk_get_rate(clk); |
197 | } | 197 | } |
198 | 198 | ||
199 | dev_dbg(dev, "%s : sysclk = %d\n", name, simple_dai->sysclk); | 199 | if (of_property_read_bool(node, "system-clock-direction-out")) |
200 | simple_dai->clk_direction = SND_SOC_CLOCK_OUT; | ||
201 | |||
202 | dev_dbg(dev, "%s : sysclk = %d, direction %d\n", name, | ||
203 | simple_dai->sysclk, simple_dai->clk_direction); | ||
200 | 204 | ||
201 | return 0; | 205 | return 0; |
202 | } | 206 | } |
@@ -310,7 +314,8 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, | |||
310 | int ret; | 314 | int ret; |
311 | 315 | ||
312 | if (simple_dai->sysclk) { | 316 | if (simple_dai->sysclk) { |
313 | ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0); | 317 | ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, |
318 | simple_dai->clk_direction); | ||
314 | if (ret && ret != -ENOTSUPP) { | 319 | if (ret && ret != -ENOTSUPP) { |
315 | dev_err(dai->dev, "simple-card: set_sysclk error\n"); | 320 | dev_err(dai->dev, "simple-card: set_sysclk error\n"); |
316 | return ret; | 321 | return ret; |