All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync()
@ 2011-11-22 16:17 Daniel Mack
  2011-11-22 20:24 ` Timur Tabi
  2011-11-22 23:06 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Mack @ 2011-11-22 16:17 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, s.neumann, timur, Daniel Mack, lrg

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: Daniel Mack <zonque@gmail.com>
Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com>
---
 sound/soc/codecs/cs4270.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index f1f237e..73f46eb 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -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)
 {
 	struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
-	struct i2c_client *i2c_client = to_i2c_client(codec->dev);
 	int reg;
 
 	regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
@@ -612,14 +611,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec)
 	ndelay(500);
 
 	/* first restore the entire register cache ... */
-	for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) {
-		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;
-		}
-	}
+	snd_soc_cache_sync(codec);
 
 	/* ... then disable the power-down bits */
 	reg = snd_soc_read(codec, CS4270_PWRCTL);
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync()
  2011-11-22 16:17 [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync() Daniel Mack
@ 2011-11-22 20:24 ` Timur Tabi
  2011-11-22 23:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2011-11-22 20:24 UTC (permalink / raw)
  To: Daniel Mack; +Cc: alsa-devel, broonie, s.neumann, lrg

Daniel Mack wrote:
> 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: Daniel Mack <zonque@gmail.com>
> Reported-and-tested-by: Sven Neumann <s.neumann@raumfeld.com>
> ---

Acked-by: Timur Tabi <timur@freescale.com>

I can't test it, but it doesn't break anything else.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync()
  2011-11-22 16:17 [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync() Daniel Mack
  2011-11-22 20:24 ` Timur Tabi
@ 2011-11-22 23:06 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-11-22 23:06 UTC (permalink / raw)
  To: Daniel Mack; +Cc: alsa-devel, s.neumann, timur, lrg

On Tue, Nov 22, 2011 at 05:17:23PM +0100, Daniel Mack wrote:
> Replace the manual register restore mechanism in cs4270.c and call the
> generic snd_soc_cache_sync() handler instead.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-22 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 16:17 [PATCH v2] ALSA: ASoC: cs4720: use snd_soc_cache_sync() Daniel Mack
2011-11-22 20:24 ` Timur Tabi
2011-11-22 23:06 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.