iio: adc: mcp3911: use correct id bits
authorMarcus Folkesson <marcus.folkesson@gmail.com>
Mon, 10 Oct 2022 19:46:41 +0000 (21:46 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Oct 2022 07:51:26 +0000 (08:51 +0100)
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>
Link: https://lore.kernel.org/r/20221010194641.676484-1-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/mcp3911.c

index 7f0b379..f57f5eb 100644 (file)
@@ -55,8 +55,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