alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 7/8] ASoC: dapm: Convert stream events to use DAI widgets
Date: Thu, 16 Feb 2012 21:56:09 -0800	[thread overview]
Message-ID: <1329458170-22119-7-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1329458170-22119-1-git-send-email-broonie@opensource.wolfsonmicro.com>

This means we don't need to walk through every single widget in the system
for each stream event which is a bit less silly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |   43 +++++++++++++++++--------------------------
 1 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index ebf1a60..27b56e2 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2949,38 +2949,29 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
 				  int event)
 {
 	struct snd_soc_dapm_widget *w;
-	const char *stream_name;
 
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-		stream_name = dai->driver->playback.stream_name;
+		w = dai->playback_widget;
 	else
-		stream_name = dai->driver->capture.stream_name;
+		w = dai->capture_widget;
 
-	if (!stream_name)
+	if (!w)
 		return;
 
-	list_for_each_entry(w, &dapm->card->widgets, list)
-	{
-		if (!w->sname || w->dapm != dapm)
-			continue;
-		dev_vdbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n",
-			w->name, w->sname, stream_name, event);
-		if (strstr(w->sname, stream_name)) {
-			dapm_mark_dirty(w, "stream event");
-			switch(event) {
-			case SND_SOC_DAPM_STREAM_START:
-				w->active = 1;
-				break;
-			case SND_SOC_DAPM_STREAM_STOP:
-				w->active = 0;
-				break;
-			case SND_SOC_DAPM_STREAM_SUSPEND:
-			case SND_SOC_DAPM_STREAM_RESUME:
-			case SND_SOC_DAPM_STREAM_PAUSE_PUSH:
-			case SND_SOC_DAPM_STREAM_PAUSE_RELEASE:
-				break;
-			}
-		}
+	dapm_mark_dirty(w, "stream event");
+
+	switch (event) {
+	case SND_SOC_DAPM_STREAM_START:
+		w->active = 1;
+		break;
+	case SND_SOC_DAPM_STREAM_STOP:
+		w->active = 0;
+		break;
+	case SND_SOC_DAPM_STREAM_SUSPEND:
+	case SND_SOC_DAPM_STREAM_RESUME:
+	case SND_SOC_DAPM_STREAM_PAUSE_PUSH:
+	case SND_SOC_DAPM_STREAM_PAUSE_RELEASE:
+		break;
 	}
 
 	dapm_power_widgets(dapm, event);
-- 
1.7.9.rc1

  parent reply	other threads:[~2012-02-17  5:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17  5:56 [PATCH 1/8] ALSA: core: Constify the name in new kcontrols Mark Brown
2012-02-17  5:56 ` [PATCH 2/8] ASoC: dapm: Unexport snd_soc_dapm_new_control() Mark Brown
2012-02-17  5:56 ` [PATCH 3/8] ASoC: dapm: Refactor snd_soc_dapm_new_widget() to return the widget Mark Brown
2012-02-17  5:56 ` [PATCH 4/8] ASoC: dapm: Supply the DAI and substream when calling stream events Mark Brown
2012-02-17  5:56 ` [PATCH 5/8] ASoC: dapm: Constify lots of names that are never modified Mark Brown
2012-02-17  5:56 ` [PATCH 6/8] ASoC: dapm: Implement and instantiate DAI widgets Mark Brown
2012-02-17  8:40   ` Vinod Koul
2012-02-17 10:39     ` Liam Girdwood
2012-02-22 12:35     ` Vinod Koul
2012-02-22 12:43       ` Mark Brown
2012-02-22 13:01         ` Vinod Koul
2012-02-22 13:29           ` Mark Brown
2012-02-23  6:50             ` Vinod Koul
2012-02-23 15:25               ` Mark Brown
2012-02-17  5:56 ` Mark Brown [this message]
2012-02-17  5:56 ` [PATCH 8/8] ASoC: wm8994: Convert to use DAI widget routing rather than streams Mark Brown
2012-02-17  9:50 ` [PATCH 1/8] ALSA: core: Constify the name in new kcontrols Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329458170-22119-7-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@ti.com \
    --cc=patches@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).