aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Cousson <bcousson@baylibre.com>2014-07-08 17:19:36 -0400
committerMark Brown <broonie@linaro.org>2014-07-16 18:06:26 -0400
commit44ba2641b77ab4037b79873ea5afdac3329b1ea3 (patch)
treeba1247564bcd6749040deb0209e21916a0798336
parent2e5894d73789ee60d4d406fd3342a9a5152ec23c (diff)
ASoC: dapm: Add support for DAI multicodec
Add multicodec support in soc-dapm.c Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Fabien Parent <fparent@baylibre.com> Tested-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/soc-dapm.c67
1 files changed, 47 insertions, 20 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4bf08cffd1f1..5c63c3b49f3f 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2084,12 +2084,8 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
2084} 2084}
2085EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power); 2085EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
2086 2086
2087/* show dapm widget status in sys fs */ 2087static ssize_t dapm_widget_show_codec(struct snd_soc_codec *codec, char *buf)
2088static ssize_t dapm_widget_show(struct device *dev,
2089 struct device_attribute *attr, char *buf)
2090{ 2088{
2091 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
2092 struct snd_soc_codec *codec =rtd->codec;
2093 struct snd_soc_dapm_widget *w; 2089 struct snd_soc_dapm_widget *w;
2094 int count = 0; 2090 int count = 0;
2095 char *state = "not set"; 2091 char *state = "not set";
@@ -2142,6 +2138,21 @@ static ssize_t dapm_widget_show(struct device *dev,
2142 return count; 2138 return count;
2143} 2139}
2144 2140
2141/* show dapm widget status in sys fs */
2142static ssize_t dapm_widget_show(struct device *dev,
2143 struct device_attribute *attr, char *buf)
2144{
2145 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
2146 int i, count = 0;
2147
2148 for (i = 0; i < rtd->num_codecs; i++) {
2149 struct snd_soc_codec *codec = rtd->codec_dais[i]->codec;
2150 count += dapm_widget_show_codec(codec, buf + count);
2151 }
2152
2153 return count;
2154}
2155
2145static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL); 2156static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL);
2146 2157
2147int snd_soc_dapm_sys_add(struct device *dev) 2158int snd_soc_dapm_sys_add(struct device *dev)
@@ -3395,25 +3406,18 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3395 return 0; 3406 return 0;
3396} 3407}
3397 3408
3398void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) 3409static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
3410 struct snd_soc_pcm_runtime *rtd)
3399{ 3411{
3400 struct snd_soc_pcm_runtime *rtd = card->rtd; 3412 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
3401 struct snd_soc_dapm_widget *sink, *source; 3413 struct snd_soc_dapm_widget *sink, *source;
3402 struct snd_soc_dai *cpu_dai, *codec_dai; 3414 struct snd_soc_dapm_route r;
3403 int i; 3415 int i;
3404 3416
3405 /* for each BE DAI link... */ 3417 memset(&r, 0, sizeof(r));
3406 for (i = 0; i < card->num_rtd; i++) {
3407 rtd = &card->rtd[i];
3408 cpu_dai = rtd->cpu_dai;
3409 codec_dai = rtd->codec_dai;
3410 3418
3411 /* 3419 for (i = 0; i < rtd->num_codecs; i++) {
3412 * dynamic FE links have no fixed DAI mapping. 3420 struct snd_soc_dai *codec_dai = rtd->codec_dais[i];
3413 * CODEC<->CODEC links have no direct connection.
3414 */
3415 if (rtd->dai_link->dynamic || rtd->dai_link->params)
3416 continue;
3417 3421
3418 /* there is no point in connecting BE DAI links with dummies */ 3422 /* there is no point in connecting BE DAI links with dummies */
3419 if (snd_soc_dai_is_dummy(codec_dai) || 3423 if (snd_soc_dai_is_dummy(codec_dai) ||
@@ -3475,11 +3479,34 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
3475 } 3479 }
3476} 3480}
3477 3481
3482void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3483{
3484 struct snd_soc_pcm_runtime *rtd = card->rtd;
3485 int i;
3486
3487 /* for each BE DAI link... */
3488 for (i = 0; i < card->num_rtd; i++) {
3489 rtd = &card->rtd[i];
3490
3491 /*
3492 * dynamic FE links have no fixed DAI mapping.
3493 * CODEC<->CODEC links have no direct connection.
3494 */
3495 if (rtd->dai_link->dynamic || rtd->dai_link->params)
3496 continue;
3497
3498 dapm_connect_dai_link_widgets(card, rtd);
3499 }
3500}
3501
3478static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, 3502static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
3479 int event) 3503 int event)
3480{ 3504{
3505 int i;
3506
3481 soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event); 3507 soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event);
3482 soc_dapm_dai_stream_event(rtd->codec_dai, stream, event); 3508 for (i = 0; i < rtd->num_codecs; i++)
3509 soc_dapm_dai_stream_event(rtd->codec_dais[i], stream, event);
3483 3510
3484 dapm_power_widgets(rtd->card, event); 3511 dapm_power_widgets(rtd->card, event);
3485} 3512}