Commit 9e5cee313366d72939f6991ef0a265c8c8da6404

Authored by Daniel Mack
Committed by Jiri Slaby
1 parent 109275a6d6

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: Jiri Slaby <jslaby@suse.cz>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

sound/soc/codecs/adau1701.c
... ... @@ -230,8 +230,10 @@
230 230  
231 231 *value = 0;
232 232  
233   - for (i = 0; i < size; i++)
234   - *value |= recv_buf[i] << (i * 8);
  233 + for (i = 0; i < size; i++) {
  234 + *value <<= 8;
  235 + *value |= recv_buf[i];
  236 + }
235 237  
236 238 return 0;
237 239 }