diff options
author | Marcus Folkesson <marcus.folkesson@gmail.com> | 2022-10-10 21:46:41 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-10-17 08:51:26 +0100 |
commit | 815f1647a603a822d66630bbe22cab4bc097c8c3 (patch) | |
tree | 4f171737c64f78bcbf3d4c2ad70f0eb31e91727b /drivers/iio | |
parent | a83695a666eb3541873c3c9734ec4e1d10ca2d7f (diff) | |
download | linux-815f1647a603a822d66630bbe22cab4bc097c8c3.tar.bz2 |
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.c | 4 |
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 |