Skip to content

Commit

Permalink
ASoC: adau1701: fix adau1701_reg_read()
Browse files Browse the repository at this point in the history
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>
Cc: stable@vger.kernel.org
  • Loading branch information
Daniel Mack authored and Mark Brown committed Jul 3, 2014
1 parent 7171511 commit 3ad80b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/soc/codecs/adau1701.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3ad80b8

Please sign in to comment.