ASoC: adau1701: fix adau1701_reg_read()
Subsystems (3)
PATCH 1/1 ASoC: adau1701: fix adau1701_reg_read()
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 <[email protected]>
--- sound/soc/codecs/adau1701.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/adau1701.c +4 -2
@@ -240,8 +240,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 ; }
Signature · 1 line
1.9.3
Quoted 5 lines · Daniel Mack
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 <[email protected]>
Thanks.
Quoted 22 lines
--- sound/soc/codecs/adau1701.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)sound/soc/codecs/adau1701.c +4
-2@@ -240,8 +240,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 ; }
Quoted 3 lines · Daniel Mack
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.
Applied, thanks.