alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: max98095: Convert codec->hw_write to snd_soc_write
@ 2011-10-14  3:43 Axel Lin
  2011-10-14 17:40 ` Peter Hsiang
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2011-10-14  3:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peter Hsiang, alsa-devel, Mark Brown, Liam Girdwood

codec->hw_write is broken now, convert codec->hw_write to snd_soc_write.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
Hi,
  I don't have this hardware, I'd appreciate if someone can test this patch.

Thanks,
Axel

 sound/soc/codecs/max98095.c |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index 6982f74..85f9379 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -610,24 +610,6 @@ static int max98095_volatile(struct snd_soc_codec *codec, unsigned int reg)
 }
 
 /*
- * Filter coefficients are in a separate register segment
- * and they share the address space of the normal registers.
- * The coefficient registers do not need or share the cache.
- */
-static int max98095_hw_write(struct snd_soc_codec *codec, unsigned int reg,
-			     unsigned int value)
-{
-	u8 data[2];
-
-	data[0] = reg;
-	data[1] = value;
-	if (codec->hw_write(codec->control_data, data, 2) == 2)
-		return 0;
-	else
-		return -EIO;
-}
-
-/*
  * Load equalizer DSP coefficient configurations registers
  */
 static void m98095_eq_band(struct snd_soc_codec *codec, unsigned int dai,
@@ -647,8 +629,8 @@ static void m98095_eq_band(struct snd_soc_codec *codec, unsigned int dai,
 
 	/* Step through the registers and coefs */
 	for (i = 0; i < M98095_COEFS_PER_BAND; i++) {
-		max98095_hw_write(codec, eq_reg++, M98095_BYTE1(coefs[i]));
-		max98095_hw_write(codec, eq_reg++, M98095_BYTE0(coefs[i]));
+		snd_soc_write(codec, eq_reg++, M98095_BYTE1(coefs[i]));
+		snd_soc_write(codec, eq_reg++, M98095_BYTE0(coefs[i]));
 	}
 }
 
@@ -672,8 +654,8 @@ static void m98095_biquad_band(struct snd_soc_codec *codec, unsigned int dai,
 
 	/* Step through the registers and coefs */
 	for (i = 0; i < M98095_COEFS_PER_BAND; i++) {
-		max98095_hw_write(codec, bq_reg++, M98095_BYTE1(coefs[i]));
-		max98095_hw_write(codec, bq_reg++, M98095_BYTE0(coefs[i]));
+		snd_soc_write(codec, bq_reg++, M98095_BYTE1(coefs[i]));
+		snd_soc_write(codec, bq_reg++, M98095_BYTE0(coefs[i]));
 	}
 }
 
-- 
1.7.4.1

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

* Re: [PATCH] ASoC: max98095: Convert codec->hw_write to snd_soc_write
  2011-10-14  3:43 [PATCH] ASoC: max98095: Convert codec->hw_write to snd_soc_write Axel Lin
@ 2011-10-14 17:40 ` Peter Hsiang
  2011-10-14 19:03   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Hsiang @ 2011-10-14 17:40 UTC (permalink / raw)
  To: Axel Lin, Mark Brown
  Cc: alsa-devel@alsa-project.org, Liam Girdwood,
	linux-kernel@vger.kernel.org

On Fri, Oct 14, 2011, Axel Lin wrote:
> codec->hw_write is broken now, convert codec->hw_write to
> snd_soc_write.
> 

The hardware has 2 banks of registers sharing a section in I2C register space.
The 1st bank is the primary one and is cached.  
The 2nd bank is for loading coefficients only and they do not need cache.
These coefficients registers are therefore direct writes.
Changing this to a cached write will overwrite the cache.

Peter

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

* Re: [PATCH] ASoC: max98095: Convert codec->hw_write to snd_soc_write
  2011-10-14 17:40 ` Peter Hsiang
@ 2011-10-14 19:03   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-10-14 19:03 UTC (permalink / raw)
  To: Peter Hsiang
  Cc: Axel Lin, Liam Girdwood, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org

On Fri, Oct 14, 2011 at 10:40:58AM -0700, Peter Hsiang wrote:
> On Fri, Oct 14, 2011, Axel Lin wrote:
> > codec->hw_write is broken now, convert codec->hw_write to
> > snd_soc_write.

> The hardware has 2 banks of registers sharing a section in I2C register space.
> The 1st bank is the primary one and is cached.  
> The 2nd bank is for loading coefficients only and they do not need cache.
> These coefficients registers are therefore direct writes.
> Changing this to a cached write will overwrite the cache.

Writes to the cached region should be done within a cache_bypass flag to
deal with this.

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

end of thread, other threads:[~2011-10-14 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14  3:43 [PATCH] ASoC: max98095: Convert codec->hw_write to snd_soc_write Axel Lin
2011-10-14 17:40 ` Peter Hsiang
2011-10-14 19:03   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).