|
|
@@ -1413,6 +1413,42 @@ static int soc_probe_codec_dai(struct snd_soc_card *card,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static int soc_link_dai_widgets(struct snd_soc_card *card,
|
|
|
+ struct snd_soc_dai_link *dai_link,
|
|
|
+ struct snd_soc_dai *cpu_dai,
|
|
|
+ struct snd_soc_dai *codec_dai)
|
|
|
+{
|
|
|
+ struct snd_soc_dapm_widget *play_w, *capture_w;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ /* link the DAI widgets */
|
|
|
+ play_w = codec_dai->playback_widget;
|
|
|
+ capture_w = cpu_dai->capture_widget;
|
|
|
+ if (play_w && capture_w) {
|
|
|
+ ret = snd_soc_dapm_new_pcm(card, dai_link->params,
|
|
|
+ capture_w, play_w);
|
|
|
+ if (ret != 0) {
|
|
|
+ dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
|
|
|
+ play_w->name, capture_w->name, ret);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ play_w = cpu_dai->playback_widget;
|
|
|
+ capture_w = codec_dai->capture_widget;
|
|
|
+ if (play_w && capture_w) {
|
|
|
+ ret = snd_soc_dapm_new_pcm(card, dai_link->params,
|
|
|
+ capture_w, play_w);
|
|
|
+ if (ret != 0) {
|
|
|
+ dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
|
|
|
+ play_w->name, capture_w->name, ret);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
|
|
|
{
|
|
|
struct snd_soc_dai_link *dai_link = &card->dai_link[num];
|
|
|
@@ -1421,7 +1457,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
|
|
|
struct snd_soc_platform *platform = rtd->platform;
|
|
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
|
- struct snd_soc_dapm_widget *play_w, *capture_w;
|
|
|
int ret;
|
|
|
|
|
|
dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n",
|
|
|
@@ -1502,29 +1537,10 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
|
|
|
codec2codec_close_delayed_work);
|
|
|
|
|
|
/* link the DAI widgets */
|
|
|
- play_w = codec_dai->playback_widget;
|
|
|
- capture_w = cpu_dai->capture_widget;
|
|
|
- if (play_w && capture_w) {
|
|
|
- ret = snd_soc_dapm_new_pcm(card, dai_link->params,
|
|
|
- capture_w, play_w);
|
|
|
- if (ret != 0) {
|
|
|
- dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
|
|
|
- play_w->name, capture_w->name, ret);
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- play_w = cpu_dai->playback_widget;
|
|
|
- capture_w = codec_dai->capture_widget;
|
|
|
- if (play_w && capture_w) {
|
|
|
- ret = snd_soc_dapm_new_pcm(card, dai_link->params,
|
|
|
- capture_w, play_w);
|
|
|
- if (ret != 0) {
|
|
|
- dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
|
|
|
- play_w->name, capture_w->name, ret);
|
|
|
- return ret;
|
|
|
- }
|
|
|
- }
|
|
|
+ ret = soc_link_dai_widgets(card, dai_link,
|
|
|
+ cpu_dai, codec_dai);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
}
|
|
|
}
|
|
|
|