All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm - Make DAPM reset code a separate function.
@ 2012-02-15 15:15 Liam Girdwood
  2012-02-15 15:15 ` [PATCH] ASoC: DAPM - Notify stream event to all card components Liam Girdwood
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Liam Girdwood @ 2012-02-15 15:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

It's useful to export the DAPM reset as a static function for future use
by other DAPM functions. e.g. The dynamic PCM query widgets resets the DAPM
graph before working out active paths.

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 sound/soc/soc-dapm.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 0c94027..227887e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -169,6 +169,19 @@ static inline struct snd_soc_card *dapm_get_soc_card(
 	return NULL;
 }
 
+static void dapm_reset(struct snd_soc_card *card)
+{
+	struct snd_soc_dapm_widget *w;
+
+	memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
+
+	list_for_each_entry(w, &card->widgets, list) {
+		w->power_checked = false;
+		w->inputs = -1;
+		w->outputs = -1;
+	}
+}
+
 static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
 {
 	if (w->codec)
@@ -1402,13 +1415,7 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
 		}
 	}
 
-	memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
-
-	list_for_each_entry(w, &card->widgets, list) {
-		w->power_checked = false;
-		w->inputs = -1;
-		w->outputs = -1;
-	}
+	dapm_reset(card);
 
 	/* Check which widgets we need to power and store them in
 	 * lists indicating if they should be powered up or down.  We
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] ASoC: DAPM - Notify stream event to all card components.
  2012-02-15 15:15 [PATCH] ASoC: dapm - Make DAPM reset code a separate function Liam Girdwood
@ 2012-02-15 15:15 ` Liam Girdwood
  2012-02-15 15:58   ` Mark Brown
  2012-02-15 15:15 ` [PATCH] ASoC: core - add platform DAPM debugfs support Liam Girdwood
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Liam Girdwood @ 2012-02-15 15:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Currently when DAPM widgets are power sequenced the stream_event()
completion callback is only called for the stream_event originator
DAPM context. Other components in the card may also be interested so
make sure they are also notified of any widget power events.

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 sound/soc/soc-dapm.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 227887e..63a5614 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1516,6 +1516,12 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
 					&async_domain);
 	async_synchronize_full_domain(&async_domain);
 
+	/* do we need to notify any clients that DAPM event is complete */
+	list_for_each_entry(d, &card->dapm_list, list) {
+		if (d->stream_event)
+			d->stream_event(d, event);
+	}
+
 	pop_dbg(dapm->dev, card->pop_time,
 		"DAPM sequencing finished, waiting %dms\n", card->pop_time);
 	pop_wait(card->pop_time);
@@ -2854,10 +2860,6 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
 	}
 
 	dapm_power_widgets(dapm, event);
-
-	/* do we need to notify any clients that DAPM stream is complete */
-	if (dapm->stream_event)
-		dapm->stream_event(dapm, event);
 }
 
 /**
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] ASoC: core - add platform DAPM debugfs support
  2012-02-15 15:15 [PATCH] ASoC: dapm - Make DAPM reset code a separate function Liam Girdwood
  2012-02-15 15:15 ` [PATCH] ASoC: DAPM - Notify stream event to all card components Liam Girdwood
@ 2012-02-15 15:15 ` Liam Girdwood
  2012-02-15 15:23   ` Liam Girdwood
  2012-02-15 15:15 ` [PATCH] ASoC: core - Codec debugfs init to use dev_warn() Liam Girdwood
  2012-02-15 15:57 ` [PATCH] ASoC: dapm - Make DAPM reset code a separate function Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Liam Girdwood @ 2012-02-15 15:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood, Sebastien Guiriec

From: Sebastien Guiriec <s-guiriec@ti.com>

Allow platform widgets to be visible in debugfs like codec widgets.

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 include/sound/soc.h  |    5 +++++
 sound/soc/soc-core.c |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4f67e01..8fa4dca 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -706,6 +706,11 @@ struct snd_soc_platform {
 	struct list_head card_list;
 
 	struct snd_soc_dapm_context dapm;
+
+#ifdef CONFIG_DEBUG_FS
+	struct dentry *debugfs_platform_root;
+	struct dentry *debugfs_dapm;
+#endif
 };
 
 struct snd_soc_dai_link {
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 8bd9995..e1d6bfc 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -302,6 +302,27 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
 	debugfs_remove_recursive(codec->debugfs_codec_root);
 }
 
+static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
+{
+	struct dentry *debugfs_card_root = platform->card->debugfs_card_root;
+
+	platform->debugfs_platform_root = debugfs_create_dir(platform->name,
+						       debugfs_card_root);
+	if (!platform->debugfs_platform_root) {
+		dev_warn(platform->dev,
+			"Failed to create platform debugfs directory\n");
+		return;
+	}
+
+	snd_soc_dapm_debugfs_init(&platform->dapm,
+		platform->debugfs_platform_root);
+}
+
+static void soc_cleanup_platform_debugfs(struct snd_soc_platform *platform)
+{
+	debugfs_remove_recursive(platform->debugfs_platform_root);
+}
+
 static ssize_t codec_list_read_file(struct file *file, char __user *user_buf,
 				    size_t count, loff_t *ppos)
 {
@@ -435,6 +456,14 @@ static inline void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
 {
 }
 
+static inline void soc_init_platform_debugfs(struct snd_soc_platform *platform)
+{
+}
+
+static inline void soc_cleanup_platform_debugfs(struct snd_soc_platform *platform)
+{
+}
+
 static inline void soc_init_card_debugfs(struct snd_soc_card *card)
 {
 }
@@ -918,10 +947,10 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
 			if (err < 0)
 				printk(KERN_ERR "asoc: failed to remove %s\n", platform->name);
 		}
-
 		/* Make sure all DAPM widgets are freed */
 		snd_soc_dapm_free(&platform->dapm);
 
+		soc_cleanup_platform_debugfs(platform);
 		platform->probed = 0;
 		list_del(&platform->card_list);
 		module_put(platform->dev->driver->owner);
@@ -1039,6 +1068,8 @@ static int soc_probe_platform(struct snd_soc_card *card,
 	if (!try_module_get(platform->dev->driver->owner))
 		return -ENODEV;
 
+	soc_init_platform_debugfs(platform);
+
 	if (driver->dapm_widgets)
 		snd_soc_dapm_new_controls(&platform->dapm,
 			driver->dapm_widgets, driver->num_dapm_widgets);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] ASoC: core - Codec debugfs init to use dev_warn()
  2012-02-15 15:15 [PATCH] ASoC: dapm - Make DAPM reset code a separate function Liam Girdwood
  2012-02-15 15:15 ` [PATCH] ASoC: DAPM - Notify stream event to all card components Liam Girdwood
  2012-02-15 15:15 ` [PATCH] ASoC: core - add platform DAPM debugfs support Liam Girdwood
@ 2012-02-15 15:15 ` Liam Girdwood
  2012-02-15 15:59   ` Mark Brown
  2012-02-15 15:57 ` [PATCH] ASoC: dapm - Make DAPM reset code a separate function Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Liam Girdwood @ 2012-02-15 15:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Update the codec debugfs initialisation to use dev_warn() instead of
printk(KERN_WARNING).

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 sound/soc/soc-core.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e1d6bfc..957b5ed 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -277,8 +277,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
 	codec->debugfs_codec_root = debugfs_create_dir(codec->name,
 						       debugfs_card_root);
 	if (!codec->debugfs_codec_root) {
-		printk(KERN_WARNING
-		       "ASoC: Failed to create codec debugfs directory\n");
+		dev_warn(codec->dev, "Failed to create codec debugfs directory\n");
 		return;
 	}
 
@@ -291,8 +290,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
 						 codec->debugfs_codec_root,
 						 codec, &codec_reg_fops);
 	if (!codec->debugfs_reg)
-		printk(KERN_WARNING
-		       "ASoC: Failed to create codec register debugfs file\n");
+		dev_warn(codec->dev, "Failed to create codec register debugfs file\n");
 
 	snd_soc_dapm_debugfs_init(&codec->dapm, codec->debugfs_codec_root);
 }
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: core - add platform DAPM debugfs support
  2012-02-15 15:15 ` [PATCH] ASoC: core - add platform DAPM debugfs support Liam Girdwood
@ 2012-02-15 15:23   ` Liam Girdwood
  0 siblings, 0 replies; 8+ messages in thread
From: Liam Girdwood @ 2012-02-15 15:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Sebastien Guiriec

On Wed, 2012-02-15 at 15:15 +0000, Liam Girdwood wrote:
> From: Sebastien Guiriec <s-guiriec@ti.com>
> 
> Allow platform widgets to be visible in debugfs like codec widgets.
> 
> Signed-off-by: Liam Girdwood <lrg@ti.com>

> @@ -918,10 +947,10 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
>  			if (err < 0)
>  				printk(KERN_ERR "asoc: failed to remove %s\n", platform->name);
>  		}
> -

This line shouldn't be removed. V2 coming.

Liam

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: dapm - Make DAPM reset code a separate function.
  2012-02-15 15:15 [PATCH] ASoC: dapm - Make DAPM reset code a separate function Liam Girdwood
                   ` (2 preceding siblings ...)
  2012-02-15 15:15 ` [PATCH] ASoC: core - Codec debugfs init to use dev_warn() Liam Girdwood
@ 2012-02-15 15:57 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2012-02-15 15:57 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 352 bytes --]

On Wed, Feb 15, 2012 at 03:15:34PM +0000, Liam Girdwood wrote:
> It's useful to export the DAPM reset as a static function for future use
> by other DAPM functions. e.g. The dynamic PCM query widgets resets the DAPM
> graph before working out active paths.

Applied, thanks.  Need to check that this does the right thing for the
performance stats too.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: DAPM - Notify stream event to all card components.
  2012-02-15 15:15 ` [PATCH] ASoC: DAPM - Notify stream event to all card components Liam Girdwood
@ 2012-02-15 15:58   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2012-02-15 15:58 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 353 bytes --]

On Wed, Feb 15, 2012 at 03:15:35PM +0000, Liam Girdwood wrote:
> Currently when DAPM widgets are power sequenced the stream_event()
> completion callback is only called for the stream_event originator
> DAPM context. Other components in the card may also be interested so
> make sure they are also notified of any widget power events.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ASoC: core - Codec debugfs init to use dev_warn()
  2012-02-15 15:15 ` [PATCH] ASoC: core - Codec debugfs init to use dev_warn() Liam Girdwood
@ 2012-02-15 15:59   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2012-02-15 15:59 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel


[-- Attachment #1.1: Type: text/plain, Size: 176 bytes --]

On Wed, Feb 15, 2012 at 03:15:37PM +0000, Liam Girdwood wrote:
> Update the codec debugfs initialisation to use dev_warn() instead of
> printk(KERN_WARNING).

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-15 15:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 15:15 [PATCH] ASoC: dapm - Make DAPM reset code a separate function Liam Girdwood
2012-02-15 15:15 ` [PATCH] ASoC: DAPM - Notify stream event to all card components Liam Girdwood
2012-02-15 15:58   ` Mark Brown
2012-02-15 15:15 ` [PATCH] ASoC: core - add platform DAPM debugfs support Liam Girdwood
2012-02-15 15:23   ` Liam Girdwood
2012-02-15 15:15 ` [PATCH] ASoC: core - Codec debugfs init to use dev_warn() Liam Girdwood
2012-02-15 15:59   ` Mark Brown
2012-02-15 15:57 ` [PATCH] ASoC: dapm - Make DAPM reset code a separate function Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.