public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: make dapm cache search depth configurable
@ 2015-09-08 10:11 Nikesh Oswal
  2015-09-08 10:42 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Nikesh Oswal @ 2015-09-08 10:11 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: perex, tiwai, alsa-devel, linux-kernel, patches, Nikesh.Oswal

cache search depth will have a default value of 2 and can
be modified by the respective component probe function

Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
---
 include/sound/soc-dapm.h |    1 +
 sound/soc/soc-core.c     |    2 ++
 sound/soc/soc-dapm.c     |    5 +++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5abba03..15717b4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -629,6 +629,7 @@ struct snd_soc_dapm_context {
 
 	struct snd_soc_dapm_wcache path_sink_cache;
 	struct snd_soc_dapm_wcache path_source_cache;
+	unsigned int cache_search_depth;
 
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *debugfs_dapm;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6173d15..1802883 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1595,6 +1595,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
 	card->dapm.bias_level = SND_SOC_BIAS_OFF;
 	card->dapm.dev = card->dev;
 	card->dapm.card = card;
+	card->dapm.cache_search_depth = 2;
 	list_add(&card->dapm.list, &card->dapm_list);
 
 #ifdef CONFIG_DEBUG_FS
@@ -2665,6 +2666,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
 	component->remove = component->driver->remove;
 
 	dapm = &component->dapm;
+	dapm->cache_search_depth = 2;
 	dapm->dev = dev;
 	dapm->component = component;
 	dapm->bias_level = SND_SOC_BIAS_OFF;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f4bf21a..36ab9cb 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -580,11 +580,12 @@ dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
 {
 	struct snd_soc_dapm_widget *w = wcache->widget;
 	struct list_head *wlist;
-	const int depth = 2;
+	int depth;
 	int i = 0;
 
-	if (w) {
+	if (w && w->dapm->cache_search_depth) {
 		wlist = &w->dapm->card->widgets;
+		depth = w->dapm->cache_search_depth;
 
 		list_for_each_entry_from(w, wlist, list) {
 			if (!strcmp(name, w->name))
-- 
1.7.9.5


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

* Re: [PATCH] ASoC: make dapm cache search depth configurable
  2015-09-08 10:11 [PATCH] ASoC: make dapm cache search depth configurable Nikesh Oswal
@ 2015-09-08 10:42 ` Mark Brown
  2015-09-10  9:42   ` Nikesh
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2015-09-08 10:42 UTC (permalink / raw)
  To: Nikesh Oswal
  Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel, patches,
	Nikesh.Oswal

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

On Tue, Sep 08, 2015 at 11:11:37AM +0100, Nikesh Oswal wrote:
> cache search depth will have a default value of 2 and can
> be modified by the respective component probe function

Why?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH] ASoC: make dapm cache search depth configurable
  2015-09-08 10:42 ` Mark Brown
@ 2015-09-10  9:42   ` Nikesh
  2015-09-10 10:31     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Nikesh @ 2015-09-10  9:42 UTC (permalink / raw)
  To: Mark Brown, Nikesh Oswal
  Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel, patches,
	Nikesh.Oswal

Hi Mark,

The reason I though this will be usefull is as below:

While adding paths the source or sink widgets of consecutive path that 
are being added, may not be immediate neighbours in widget list. Hence 
in such scenarios the cache hits will reduce. One possible solution is 
to rearrange the widgets in the codec driver but sometimes
codec driver uses some macros to create a bunch of related widgets which 
we may want to skip in the cache search. So a configurable cache search 
depth caters to such scenarios.

For example in wm5110.c the frequently occuring mixer routes are defined 
by ARIZONA_MIXER_INPUT_ROUTES, so as to maximise the cache hit codec 
driver can register all the source widgets in exactly the same order (by 
rearranging the widgets in wm5110_dapm_widgets[]) as defined in this 
macro. But if you notice the way DSP widgets are created they use a 
WM_ADSP2 macro which creates a preloader widget for every DSP widget and 
we want to skip past this preloader widget when doing a cache search so 
increasing the cache search depth helps here.

Thanks,
Nikesh

On 08/09/15 11:42, Mark Brown wrote:
> On Tue, Sep 08, 2015 at 11:11:37AM +0100, Nikesh Oswal wrote:
>> cache search depth will have a default value of 2 and can
>> be modified by the respective component probe function
> Why?


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

* Re: [PATCH] ASoC: make dapm cache search depth configurable
  2015-09-10  9:42   ` Nikesh
@ 2015-09-10 10:31     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-09-10 10:31 UTC (permalink / raw)
  To: Nikesh
  Cc: Nikesh Oswal, lgirdwood, perex, tiwai, alsa-devel, linux-kernel,
	patches, Nikesh.Oswal

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

On Thu, Sep 10, 2015 at 10:42:50AM +0100, Nikesh wrote:
> Hi Mark,

As I'm fairly sure I've had to tell you before don't top post.  This
means that when someone sees something like this:

> The reason I though this will be usefull is as below:

while reading they know what the "this" you are talking about is.

> the widgets in wm5110_dapm_widgets[]) as defined in this macro. But if you
> notice the way DSP widgets are created they use a WM_ADSP2 macro which
> creates a preloader widget for every DSP widget and we want to skip past
> this preloader widget when doing a cache search so increasing the cache
> search depth helps here.

Why is the solution to this problem to add device specific tuning?  Is
this extremely expensive so no other device would want it?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-09-10 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-08 10:11 [PATCH] ASoC: make dapm cache search depth configurable Nikesh Oswal
2015-09-08 10:42 ` Mark Brown
2015-09-10  9:42   ` Nikesh
2015-09-10 10:31     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox