diff options
author | Daniel Mack <zonque@gmail.com> | 2014-07-03 16:51:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-17 09:22:06 -0700 |
commit | 13c227e8c6e737e15c94c8a423fc55be4b23816c (patch) | |
tree | 45125a6831be5a7f8f33a326eff4d3c8442acf73 | |
parent | 2ea1777e35748d4ee71b1e1cce2e1e8ec5d7c6e0 (diff) | |
download | lwn-13c227e8c6e737e15c94c8a423fc55be4b23816c.tar.gz lwn-13c227e8c6e737e15c94c8a423fc55be4b23816c.zip |
ASoC: adau1701: fix adau1701_reg_read()
commit 3ad80b828b2533f37c221e2df155774efd6ed814 upstream.
Fix a long standing bug in the read register routing of adau1701.
The bytes arrive in the buffer in big-endian, so the result has to be
shifted before and-ing the bytes in the loop.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | sound/soc/codecs/adau1701.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index d71c59cf7bdd..370b742117ef 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -230,8 +230,10 @@ static int adau1701_reg_read(void *context, unsigned int reg, *value = 0; - for (i = 0; i < size; i++) - *value |= recv_buf[i] << (i * 8); + for (i = 0; i < size; i++) { + *value <<= 8; + *value |= recv_buf[i]; + } return 0; } |