[alsa-devel] [PATCH v2] ASoC: dapm: Add support for platform and CODEC drivers on same device

Charles Keepax ckeepax at opensource.wolfsonmicro.com
Fri Mar 15 16:38:21 CET 2013

Currently DAI playback and capture widgets are created during
soc_probe_codec and soc_probe_platform using the device associated
with the platform/codec to locate the DAI upon which the widgets
should be created. If a device registers both a CODEC and platform
driver this leads the widgets created during CODEC probe being
overwritten by the widgets created during the platform probe.

In general we want to retain the existing playback and capture widgets
because routes may have already been added to them. This patch will
check for existing widgets during snd_soc_dapm_new_dai_widgets and
only create new widgets if none exist.

Signed-off-by: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>
 sound/soc/soc-dapm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 33acd8b..6959304 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3351,7 +3351,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
 	memset(&template, 0, sizeof(template));
 	template.reg = SND_SOC_NOPM;
-	if (dai->driver->playback.stream_name) {
+	if (dai->driver->playback.stream_name && !dai->playback_widget) {
 		template.id = snd_soc_dapm_dai;
 		template.name = dai->driver->playback.stream_name;
 		template.sname = dai->driver->playback.stream_name;
@@ -3369,7 +3369,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
 		dai->playback_widget = w;
-	if (dai->driver->capture.stream_name) {
+	if (dai->driver->capture.stream_name && !dai->capture_widget) {
 		template.id = snd_soc_dapm_dai;
 		template.name = dai->driver->capture.stream_name;
 		template.sname = dai->driver->capture.stream_name;

More information about the Alsa-devel mailing list