Commit c1e230f0 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: soc_find_component() uses snd_soc_dai_link_component

soc_find_component() is using "of_node" and "name" to finding component,
but we should use snd_soc_dai_link_component now, because it is created
to such purpose.

This patch uses snd_soc_dai_link_component for soc_find_component().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a9ec8496
...@@ -780,19 +780,15 @@ static int snd_soc_is_matching_component( ...@@ -780,19 +780,15 @@ static int snd_soc_is_matching_component(
} }
static struct snd_soc_component *soc_find_component( static struct snd_soc_component *soc_find_component(
struct device_node *of_node, const char *name) const struct snd_soc_dai_link_component *dlc)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai_link_component dlc;
lockdep_assert_held(&client_mutex); lockdep_assert_held(&client_mutex);
for_each_component(component) { for_each_component(component)
dlc.name = name; if (snd_soc_is_matching_component(dlc, component))
dlc.of_node = of_node;
if (snd_soc_is_matching_component(&dlc, component))
return component; return component;
}
return NULL; return NULL;
} }
...@@ -1106,8 +1102,7 @@ static int soc_init_dai_link(struct snd_soc_card *card, ...@@ -1106,8 +1102,7 @@ static int soc_init_dai_link(struct snd_soc_card *card,
* added to component list. * added to component list.
*/ */
if ((link->platforms->of_node || link->platforms->name) && if ((link->platforms->of_node || link->platforms->name) &&
!soc_find_component(link->platforms->of_node, !soc_find_component(link->platforms))
link->platforms->name))
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
...@@ -1136,7 +1131,7 @@ static int soc_init_dai_link(struct snd_soc_card *card, ...@@ -1136,7 +1131,7 @@ static int soc_init_dai_link(struct snd_soc_card *card,
* component list. * component list.
*/ */
if ((link->cpus->of_node || link->cpus->name) && if ((link->cpus->of_node || link->cpus->name) &&
!soc_find_component(link->cpus->of_node, link->cpus->name)) !soc_find_component(link->cpus))
return -EPROBE_DEFER; return -EPROBE_DEFER;
/* /*
...@@ -1580,23 +1575,23 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num) ...@@ -1580,23 +1575,23 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
{ {
struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num]; struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
struct snd_soc_component *component; struct snd_soc_component *component;
const char *name; struct snd_soc_dai_link_component dlc;
struct device_node *codec_of_node;
if (aux_dev->codec_of_node || aux_dev->codec_name) { if (aux_dev->codec_of_node || aux_dev->codec_name) {
/* codecs, usually analog devices */ /* codecs, usually analog devices */
name = aux_dev->codec_name; dlc.name = aux_dev->codec_name;
codec_of_node = aux_dev->codec_of_node; dlc.of_node = aux_dev->codec_of_node;
component = soc_find_component(codec_of_node, name); component = soc_find_component(&dlc);
if (!component) { if (!component) {
if (codec_of_node) if (dlc.of_node)
name = of_node_full_name(codec_of_node); dlc.name = of_node_full_name(dlc.of_node);
goto err_defer; goto err_defer;
} }
} else if (aux_dev->name) { } else if (aux_dev->name) {
/* generic components */ /* generic components */
name = aux_dev->name; dlc.name = aux_dev->name;
component = soc_find_component(NULL, name); dlc.of_node = NULL;
component = soc_find_component(&dlc);
if (!component) if (!component)
goto err_defer; goto err_defer;
} else { } else {
...@@ -1610,7 +1605,7 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num) ...@@ -1610,7 +1605,7 @@ static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
return 0; return 0;
err_defer: err_defer:
dev_err(card->dev, "ASoC: %s not registered\n", name); dev_err(card->dev, "ASoC: %s not registered\n", dlc.name);
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
...@@ -3661,11 +3656,11 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); ...@@ -3661,11 +3656,11 @@ EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
int snd_soc_get_dai_id(struct device_node *ep) int snd_soc_get_dai_id(struct device_node *ep)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct device_node *node; struct snd_soc_dai_link_component dlc;
int ret; int ret;
node = of_graph_get_port_parent(ep); dlc.of_node = of_graph_get_port_parent(ep);
dlc.name = NULL;
/* /*
* For example HDMI case, HDMI has video/sound port, * For example HDMI case, HDMI has video/sound port,
* but ALSA SoC needs sound port number only. * but ALSA SoC needs sound port number only.
...@@ -3674,13 +3669,13 @@ int snd_soc_get_dai_id(struct device_node *ep) ...@@ -3674,13 +3669,13 @@ int snd_soc_get_dai_id(struct device_node *ep)
*/ */
ret = -ENOTSUPP; ret = -ENOTSUPP;
mutex_lock(&client_mutex); mutex_lock(&client_mutex);
component = soc_find_component(node, NULL); component = soc_find_component(&dlc);
if (component && if (component &&
component->driver->of_xlate_dai_id) component->driver->of_xlate_dai_id)
ret = component->driver->of_xlate_dai_id(component, ep); ret = component->driver->of_xlate_dai_id(component, ep);
mutex_unlock(&client_mutex); mutex_unlock(&client_mutex);
of_node_put(node); of_node_put(dlc.of_node);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment