lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 2 Jul 2013 17:42:46 +0800
From:	Nenghua Cao <nhcao@...vell.com>
To:	Liam Girdwood <lrg@...com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
	<alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>
CC:	Henry zhao <xzhao10@...vell.com>, nhcao <nhcao@...vell.com>
Subject: [PATCH] ASOC: pcm: support fe dapm widget derived from codec_dai

From: nhcao <nhcao@...vell.com>

	In some chips, the codec_dai in cpu is abstracted as one dapm
widget. Enhance the framework to use codec_dai as fe widget.

Change-Id: I1b545bd1e2f24288f4508a7c6d4efbcfe1e03c5b
Signed-off-by: nhcao <nhcao@...vell.com>
---
 sound/soc/soc-pcm.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 73bb8ee..6ca23d7 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -856,17 +856,37 @@ static int widget_in_list(struct snd_soc_dapm_widget_list *list,
 static int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
 	int stream, struct snd_soc_dapm_widget_list **list_)
 {
-	struct snd_soc_dai *cpu_dai = fe->cpu_dai;
+	struct snd_soc_dai *dai = fe->cpu_dai ;
 	struct snd_soc_dapm_widget_list *list;
 	int paths;
 
+	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (fe->cpu_dai->playback_widget) {
+			dai = fe->cpu_dai;
+		} else if (fe->codec_dai->playback_widget) {
+			dai = fe->codec_dai;
+		} else {
+			dev_err(fe->dev, "ASoC: can't find the correspond playback_widget for the dai\n");
+			return -EINVAL;
+		}
+	} else if (stream == SNDRV_PCM_STREAM_CAPTURE) {
+		if (fe->cpu_dai->capture_widget) {
+			dai = fe->cpu_dai;
+		} else if (fe->codec_dai->capture_widget) {
+			dai = fe->codec_dai;
+		} else {
+			dev_err(fe->dev, "ASoC: can't find the correspond capture_widget for the dai\n");
+			return -EINVAL;
+		}
+	}
+
 	list = kzalloc(sizeof(struct snd_soc_dapm_widget_list) +
 			sizeof(struct snd_soc_dapm_widget *), GFP_KERNEL);
 	if (list == NULL)
 		return -ENOMEM;
 
 	/* get number of valid DAI paths and their widgets */
-	paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list);
+	paths = snd_soc_dapm_dai_get_connected_widgets(dai, stream, &list);
 
 	dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
 			stream ? "capture" : "playback");
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ