diff options
author | Nicolin Chen <nicoleotsuka@gmail.com> | 2015-02-14 20:22:49 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-24 09:46:13 -0500 |
commit | f23e860edbb3f2208c0ab3448e756689bb4a3760 (patch) | |
tree | 586003f1bfa289b5f9342893839deb4324ca8cbf /sound | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) |
ASoC: core: Add extra dapm properties for Device Tree
The current helper functions, snd_soc_of_parse_audio_simple_widgets()
and snd_soc_of_parse_audio_routing(), set dapm_widgets and dapm_routes
without caring if they are already set by using build-in widgets and
routes in the card driver. So there could be one of them, build-in one
or Device Tree one, overrided by the other depending on which one was
assigned later.
This patch adds an extra pair of dapm_widgets and dapm_routes for DT
use only so as to prevent unexpected overriding.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 30579ca5bacb..5c0658d49609 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1561,6 +1561,10 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1561 | snd_soc_dapm_new_controls(&card->dapm, card->dapm_widgets, | 1561 | snd_soc_dapm_new_controls(&card->dapm, card->dapm_widgets, |
1562 | card->num_dapm_widgets); | 1562 | card->num_dapm_widgets); |
1563 | 1563 | ||
1564 | if (card->of_dapm_widgets) | ||
1565 | snd_soc_dapm_new_controls(&card->dapm, card->of_dapm_widgets, | ||
1566 | card->num_of_dapm_widgets); | ||
1567 | |||
1564 | /* initialise the sound card only once */ | 1568 | /* initialise the sound card only once */ |
1565 | if (card->probe) { | 1569 | if (card->probe) { |
1566 | ret = card->probe(card); | 1570 | ret = card->probe(card); |
@@ -1616,6 +1620,10 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1616 | snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes, | 1620 | snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes, |
1617 | card->num_dapm_routes); | 1621 | card->num_dapm_routes); |
1618 | 1622 | ||
1623 | if (card->of_dapm_routes) | ||
1624 | snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes, | ||
1625 | card->num_of_dapm_routes); | ||
1626 | |||
1619 | for (i = 0; i < card->num_links; i++) { | 1627 | for (i = 0; i < card->num_links; i++) { |
1620 | if (card->dai_link[i].dai_fmt) | 1628 | if (card->dai_link[i].dai_fmt) |
1621 | snd_soc_runtime_set_dai_fmt(&card->rtd[i], | 1629 | snd_soc_runtime_set_dai_fmt(&card->rtd[i], |
@@ -3223,8 +3231,8 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, | |||
3223 | widgets[i].name = wname; | 3231 | widgets[i].name = wname; |
3224 | } | 3232 | } |
3225 | 3233 | ||
3226 | card->dapm_widgets = widgets; | 3234 | card->of_dapm_widgets = widgets; |
3227 | card->num_dapm_widgets = num_widgets; | 3235 | card->num_of_dapm_widgets = num_widgets; |
3228 | 3236 | ||
3229 | return 0; | 3237 | return 0; |
3230 | } | 3238 | } |
@@ -3308,8 +3316,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3308 | } | 3316 | } |
3309 | } | 3317 | } |
3310 | 3318 | ||
3311 | card->num_dapm_routes = num_routes; | 3319 | card->num_of_dapm_routes = num_routes; |
3312 | card->dapm_routes = routes; | 3320 | card->of_dapm_routes = routes; |
3313 | 3321 | ||
3314 | return 0; | 3322 | return 0; |
3315 | } | 3323 | } |