diff options
author | Arnaud Pouliquen <arnaud.pouliquen@st.com> | 2015-06-05 04:19:05 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-12 07:35:54 -0400 |
commit | 85a4bfd895778960dc2d655087ac7ff442b6ab9e (patch) | |
tree | 786435d5b7983ec6b24291659fc087a914c87ae1 /sound/soc | |
parent | e0ae225b7e96e50daaa3ca8d3cd2c944ce48e007 (diff) |
ASoC: simple card: Add mclk-fs property in dai-link
Add mclk-fs ratio property per dai-link sub node. This will
allow to manage several codecs with different ratio.
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/generic/simple-card.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index c87e58504a62..d5554939146e 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -26,6 +26,7 @@ struct simple_card_data { | |||
26 | struct simple_dai_props { | 26 | struct simple_dai_props { |
27 | struct asoc_simple_dai cpu_dai; | 27 | struct asoc_simple_dai cpu_dai; |
28 | struct asoc_simple_dai codec_dai; | 28 | struct asoc_simple_dai codec_dai; |
29 | unsigned int mclk_fs; | ||
29 | } *dai_props; | 30 | } *dai_props; |
30 | unsigned int mclk_fs; | 31 | unsigned int mclk_fs; |
31 | int gpio_hp_det; | 32 | int gpio_hp_det; |
@@ -76,11 +77,18 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, | |||
76 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
77 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 78 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
78 | struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); | 79 | struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); |
79 | unsigned int mclk; | 80 | struct simple_dai_props *dai_props = |
81 | &priv->dai_props[rtd - rtd->card->rtd]; | ||
82 | unsigned int mclk, mclk_fs = 0; | ||
80 | int ret = 0; | 83 | int ret = 0; |
81 | 84 | ||
82 | if (priv->mclk_fs) { | 85 | if (priv->mclk_fs) |
83 | mclk = params_rate(params) * priv->mclk_fs; | 86 | mclk_fs = priv->mclk_fs; |
87 | else if (dai_props->mclk_fs) | ||
88 | mclk_fs = dai_props->mclk_fs; | ||
89 | |||
90 | if (mclk_fs) { | ||
91 | mclk = params_rate(params) * mclk_fs; | ||
84 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, | 92 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, |
85 | SND_SOC_CLOCK_IN); | 93 | SND_SOC_CLOCK_IN); |
86 | } | 94 | } |
@@ -313,6 +321,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
313 | char prop[128]; | 321 | char prop[128]; |
314 | char *prefix = ""; | 322 | char *prefix = ""; |
315 | int ret, cpu_args; | 323 | int ret, cpu_args; |
324 | u32 val; | ||
316 | 325 | ||
317 | /* For single DAI link & old style of DT node */ | 326 | /* For single DAI link & old style of DT node */ |
318 | if (is_top_level_node) | 327 | if (is_top_level_node) |
@@ -338,6 +347,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
338 | if (ret < 0) | 347 | if (ret < 0) |
339 | goto dai_link_of_err; | 348 | goto dai_link_of_err; |
340 | 349 | ||
350 | if (!of_property_read_u32(node, "mclk-fs", &val)) | ||
351 | dai_props->mclk_fs = val; | ||
352 | |||
341 | ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai, | 353 | ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai, |
342 | &dai_link->cpu_of_node, | 354 | &dai_link->cpu_of_node, |
343 | &dai_link->cpu_dai_name, | 355 | &dai_link->cpu_dai_name, |