]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: cs4349: Set .writeable_reg for cs4349_regmap
authorAxel Lin <axel.lin@ingics.com>
Sun, 19 Jul 2015 01:14:23 +0000 (09:14 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 20 Jul 2015 17:18:46 +0000 (18:18 +0100)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs4349.c

index 4885695e35a73f2b040d60dc42940f406e69a924..a6604a34db347769dca3b1806a8080ce10288c36 100644 (file)
@@ -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;
@@ -270,6 +273,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,
 };