kfree(dev);
}
-static int soc_aux_dev_init(struct snd_soc_card *card,
- struct snd_soc_codec *codec,
- int num)
+static int soc_aux_dev_init(struct snd_soc_card *card, int num)
{
struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
struct snd_soc_pcm_runtime *rtd = &card->rtd_aux[num];
/* do machine specific initialization */
if (aux_dev->init) {
- ret = aux_dev->init(&codec->dapm);
+ ret = aux_dev->init(&rtd->codec->dapm);
if (ret < 0)
return ret;
}
- rtd->codec = codec;
-
return 0;
}
}
static int soc_post_component_init(struct snd_soc_card *card,
- struct snd_soc_codec *codec,
int num, int dailess)
{
struct snd_soc_dai_link *dai_link = NULL;
aux_dev = &card->aux_dev[num];
rtd = &card->rtd_aux[num];
name = aux_dev->name;
- ret = soc_aux_dev_init(card, codec, num);
+ ret = soc_aux_dev_init(card, num);
}
if (ret < 0) {
/* add DAPM sysfs entries for this codec */
ret = snd_soc_dapm_sys_add(rtd->dev);
if (ret < 0)
- dev_err(codec->dev,
+ dev_err(rtd->dev,
"ASoC: failed to add codec dapm sysfs entries: %d\n", ret);
/* add codec sysfs entries */
ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
if (ret < 0)
- dev_err(codec->dev,
+ dev_err(rtd->dev,
"ASoC: failed to add codec sysfs files: %d\n", ret);
#ifdef CONFIG_DEBUG_FS
if (order != SND_SOC_COMP_ORDER_LAST)
return 0;
- ret = soc_post_component_init(card, codec, num, 0);
+ ret = soc_post_component_init(card, num, 0);
if (ret)
return ret;
}
#endif
-static int soc_check_aux_dev(struct snd_soc_card *card, int num)
-{
- struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
- const char *codecname = aux_dev->codec_name;
- struct snd_soc_codec *codec;
-
- codec = soc_find_codec(aux_dev->codec_of_node, aux_dev->codec_name);
- if (codec)
- return 0;
- if (aux_dev->codec_of_node)
- codecname = of_node_full_name(aux_dev->codec_of_node);
-
- dev_err(card->dev, "ASoC: %s not registered\n", codecname);
- return -EPROBE_DEFER;
-}
-
-static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
+static int soc_bind_aux_dev(struct snd_soc_card *card, int num)
{
+ struct snd_soc_pcm_runtime *rtd = &card->rtd_aux[num];
struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
const char *codecname = aux_dev->codec_name;
- int ret = -ENODEV;
- struct snd_soc_codec *codec;
- codec = soc_find_codec(aux_dev->codec_of_node, aux_dev->codec_name);
- if (!codec) {
+ rtd->codec = soc_find_codec(aux_dev->codec_of_node, codecname);
+ if (!rtd->codec) {
if (aux_dev->codec_of_node)
codecname = of_node_full_name(aux_dev->codec_of_node);
- /* codec not found */
- dev_err(card->dev, "ASoC: codec %s not found", codecname);
+ dev_err(card->dev, "ASoC: %s not registered\n", codecname);
return -EPROBE_DEFER;
}
- if (codec->probed) {
- dev_err(codec->dev, "ASoC: codec already probed");
+ return 0;
+}
+
+static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
+{
+ struct snd_soc_pcm_runtime *rtd = &card->rtd_aux[num];
+ int ret;
+
+ if (rtd->codec->probed) {
+ dev_err(rtd->codec->dev, "ASoC: codec already probed\n");
return -EBUSY;
}
- ret = soc_probe_codec(card, codec);
+ ret = soc_probe_codec(card, rtd->codec);
if (ret < 0)
return ret;
- ret = soc_post_component_init(card, codec, num, 1);
-
- return ret;
+ return soc_post_component_init(card, num, 1);
}
static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
goto base_error;
}
- /* check aux_devs too */
+ /* bind aux_devs too */
for (i = 0; i < card->num_aux_devs; i++) {
- ret = soc_check_aux_dev(card, i);
+ ret = soc_bind_aux_dev(card, i);
if (ret != 0)
goto base_error;
}