Commit d66b8537 authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

ASoC: cs4720: use snd_soc_cache_sync()

Replace the manual register restore mechanism in cs4270.c and call the
generic snd_soc_cache_sync() handler instead.

This factors code out in favour of core facilities and also fixes a
bus confusion that is most probably caused by intermixing i2c-regmap
functions and i2c_smbus_* accessors.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Reported-and-tested-by: default avatarSven Neumann <s.neumann@raumfeld.com>
Acked-by: default avatarTimur Tabi <timur@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3d94a2a5
...@@ -601,7 +601,6 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) ...@@ -601,7 +601,6 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg)
static int cs4270_soc_resume(struct snd_soc_codec *codec) static int cs4270_soc_resume(struct snd_soc_codec *codec)
{ {
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
struct i2c_client *i2c_client = to_i2c_client(codec->dev);
int reg; int reg;
regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
...@@ -612,14 +611,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec) ...@@ -612,14 +611,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec)
ndelay(500); ndelay(500);
/* first restore the entire register cache ... */ /* first restore the entire register cache ... */
for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { snd_soc_cache_sync(codec);
u8 val = snd_soc_read(codec, reg);
if (i2c_smbus_write_byte_data(i2c_client, reg, val)) {
dev_err(codec->dev, "i2c write failed\n");
return -EIO;
}
}
/* ... then disable the power-down bits */ /* ... then disable the power-down bits */
reg = snd_soc_read(codec, CS4270_PWRCTL); reg = snd_soc_read(codec, CS4270_PWRCTL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment