From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: andrew.smirnov@gmail.com
Cc: hverkuil@xs4all.nl, broonie@opensource.wolfsonmicro.com,
mchehab@redhat.com, sameo@linux.intel.com, perex@perex.cz,
tiwai@suse.de, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 6/7] sound/soc/codecs: Convert SI476X codec to use regmap
Date: Mon, 18 Feb 2013 19:59:34 -0800 [thread overview]
Message-ID: <1361246375-8848-7-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1361246375-8848-1-git-send-email-andrew.smirnov@gmail.com>
From: Andrey Smirnov <andreysm@charmander.(none)>
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>
---
sound/soc/codecs/si476x.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index f2d61a1..30aebbe 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;
--
1.7.10.4
next prev parent reply other threads:[~2013-02-19 4:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 3:59 [PATCH v4 0/7] Driver for Si476x series of chips Andrey Smirnov
2013-02-19 3:59 ` [PATCH v4 1/7] mfd: Add header files and Kbuild plumbing for SI476x MFD core Andrey Smirnov
2013-02-19 3:59 ` [PATCH v4 2/7] mfd: Add commands abstraction layer for SI476X MFD Andrey Smirnov
2013-02-19 3:59 ` [PATCH v4 3/7] mfd: Add the main bulk of core driver for SI476x code Andrey Smirnov
2013-02-19 3:59 ` [PATCH v4 4/7] mfd: Add chip properties handling code for SI476X MFD Andrey Smirnov
2013-02-19 3:59 ` [PATCH v4 5/7] v4l2: Add a V4L2 driver " Andrey Smirnov
2013-02-19 3:59 ` Andrey Smirnov [this message]
2013-02-20 17:11 ` [PATCH v4 6/7] sound/soc/codecs: Convert SI476X codec to use regmap Mark Brown
2013-02-19 3:59 ` [PATCH v4 7/7] sound/soc/codecs: Cosmetic changes to SI476X codec driver Andrey Smirnov
2013-02-20 17:11 ` Mark Brown
2013-02-19 5:05 ` [PATCH v4 0/7] Driver for Si476x series of chips Hans Verkuil
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=1361246375-8848-7-git-send-email-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=perex@perex.cz \
--cc=sameo@linux.intel.com \
--cc=tiwai@suse.de \
/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
all inboxes | Powered by JetHome®