ASoC: cs4349: Set .writeable_reg for cs4349_regmap

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>
This commit is contained in:
Axel Lin 2015-07-19 09:14:23 +08:00 committed by Mark Brown
parent da304ac37e
commit 0443de7e7e

View File

@ -54,14 +54,17 @@ struct cs4349_private {
static bool cs4349_readable_register(struct device *dev, unsigned int reg) static bool cs4349_readable_register(struct device *dev, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case CS4349_CHIPID: case CS4349_CHIPID ... CS4349_MISC:
case CS4349_MODE: return true;
case CS4349_VMI: default:
case CS4349_MUTE: return false;
case CS4349_VOLA: }
case CS4349_VOLB: }
case CS4349_RMPFLT:
case CS4349_MISC: static bool cs4349_writeable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case CS4349_MODE ... CS4349_MISC:
return true; return true;
default: default:
return false; return false;
@ -270,6 +273,7 @@ static const struct regmap_config cs4349_regmap = {
.reg_defaults = cs4349_reg_defaults, .reg_defaults = cs4349_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(cs4349_reg_defaults), .num_reg_defaults = ARRAY_SIZE(cs4349_reg_defaults),
.readable_reg = cs4349_readable_register, .readable_reg = cs4349_readable_register,
.writeable_reg = cs4349_writeable_register,
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
}; };