Skip to content

Commit 815f164

Browse files
marcusfolkessonjic23
authored andcommitted
iio: adc: mcp3911: use correct id bits
The device ID should be shifted 6 bits to left according to datasheet. Fixes: 3a89b28 ("iio: adc: add support for mcp3911") Signed-off-by: Marcus Folkesson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent a83695a commit 815f164

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/adc/mcp3911.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
/* Internal voltage reference in mV */
5656
#define MCP3911_INT_VREF_MV 1200
5757

58-
#define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 5) | (1 << 0)) & 0xff)
59-
#define MCP3911_REG_WRITE(reg, id) ((((reg) << 1) | ((id) << 5) | (0 << 0)) & 0xff)
58+
#define MCP3911_REG_READ(reg, id) ((((reg) << 1) | ((id) << 6) | (1 << 0)) & 0xff)
59+
#define MCP3911_REG_WRITE(reg, id) ((((reg) << 1) | ((id) << 6) | (0 << 0)) & 0xff)
6060

6161
#define MCP3911_NUM_CHANNELS 2
6262

0 commit comments

Comments
 (0)