From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH] ASoC: Suppress restore of default register values for rbtree cache sync
Date: Mon, 6 Jun 2011 10:18:07 +0100 [thread overview]
Message-ID: <20110606091807.GA18786@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1307115435-18213-1-git-send-email-broonie@opensource.wolfsonmicro.com>
On Fri, Jun 03, 2011 at 04:37:15PM +0100, Mark Brown wrote:
> Currently the rbtree code will write out the entire register map when
> doing a cache sync which is wasteful and will slow things down. Check
> to see if the value we're about to write is the default and don't bother
> restoring it if it is, either the value will have been retained or the
> device will have been reset and holds the value already.
>
> We should really store the defaults in the nodes but this resolves the
> immediate issue.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> sound/soc/soc-cache.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
> index d8ce34c..d82ab42 100644
> --- a/sound/soc/soc-cache.c
> +++ b/sound/soc/soc-cache.c
> @@ -607,7 +607,7 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
> struct rb_node *node;
> struct snd_soc_rbtree_node *rbnode;
> unsigned int regtmp;
> - unsigned int val;
> + unsigned int val, def;
> int ret;
> int i;
>
> @@ -619,6 +619,11 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
> WARN_ON(codec->writable_register &&
> codec->writable_register(codec, regtmp));
> val = snd_soc_rbtree_get_register(rbnode, i);
> + def = snd_soc_get_cache_val(codec->reg_def_copy, i,
> + rbnode->word_size);
> + if (val == def)
> + continue;
> +
> codec->cache_bypass = 1;
> ret = snd_soc_write(codec, regtmp, val);
> codec->cache_bypass = 0;
> --
> 1.7.5.3
>
There should be a check for reg_def_copy being NULL, the soc-cache code
is also built around the idea that the driver might not provide a
register defaults cache at all so this change needs to cope with that.
Also I'd expect the reg_def_copy cache to be freed sooner rather than
while unregistering the codec, this is not happening at the moment,
which is wasting significant space. This is the case because it is only
used during initialization.
Note that the only reason we allocate reg_def_copy is to avoid to fiddle
with a cache that might be marked as __devinitconst which is also not
happening for any of the users at the moment.
Thanks,
Dimitris
next prev parent reply other threads:[~2011-06-06 9:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 15:37 [PATCH] ASoC: Suppress restore of default register values for rbtree cache sync Mark Brown
2011-06-03 16:29 ` Liam Girdwood
2011-06-06 9:18 ` Dimitris Papastamos [this message]
2011-06-06 9:26 ` Mark Brown
2011-06-06 9:29 ` Dimitris Papastamos
2011-06-06 10:39 ` Mark Brown
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=20110606091807.GA18786@opensource.wolfsonmicro.com \
--to=dp@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
--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 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.