aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-10 17:55:21 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-11 09:55:45 -0400
commit063b7cc43fb2413238095b81f9b4a2ee2c52056b (patch)
treebf5c65f30a4f67f41cc3544e10c57696ea9b3173 /sound/soc/soc-cache.c
parent051e994e9506e64259df34e91b028fe2470fbf2a (diff)
ASoC: Remove byte swap in 4x12 SPI write
snd_soc_4_12_spi_write() contains a byte swap. Since this code was written for an Analog CODEC on a Blackfin reference board it appears that this is done because while Blackfin is little endian the CODEC is big endian (as are most CODECs). Push this up into the generic 4x12 write function and use cpu_to_be16() to do the byte swap so things are more regular and things work on both CPU endiannesses. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 6e5e30a17f87..73907e5f078f 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -101,12 +101,11 @@ static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
101static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, 101static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg,
102 unsigned int value) 102 unsigned int value)
103{ 103{
104 u8 data[2]; 104 u16 data;
105 105
106 data[0] = (reg << 4) | ((value >> 8) & 0x000f); 106 data = cpu_to_be16((reg << 12) | (value & 0xffffff));
107 data[1] = value & 0x00ff;
108 107
109 return do_hw_write(codec, reg, value, data, 2); 108 return do_hw_write(codec, reg, value, &data, 2);
110} 109}
111 110
112#if defined(CONFIG_SPI_MASTER) 111#if defined(CONFIG_SPI_MASTER)
@@ -115,8 +114,8 @@ static int snd_soc_4_12_spi_write(void *control_data, const char *data,
115{ 114{
116 u8 msg[2]; 115 u8 msg[2];
117 116
118 msg[0] = data[1]; 117 msg[0] = data[0];
119 msg[1] = data[0]; 118 msg[1] = data[1];
120 119
121 return do_spi_write(control_data, msg, len); 120 return do_spi_write(control_data, msg, len);
122} 121}