Commit cdf6e817 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:gyro:adis16130 fix adis16130_spi_read which was never selecting the channel

Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 51ce068c
...@@ -75,15 +75,24 @@ static int adis16130_spi_read(struct device *dev, u8 reg_addr, ...@@ -75,15 +75,24 @@ static int adis16130_spi_read(struct device *dev, u8 reg_addr,
int ret; int ret;
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct adis16130_state *st = iio_priv(indio_dev); struct adis16130_state *st = iio_priv(indio_dev);
struct spi_message msg;
struct spi_transfer xfer = {
.tx_buf = st->buf,
.rx_buf = st->buf,
};
mutex_lock(&st->buf_lock); mutex_lock(&st->buf_lock);
st->buf[0] = ADIS16130_CON_RD | reg_addr; st->buf[0] = ADIS16130_CON_RD | reg_addr;
st->buf[1] = st->buf[2] = st->buf[3] = 0;
if (st->mode) if (st->mode)
ret = spi_read(st->us, st->buf, 4); xfer.len = 4;
else else
ret = spi_read(st->us, st->buf, 3); xfer.len = 3;
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(st->us, &msg);
if (ret == 0) { if (ret == 0) {
if (st->mode) if (st->mode)
*val = (st->buf[1] << 16) | *val = (st->buf[1] << 16) |
......
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