aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--sound/soc/soc-core.c28
2 files changed, 31 insertions, 0 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 200e1f04c166..58acd00cae19 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -256,6 +256,9 @@ struct snd_soc_dai_driver {
256 int (*resume)(struct snd_soc_dai *dai); 256 int (*resume)(struct snd_soc_dai *dai);
257 /* compress dai */ 257 /* compress dai */
258 int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num); 258 int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
259 /* Optional Callback used at pcm creation*/
260 int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
261 struct snd_soc_dai *dai);
259 /* DAI is also used for the control bus */ 262 /* DAI is also used for the control bus */
260 bool bus_control; 263 bool bus_control;
261 264
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f1901bb1466e..32b8c42be796 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1593,6 +1593,27 @@ static int soc_probe_dai(struct snd_soc_dai *dai, int order)
1593 return 0; 1593 return 0;
1594} 1594}
1595 1595
1596static int soc_link_dai_pcm_new(struct snd_soc_dai **dais, int num_dais,
1597 struct snd_soc_pcm_runtime *rtd)
1598{
1599 int i, ret = 0;
1600
1601 for (i = 0; i < num_dais; ++i) {
1602 struct snd_soc_dai_driver *drv = dais[i]->driver;
1603
1604 if (!rtd->dai_link->no_pcm && drv->pcm_new)
1605 ret = drv->pcm_new(rtd, dais[i]);
1606 if (ret < 0) {
1607 dev_err(dais[i]->dev,
1608 "ASoC: Failed to bind %s with pcm device\n",
1609 dais[i]->name);
1610 return ret;
1611 }
1612 }
1613
1614 return 0;
1615}
1616
1596static int soc_link_dai_widgets(struct snd_soc_card *card, 1617static int soc_link_dai_widgets(struct snd_soc_card *card,
1597 struct snd_soc_dai_link *dai_link, 1618 struct snd_soc_dai_link *dai_link,
1598 struct snd_soc_pcm_runtime *rtd) 1619 struct snd_soc_pcm_runtime *rtd)
@@ -1704,6 +1725,13 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
1704 dai_link->stream_name, ret); 1725 dai_link->stream_name, ret);
1705 return ret; 1726 return ret;
1706 } 1727 }
1728 ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd);
1729 if (ret < 0)
1730 return ret;
1731 ret = soc_link_dai_pcm_new(rtd->codec_dais,
1732 rtd->num_codecs, rtd);
1733 if (ret < 0)
1734 return ret;
1707 } else { 1735 } else {
1708 INIT_DELAYED_WORK(&rtd->delayed_work, 1736 INIT_DELAYED_WORK(&rtd->delayed_work,
1709 codec2codec_close_delayed_work); 1737 codec2codec_close_delayed_work);