diff mbox series

iio: adc: mcp3911: use correct id bits

Message ID 20221010194641.676484-1-marcus.folkesson@gmail.com (mailing list archive)
State Accepted
Headers show
Series iio: adc: mcp3911: use correct id bits | expand

Commit Message

Marcus Folkesson Oct. 10, 2022, 7:46 p.m. UTC
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(-)

Comments

Jonathan Cameron Oct. 15, 2022, 3:28 p.m. UTC | #1
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
diff mbox series

Patch

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