summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-08-08 08:52:33 +0300
committerMark Brown <broonie@kernel.org>2019-08-09 20:12:27 +0300
commit3dc29b8b2062075602c7aff1514a120b4ed0187f (patch)
treecf8b9d9e04594b1e3b39a83cfc7480cbac99c61b /sound/soc/soc-core.c
parent83ee7ab1627b7597bbb9acc26b37e9f96fff40c9 (diff)
downloadlinux-3dc29b8b2062075602c7aff1514a120b4ed0187f.tar.xz
ASoC: soc-core: support snd_soc_dai_link_component for aux_dev
To find aux_dev, ASoC is using .name, codec_name, codec_of_node. Here, .name is used to fallback in case of no codec. But, we already have this kind of component finding method by snd_soc_dai_link_component and soc_find_component(). We shouldn't have duplicated implementation to do same things. This patch adds snd_soc_dai_link_component support to finding aux_dev. Now, no driver is using only .name. All drivers are using codec_name and/or codec_of_node. This means no driver is finding component from .name so far. (Actually almost all drivers are using .name as just "device name", not for finding component...) This patch 1) add snd_soc_dai_link_component support for aux_dev. legacy style will be removed if all drivers are switched to new style. 2) try to find component via snd_soc_dai_link_component. Then, it doesn't try to find via .name, because no driver is using it so far. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87y3046wcf.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bf45e60eb34f..56b99e340dda 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1537,38 +1537,22 @@ 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_component *component;
- struct snd_soc_dai_link_component dlc;
- if (aux_dev->codec_of_node || aux_dev->codec_name) {
- /* codecs, usually analog devices */
- dlc.name = aux_dev->codec_name;
- dlc.of_node = aux_dev->codec_of_node;
- component = soc_find_component(&dlc);
- if (!component) {
- if (dlc.of_node)
- dlc.name = of_node_full_name(dlc.of_node);
- goto err_defer;
- }
- } else if (aux_dev->name) {
- /* generic components */
- dlc.name = aux_dev->name;
- dlc.of_node = NULL;
- component = soc_find_component(&dlc);
- if (!component)
- goto err_defer;
- } else {
- dev_err(card->dev, "ASoC: Invalid auxiliary device\n");
- return -EINVAL;
- }
+ /* remove me */
+ if (aux_dev->codec_name)
+ aux_dev->dlc.name = aux_dev->codec_name;
+ if (aux_dev->codec_of_node)
+ aux_dev->dlc.of_node = aux_dev->codec_of_node;
+
+ /* codecs, usually analog devices */
+ component = soc_find_component(&aux_dev->dlc);
+ if (!component)
+ return -EPROBE_DEFER;
component->init = aux_dev->init;
list_add(&component->card_aux_list, &card->aux_comp_list);
return 0;
-
-err_defer:
- dev_err(card->dev, "ASoC: %s not registered\n", dlc.name);
- return -EPROBE_DEFER;
}
static int soc_probe_aux_devices(struct snd_soc_card *card)