diff options
author | Andrey Smirnov <andreysm@charmander.(none)> | 2013-02-18 19:59:34 -0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-04 11:20:15 +0800 |
commit | d686500ae87275ed58a074f9e5e8b35b9afe30d8 (patch) | |
tree | 1f4f51f48d80cc7dc2fd75dd9e9c0f220b32bead /sound/soc | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) | |
download | talos-obmc-linux-d686500ae87275ed58a074f9e5e8b35b9afe30d8.tar.gz talos-obmc-linux-d686500ae87275ed58a074f9e5e8b35b9afe30d8.zip |
ASoC: si476x: Convert SI476X codec to use regmap
The latest radio and MFD drivers for SI476X radio chips use regmap API
to provide access to the registers and allow for caching of their
values when the actual chip is powered off. Convert the codec driver
to do the same, so it would not loose the settings when the radio
driver powers the chip down.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/si476x.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c index f2d61a187830..30aebbe6815e 100644 --- a/sound/soc/codecs/si476x.c +++ b/sound/soc/codecs/si476x.c @@ -45,13 +45,23 @@ static unsigned int si476x_codec_read(struct snd_soc_codec *codec, unsigned int reg) { int err; + unsigned int val; struct si476x_core *core = codec->control_data; si476x_core_lock(core); - err = si476x_core_cmd_get_property(core, reg); + if (!si476x_core_is_powered_up(core)) + regcache_cache_only(core->regmap, true); + + err = regmap_read(core->regmap, reg, &val); + + if (!si476x_core_is_powered_up(core)) + regcache_cache_only(core->regmap, false); si476x_core_unlock(core); - return err; + if (err < 0) + return err; + + return val; } static int si476x_codec_write(struct snd_soc_codec *codec, @@ -61,7 +71,13 @@ static int si476x_codec_write(struct snd_soc_codec *codec, struct si476x_core *core = codec->control_data; si476x_core_lock(core); - err = si476x_core_cmd_set_property(core, reg, val); + if (!si476x_core_is_powered_up(core)) + regcache_cache_only(core->regmap, true); + + err = regmap_write(core->regmap, reg, val); + + if (!si476x_core_is_powered_up(core)) + regcache_cache_only(core->regmap, false); si476x_core_unlock(core); return err; |