mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-22 22:24:06 +00:00
ASoC: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing
If a snd_soc_card has any DAPM routes when it calls snd_soc_of_parse_audio_routing, those are clobbered without this change. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
92a99ea439
commit
f8781db8ae
1 changed files with 9 additions and 5 deletions
|
@ -4585,7 +4585,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
const char *propname)
|
const char *propname)
|
||||||
{
|
{
|
||||||
struct device_node *np = card->dev->of_node;
|
struct device_node *np = card->dev->of_node;
|
||||||
int num_routes;
|
int num_routes, old_routes;
|
||||||
struct snd_soc_dapm_route *routes;
|
struct snd_soc_dapm_route *routes;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
@ -4603,7 +4603,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
|
old_routes = card->num_dapm_routes;
|
||||||
|
routes = devm_kzalloc(card->dev,
|
||||||
|
(old_routes + num_routes) * sizeof(*routes),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!routes) {
|
if (!routes) {
|
||||||
dev_err(card->dev,
|
dev_err(card->dev,
|
||||||
|
@ -4611,9 +4613,11 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
|
||||||
|
|
||||||
for (i = 0; i < num_routes; i++) {
|
for (i = 0; i < num_routes; i++) {
|
||||||
ret = of_property_read_string_index(np, propname,
|
ret = of_property_read_string_index(np, propname,
|
||||||
2 * i, &routes[i].sink);
|
2 * i, &routes[old_routes + i].sink);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(card->dev,
|
dev_err(card->dev,
|
||||||
"ASoC: Property '%s' index %d could not be read: %d\n",
|
"ASoC: Property '%s' index %d could not be read: %d\n",
|
||||||
|
@ -4621,7 +4625,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ret = of_property_read_string_index(np, propname,
|
ret = of_property_read_string_index(np, propname,
|
||||||
(2 * i) + 1, &routes[i].source);
|
(2 * i) + 1, &routes[old_routes + i].source);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(card->dev,
|
dev_err(card->dev,
|
||||||
"ASoC: Property '%s' index %d could not be read: %d\n",
|
"ASoC: Property '%s' index %d could not be read: %d\n",
|
||||||
|
@ -4630,7 +4634,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
card->num_dapm_routes = num_routes;
|
card->num_dapm_routes += num_routes;
|
||||||
card->dapm_routes = routes;
|
card->dapm_routes = routes;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue