linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: mcp3911: use correct id bits
@ 2022-10-10 19:46 Marcus Folkesson
  2022-10-15 15:28 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus Folkesson @ 2022-10-10 19:46 UTC (permalink / raw)
  To: Marcus Folkesson, Kent Gustavsson, Jonathan Cameron, Lars-Peter Clausen
  Cc: linux-iio, linux-kernel

The device ID should be shifted 6 bits to left according to datasheet.

Fixes: 3a89b289df5d ("iio: adc: add support for mcp3911")
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/iio/adc/mcp3911.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index e55db02c534f..2c1af11a621f 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -57,8 +57,8 @@
 /* Internal voltage reference in mV */
 #define MCP3911_INT_VREF_MV		1200
 
-#define MCP3911_REG_READ(reg, id)	((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff)
-#define MCP3911_REG_WRITE(reg, id)	((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff)
+#define MCP3911_REG_READ(reg, id)	((((reg) << 1) | ((id) << 6) | (1 << 0)) & 0xff)
+#define MCP3911_REG_WRITE(reg, id)	((((reg) << 1) | ((id) << 6) | (0 << 0)) & 0xff)
 
 #define MCP3911_NUM_CHANNELS		2
 #define MCP3911_NUM_SCALES		6
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: mcp3911: use correct id bits
  2022-10-10 19:46 [PATCH] iio: adc: mcp3911: use correct id bits Marcus Folkesson
@ 2022-10-15 15:28 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-10-15 15:28 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Kent Gustavsson, Lars-Peter Clausen, linux-iio, linux-kernel

On Mon, 10 Oct 2022 21:46:41 +0200
Marcus Folkesson <marcus.folkesson@gmail.com> wrote:

> The device ID should be shifted 6 bits to left according to datasheet.
> 
> Fixes: 3a89b289df5d ("iio: adc: add support for mcp3911")
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Applied to the the fixes-togreg branch of iio.git.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/mcp3911.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
> index e55db02c534f..2c1af11a621f 100644
> --- a/drivers/iio/adc/mcp3911.c
> +++ b/drivers/iio/adc/mcp3911.c
> @@ -57,8 +57,8 @@
>  /* Internal voltage reference in mV */
>  #define MCP3911_INT_VREF_MV		1200
>  
> -#define MCP3911_REG_READ(reg, id)	((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff)
> -#define MCP3911_REG_WRITE(reg, id)	((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff)
> +#define MCP3911_REG_READ(reg, id)	((((reg) << 1) | ((id) << 6) | (1 << 0)) & 0xff)
> +#define MCP3911_REG_WRITE(reg, id)	((((reg) << 1) | ((id) << 6) | (0 << 0)) & 0xff)
>  
>  #define MCP3911_NUM_CHANNELS		2
>  #define MCP3911_NUM_SCALES		6


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-15 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 19:46 [PATCH] iio: adc: mcp3911: use correct id bits Marcus Folkesson
2022-10-15 15:28 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).