aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorMarcus Folkesson <marcus.folkesson@gmail.com>2022-10-10 21:46:41 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-10-17 08:51:26 +0100
commit815f1647a603a822d66630bbe22cab4bc097c8c3 (patch)
tree4f171737c64f78bcbf3d4c2ad70f0eb31e91727b /drivers/iio
parentiio: adc: mcp3911: return proper error code on failure to allocate trigger (diff)
downloadlinux-dev-815f1647a603a822d66630bbe22cab4bc097c8c3.tar.xz
linux-dev-815f1647a603a822d66630bbe22cab4bc097c8c3.zip
iio: adc: mcp3911: use correct id bits
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/mcp3911.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/adc/mcp3911.c b/drivers/iio/adc/mcp3911.c
index 7f0b37994fe5..f57f5eb23d49 100644
--- a/drivers/iio/adc/mcp3911.c
+++ b/drivers/iio/adc/mcp3911.c
@@ -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