Commit 5eef36af authored by Matt Ranostay's avatar Matt Ranostay Committed by Sasha Levin

iio: proximity: as3935: fix as3935_write

[ Upstream commit 84ca8e36 ]

AS3935_WRITE_DATA macro bit is incorrect and the actual write
sequence is two leading zeros.

Cc: George McCollister <george.mccollister@gmail.com>
Signed-off-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent e8701e0f
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#define AS3935_TUNE_CAP 0x08 #define AS3935_TUNE_CAP 0x08
#define AS3935_CALIBRATE 0x3D #define AS3935_CALIBRATE 0x3D
#define AS3935_WRITE_DATA BIT(15)
#define AS3935_READ_DATA BIT(14) #define AS3935_READ_DATA BIT(14)
#define AS3935_ADDRESS(x) ((x) << 8) #define AS3935_ADDRESS(x) ((x) << 8)
...@@ -105,7 +104,7 @@ static int as3935_write(struct as3935_state *st, ...@@ -105,7 +104,7 @@ static int as3935_write(struct as3935_state *st,
{ {
u8 *buf = st->buf; u8 *buf = st->buf;
buf[0] = (AS3935_WRITE_DATA | AS3935_ADDRESS(reg)) >> 8; buf[0] = AS3935_ADDRESS(reg) >> 8;
buf[1] = val; buf[1] = val;
return spi_write(st->spi, buf, 2); return spi_write(st->spi, buf, 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment