diff mbox

ASoC: rt286: Restore default in probe

Message ID 1428549632-27893-1-git-send-email-bardliao@realtek.com (mailing list archive)
State Accepted
Commit d53d59ecad74f3e90c6eefedd2186abbadd64d7c
Headers show

Commit Message

Bard Liao April 9, 2015, 3:20 a.m. UTC
RT286 can't do register reset. If the hardware power is still existing
in power off, rt286 will keep the register settings. So, we need to
restore the default register value in probe to make sure the cache value
is the same as the real register value.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt286.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Mark Brown April 9, 2015, 10:32 a.m. UTC | #1
On Thu, Apr 09, 2015 at 11:20:32AM +0800, Bard Liao wrote:
> RT286 can't do register reset. If the hardware power is still existing
> in power off, rt286 will keep the register settings. So, we need to
> restore the default register value in probe to make sure the cache value
> is the same as the real register value.

That's really unfortunate but OK, applied.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index 842cfb9..87af81b 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -1250,6 +1250,14 @@  static int rt286_i2c_probe(struct i2c_client *i2c,
 	rt286->i2c = i2c;
 	i2c_set_clientdata(i2c, rt286);
 
+	/* restore codec default */
+	for (i = 0; i < INDEX_CACHE_SIZE; i++)
+		regmap_write(rt286->regmap, rt286->index_cache[i].reg,
+				rt286->index_cache[i].def);
+	for (i = 0; i < ARRAY_SIZE(rt286_reg); i++)
+		regmap_write(rt286->regmap, rt286_reg[i].reg,
+				rt286_reg[i].def);
+
 	if (pdata)
 		rt286->pdata = *pdata;