提交 be09ad90 编写于 作者: L Liam Girdwood 提交者: Mark Brown

ASoC: core: Add platform DAI widget mapping

Add platform driver support for CPU DAI DAPM widgets.
Signed-off-by: NLiam Girdwood <lrg@ti.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 4edbb345
...@@ -241,6 +241,7 @@ struct snd_soc_dai { ...@@ -241,6 +241,7 @@ struct snd_soc_dai {
struct snd_soc_dapm_widget *playback_widget; struct snd_soc_dapm_widget *playback_widget;
struct snd_soc_dapm_widget *capture_widget; struct snd_soc_dapm_widget *capture_widget;
struct snd_soc_dapm_context dapm;
/* DAI DMA data */ /* DAI DMA data */
void *playback_dma_data; void *playback_dma_data;
......
...@@ -1074,6 +1074,7 @@ static int soc_probe_platform(struct snd_soc_card *card, ...@@ -1074,6 +1074,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
{ {
int ret = 0; int ret = 0;
const struct snd_soc_platform_driver *driver = platform->driver; const struct snd_soc_platform_driver *driver = platform->driver;
struct snd_soc_dai *dai;
platform->card = card; platform->card = card;
platform->dapm.card = card; platform->dapm.card = card;
...@@ -1087,6 +1088,14 @@ static int soc_probe_platform(struct snd_soc_card *card, ...@@ -1087,6 +1088,14 @@ static int soc_probe_platform(struct snd_soc_card *card,
snd_soc_dapm_new_controls(&platform->dapm, snd_soc_dapm_new_controls(&platform->dapm,
driver->dapm_widgets, driver->num_dapm_widgets); driver->dapm_widgets, driver->num_dapm_widgets);
/* Create DAPM widgets for each DAI stream */
list_for_each_entry(dai, &dai_list, list) {
if (dai->dev != platform->dev)
continue;
snd_soc_dapm_new_dai_widgets(&platform->dapm, dai);
}
if (driver->probe) { if (driver->probe) {
ret = driver->probe(platform); ret = driver->probe(platform);
if (ret < 0) { if (ret < 0) {
...@@ -1222,9 +1231,12 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order) ...@@ -1222,9 +1231,12 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
/* probe the cpu_dai */ /* probe the cpu_dai */
if (!cpu_dai->probed && if (!cpu_dai->probed &&
cpu_dai->driver->probe_order == order) { cpu_dai->driver->probe_order == order) {
cpu_dai->dapm.card = card;
if (!try_module_get(cpu_dai->dev->driver->owner)) if (!try_module_get(cpu_dai->dev->driver->owner))
return -ENODEV; return -ENODEV;
snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai);
if (cpu_dai->driver->probe) { if (cpu_dai->driver->probe) {
ret = cpu_dai->driver->probe(cpu_dai); ret = cpu_dai->driver->probe(cpu_dai);
if (ret < 0) { if (ret < 0) {
...@@ -3242,6 +3254,7 @@ int snd_soc_register_dai(struct device *dev, ...@@ -3242,6 +3254,7 @@ int snd_soc_register_dai(struct device *dev,
dai->dev = dev; dai->dev = dev;
dai->driver = dai_drv; dai->driver = dai_drv;
dai->dapm.dev = dev;
if (!dai->driver->ops) if (!dai->driver->ops)
dai->driver->ops = &null_dai_ops; dai->driver->ops = &null_dai_ops;
...@@ -3318,6 +3331,7 @@ int snd_soc_register_dais(struct device *dev, ...@@ -3318,6 +3331,7 @@ int snd_soc_register_dais(struct device *dev,
dai->id = dai->driver->id; dai->id = dai->driver->id;
else else
dai->id = i; dai->id = i;
dai->dapm.dev = dev;
if (!dai->driver->ops) if (!dai->driver->ops)
dai->driver->ops = &null_dai_ops; dai->driver->ops = &null_dai_ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册