All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16()
@ 2011-05-26 15:13 Mark Brown
  2011-05-26 15:13 ` [PATCH 2/4] ASoC: Convert 7x9 " Mark Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mark Brown @ 2011-05-26 15:13 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Make it clear what we're doing.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 06b7b81..abdf8d1 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -277,14 +277,12 @@ static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec,
 static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg,
 			       unsigned int value)
 {
-	u8 data[4];
+	u16 data[2];
 
-	data[0] = (reg >> 8) & 0xff;
-	data[1] = reg & 0xff;
-	data[2] = (value >> 8) & 0xff;
-	data[3] = value & 0xff;
+	data[0] = cpu_to_be16(reg);
+	data[1] = cpu_to_be16(value);
 
-	return do_hw_write(codec, reg, value, data, 4);
+	return do_hw_write(codec, reg, value, data, sizeof(data));
 }
 
 /* Primitive bulk write support for soc-cache.  The data pointed to by
-- 
1.7.5.1

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

* [PATCH 2/4] ASoC: Convert 7x9 write to use cpu_to_be16()
  2011-05-26 15:13 [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Mark Brown
@ 2011-05-26 15:13 ` Mark Brown
  2011-05-26 15:13 ` [PATCH 3/4] ASoC: Use cpu_to_be16() in 8x16 write Mark Brown
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-05-26 15:13 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Run the data through cpu_to_be16() so it's at least clear what we're up to.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index abdf8d1..a4b1f6c 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -107,12 +107,11 @@ static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec,
 static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg,
 			     unsigned int value)
 {
-	u8 data[2];
+	u16 data;
 
-	data[0] = (reg << 1) | ((value >> 8) & 0x0001);
-	data[1] = value & 0x00ff;
+	data = cpu_to_be16((reg << 9) | (value & 0x1ff));
 
-	return do_hw_write(codec, reg, value, data, 2);
+	return do_hw_write(codec, reg, value, &data, 2);
 }
 
 static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg,
-- 
1.7.5.1

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

* [PATCH 3/4] ASoC: Use cpu_to_be16() in 8x16 write
  2011-05-26 15:13 [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Mark Brown
  2011-05-26 15:13 ` [PATCH 2/4] ASoC: Convert 7x9 " Mark Brown
@ 2011-05-26 15:13 ` Mark Brown
  2011-05-26 15:13 ` [PATCH 4/4] ASoC: Use explicit endianness conversion in snd_soc_16_8_write() Mark Brown
  2011-05-27  9:18 ` [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Liam Girdwood
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-05-26 15:13 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index a4b1f6c..47d0a0c 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -136,10 +136,10 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg,
 			      unsigned int value)
 {
 	u8 data[3];
+	u16 val = cpu_to_be16(value);
 
 	data[0] = reg;
-	data[1] = (value >> 8) & 0xff;
-	data[2] = value & 0xff;
+	memcpy(&data[1], &val, sizeof(val));
 
 	return do_hw_write(codec, reg, value, data, 3);
 }
-- 
1.7.5.1

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

* [PATCH 4/4] ASoC: Use explicit endianness conversion in snd_soc_16_8_write()
  2011-05-26 15:13 [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Mark Brown
  2011-05-26 15:13 ` [PATCH 2/4] ASoC: Convert 7x9 " Mark Brown
  2011-05-26 15:13 ` [PATCH 3/4] ASoC: Use cpu_to_be16() in 8x16 write Mark Brown
@ 2011-05-26 15:13 ` Mark Brown
  2011-05-27  9:18 ` [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Liam Girdwood
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-05-26 15:13 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 47d0a0c..fa8c4de 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -242,9 +242,9 @@ static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg,
 			      unsigned int value)
 {
 	u8 data[3];
+	u16 rval = cpu_to_be16(reg);
 
-	data[0] = (reg >> 8) & 0xff;
-	data[1] = reg & 0xff;
+	memcpy(data, &rval, sizeof(rval));
 	data[2] = value;
 
 	return do_hw_write(codec, reg, value, data, 3);
-- 
1.7.5.1

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

* Re: [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16()
  2011-05-26 15:13 [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Mark Brown
                   ` (2 preceding siblings ...)
  2011-05-26 15:13 ` [PATCH 4/4] ASoC: Use explicit endianness conversion in snd_soc_16_8_write() Mark Brown
@ 2011-05-27  9:18 ` Liam Girdwood
  3 siblings, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2011-05-27  9:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Liam Girdwood

On 26/05/11 16:13, Mark Brown wrote:
> Make it clear what we're doing.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---

All

Acked-by: Liam Girdwood <lrg@ti.com>

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

end of thread, other threads:[~2011-05-27  9:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 15:13 [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Mark Brown
2011-05-26 15:13 ` [PATCH 2/4] ASoC: Convert 7x9 " Mark Brown
2011-05-26 15:13 ` [PATCH 3/4] ASoC: Use cpu_to_be16() in 8x16 write Mark Brown
2011-05-26 15:13 ` [PATCH 4/4] ASoC: Use explicit endianness conversion in snd_soc_16_8_write() Mark Brown
2011-05-27  9:18 ` [PATCH 1/4] ASoC: Convert 16x16 write to use cpu_to_be16() Liam Girdwood

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.