All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>, lrg@ti.com
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	lrg@slimlogic.co.uk
Subject: [PATCH 3/3] ASoC: soc-cache: Ignore !codec->writable_register() during syncing
Date: Thu, 24 Mar 2011 13:45:19 +0000	[thread overview]
Message-ID: <1300974319-14423-3-git-send-email-dp@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1300974319-14423-1-git-send-email-dp@opensource.wolfsonmicro.com>

When syncing the cache, if the driver has given us a writable_register()
callback, use it to not sync any non-writable registers.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 657889d..0ec8e13 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -889,6 +889,9 @@ static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
 		rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
 		if (rbnode->value == rbnode->defval)
 			continue;
+		if (codec->writable_register &&
+		    !codec->writable_register(codec, rbnode->reg))
+			continue;
 		ret = snd_soc_cache_read(codec, rbnode->reg, &val);
 		if (ret)
 			return ret;
@@ -1149,6 +1152,8 @@ static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
 
 	lzo_blocks = codec->reg_cache;
 	for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
+		if (codec->writable_register && !codec->writable_register(codec, i))
+			continue;
 		ret = snd_soc_cache_read(codec, i, &val);
 		if (ret)
 			return ret;
@@ -1407,6 +1412,8 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
 
 	codec_drv = codec->driver;
 	for (i = 0; i < codec_drv->reg_cache_size; ++i) {
+		if (codec->writable_register && !codec->writable_register(codec, i))
+			continue;
 		ret = snd_soc_cache_read(codec, i, &val);
 		if (ret)
 			return ret;
-- 
1.7.4.1

  parent reply	other threads:[~2011-03-24 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 13:45 [PATCH 1/3] ASoC: Add default snd_soc_default_writable_register() callback Dimitris Papastamos
2011-03-24 13:45 ` [PATCH 2/3] ASoC: Add snd_soc_codec_{readable, writable}_register() Dimitris Papastamos
2011-03-24 13:45 ` Dimitris Papastamos [this message]
2011-03-26 17:29   ` [PATCH 3/3] ASoC: soc-cache: Ignore !codec->writable_register() during syncing Mark Brown
2011-03-28  9:35     ` Dimitris Papastamos
2011-03-26 12:51 ` [PATCH 1/3] ASoC: Add default snd_soc_default_writable_register() callback Liam Girdwood
2011-03-26 17:40 ` 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=1300974319-14423-3-git-send-email-dp@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=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 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.