Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Brian Austin <brian.austin@cirrus.com>,
	alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	Paul Handrigan <Paul.Handrigan@cirrus.com>,
	Tim Howe <tim.howe@cirrus.com>
Subject: [PATCH 1/2] ASoC: cs4349: Set .writeable_reg for cs4349_regmap
Date: Sun, 19 Jul 2015 09:14:23 +0800	[thread overview]
Message-ID: <1437268463.11309.1.camel@ingics.com> (raw)

The first valid register index is 1 rather than 0, and the CS4349_CHIPID
is readonly. So set .writeable_reg to avoid writing to these registers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/cs4349.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c
index f4fccc6..eb55889 100644
--- a/sound/soc/codecs/cs4349.c
+++ b/sound/soc/codecs/cs4349.c
@@ -54,14 +54,17 @@ struct  cs4349_private {
 static bool cs4349_readable_register(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
-	case CS4349_CHIPID:
-	case CS4349_MODE:
-	case CS4349_VMI:
-	case CS4349_MUTE:
-	case CS4349_VOLA:
-	case CS4349_VOLB:
-	case CS4349_RMPFLT:
-	case CS4349_MISC:
+	case CS4349_CHIPID ... CS4349_MISC:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static bool cs4349_writeable_register(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case CS4349_MODE ...  CS4349_MISC:
 		return true;
 	default:
 		return false;
@@ -272,6 +275,7 @@ static const struct regmap_config cs4349_regmap = {
 	.reg_defaults		= cs4349_reg_defaults,
 	.num_reg_defaults	= ARRAY_SIZE(cs4349_reg_defaults),
 	.readable_reg		= cs4349_readable_register,
+	.writeable_reg		= cs4349_writeable_register,
 	.cache_type		= REGCACHE_RBTREE,
 };
 
-- 
2.1.0

             reply	other threads:[~2015-07-19  1:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-19  1:14 Axel Lin [this message]
2015-07-19  1:15 ` [PATCH 2/2] ASoC: cs4349: Drop platform data support Axel Lin
2015-07-20 17:52   ` Applied "ASoC: cs4349: Drop platform data support" to the asoc tree Mark Brown
2015-07-20 17:52 ` Applied "ASoC: cs4349: Set .writeable_reg for cs4349_regmap" " Mark Brown
2015-07-30 21:19 ` [PATCH 1/2] ASoC: cs4349: Set .writeable_reg for cs4349_regmap Tim Howe

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=1437268463.11309.1.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=Paul.Handrigan@cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brian.austin@cirrus.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=tim.howe@cirrus.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