* [PATCH] ASoC: adau1701: fix adau1701_reg_read()
@ 2014-07-03 14:51 Daniel Mack
2014-07-03 17:21 ` Lars-Peter Clausen
2014-07-03 18:43 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Mack @ 2014-07-03 14:51 UTC (permalink / raw)
To: lars; +Cc: alsa-devel, broonie, 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 <zonque@gmail.com>
---
sound/soc/codecs/adau1701.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index defb277..15feb12 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -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;
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: adau1701: fix adau1701_reg_read()
2014-07-03 14:51 [PATCH] ASoC: adau1701: fix adau1701_reg_read() Daniel Mack
@ 2014-07-03 17:21 ` Lars-Peter Clausen
2014-07-03 18:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-07-03 17:21 UTC (permalink / raw)
To: Daniel Mack; +Cc: alsa-devel, broonie
On 07/03/2014 04:51 PM, Daniel Mack wrote:
> 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>
Thanks.
> ---
> sound/soc/codecs/adau1701.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
> index defb277..15feb12 100644
> --- a/sound/soc/codecs/adau1701.c
> +++ b/sound/soc/codecs/adau1701.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: adau1701: fix adau1701_reg_read()
2014-07-03 14:51 [PATCH] ASoC: adau1701: fix adau1701_reg_read() Daniel Mack
2014-07-03 17:21 ` Lars-Peter Clausen
@ 2014-07-03 18:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-07-03 18:43 UTC (permalink / raw)
To: Daniel Mack; +Cc: alsa-devel, lars
[-- Attachment #1.1: Type: text/plain, Size: 267 bytes --]
On Thu, Jul 03, 2014 at 04:51:36PM +0200, Daniel Mack wrote:
> 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.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-03 18:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 14:51 [PATCH] ASoC: adau1701: fix adau1701_reg_read() Daniel Mack
2014-07-03 17:21 ` Lars-Peter Clausen
2014-07-03 18:43 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.