diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-03-18 00:50:17 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-18 10:44:47 -0400 |
commit | d708d35ef084535ba1a06d0c0f858e18a5edef5a (patch) | |
tree | 76247728b8e7c025fb83b77f660cdc87f0d60176 /sound/soc/generic | |
parent | cdc444721b0eea6817d1003add2f99414dc8028d (diff) |
ASoC: simple-card: add simple_parse_mclk_fs()
It is parsing mclk_fs at many places, but it should be
same operation. This patch adds simple_parse_mclk_fs()
and parse it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r-- | sound/soc/generic/simple-card.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 5238c912cecd..b792638a11c8 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -187,6 +187,26 @@ static void simple_parse_convert(struct device *dev, | |||
187 | of_node_put(node); | 187 | of_node_put(node); |
188 | } | 188 | } |
189 | 189 | ||
190 | static void simple_parse_mclk_fs(struct device_node *top, | ||
191 | struct device_node *cpu, | ||
192 | struct device_node *codec, | ||
193 | struct simple_dai_props *props, | ||
194 | char *prefix) | ||
195 | { | ||
196 | struct device_node *node = of_get_parent(cpu); | ||
197 | char prop[128]; | ||
198 | |||
199 | snprintf(prop, sizeof(prop), "%smclk-fs", PREFIX); | ||
200 | of_property_read_u32(top, prop, &props->mclk_fs); | ||
201 | |||
202 | snprintf(prop, sizeof(prop), "%smclk-fs", prefix); | ||
203 | of_property_read_u32(node, prop, &props->mclk_fs); | ||
204 | of_property_read_u32(cpu, prop, &props->mclk_fs); | ||
205 | of_property_read_u32(codec, prop, &props->mclk_fs); | ||
206 | |||
207 | of_node_put(node); | ||
208 | } | ||
209 | |||
190 | static int simple_dai_link_of_dpcm(struct simple_priv *priv, | 210 | static int simple_dai_link_of_dpcm(struct simple_priv *priv, |
191 | struct device_node *np, | 211 | struct device_node *np, |
192 | struct device_node *codec, | 212 | struct device_node *codec, |
@@ -200,7 +220,6 @@ static int simple_dai_link_of_dpcm(struct simple_priv *priv, | |||
200 | struct snd_soc_dai_link_component *codecs = dai_link->codecs; | 220 | struct snd_soc_dai_link_component *codecs = dai_link->codecs; |
201 | struct device_node *top = dev->of_node; | 221 | struct device_node *top = dev->of_node; |
202 | struct device_node *node = of_get_parent(np); | 222 | struct device_node *node = of_get_parent(np); |
203 | char prop[128]; | ||
204 | char *prefix = ""; | 223 | char *prefix = ""; |
205 | int ret; | 224 | int ret; |
206 | 225 | ||
@@ -296,6 +315,7 @@ static int simple_dai_link_of_dpcm(struct simple_priv *priv, | |||
296 | } | 315 | } |
297 | 316 | ||
298 | simple_parse_convert(dev, np, &dai_props->adata); | 317 | simple_parse_convert(dev, np, &dai_props->adata); |
318 | simple_parse_mclk_fs(top, np, codec, dai_props, prefix); | ||
299 | 319 | ||
300 | asoc_simple_card_canonicalize_platform(dai_link); | 320 | asoc_simple_card_canonicalize_platform(dai_link); |
301 | 321 | ||
@@ -303,11 +323,6 @@ static int simple_dai_link_of_dpcm(struct simple_priv *priv, | |||
303 | if (ret) | 323 | if (ret) |
304 | return ret; | 324 | return ret; |
305 | 325 | ||
306 | snprintf(prop, sizeof(prop), "%smclk-fs", prefix); | ||
307 | of_property_read_u32(top, PREFIX "mclk-fs", &dai_props->mclk_fs); | ||
308 | of_property_read_u32(node, prop, &dai_props->mclk_fs); | ||
309 | of_property_read_u32(np, prop, &dai_props->mclk_fs); | ||
310 | |||
311 | ret = asoc_simple_card_parse_daifmt(dev, node, codec, | 326 | ret = asoc_simple_card_parse_daifmt(dev, node, codec, |
312 | prefix, &dai_link->dai_fmt); | 327 | prefix, &dai_link->dai_fmt); |
313 | if (ret < 0) | 328 | if (ret < 0) |
@@ -372,11 +387,7 @@ static int simple_dai_link_of(struct simple_priv *priv, | |||
372 | if (ret < 0) | 387 | if (ret < 0) |
373 | goto dai_link_of_err; | 388 | goto dai_link_of_err; |
374 | 389 | ||
375 | snprintf(prop, sizeof(prop), "%smclk-fs", prefix); | 390 | simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix); |
376 | of_property_read_u32(top, PREFIX "mclk-fs", &dai_props->mclk_fs); | ||
377 | of_property_read_u32(node, prop, &dai_props->mclk_fs); | ||
378 | of_property_read_u32(cpu, prop, &dai_props->mclk_fs); | ||
379 | of_property_read_u32(codec, prop, &dai_props->mclk_fs); | ||
380 | 391 | ||
381 | ret = asoc_simple_card_parse_cpu(cpu, dai_link, | 392 | ret = asoc_simple_card_parse_cpu(cpu, dai_link, |
382 | DAI, CELL, &single_cpu); | 393 | DAI, CELL, &single_cpu); |