10 #include <linux/device.h>
11 #include <linux/kernel.h>
13 #include <linux/slab.h>
15 #include <linux/module.h>
20 #define ADIS16080_DIN_GYRO (0 << 10)
21 #define ADIS16080_DIN_TEMP (1 << 10)
22 #define ADIS16080_DIN_AIN1 (2 << 10)
23 #define ADIS16080_DIN_AIN2 (3 << 10)
30 #define ADIS16080_DIN_WRITE (1 << 15)
45 static int adis16080_spi_write(
struct iio_dev *indio_dev,
52 st->buf[0] = val >> 8;
55 ret = spi_write(st->
us, st->buf, 2);
61 static int adis16080_spi_read(
struct iio_dev *indio_dev,
69 ret = spi_read(st->
us, st->buf, 2);
72 *val = ((st->buf[0] & 0xF) << 8) | st->buf[1];
78 static int adis16080_read_raw(
struct iio_dev *indio_dev,
91 ret = adis16080_spi_write(indio_dev,
96 ret = adis16080_spi_read(indio_dev, &ut);
136 static const struct iio_info adis16080_info = {
137 .read_raw = &adis16080_read_raw,
149 if (indio_dev ==
NULL) {
153 st = iio_priv(indio_dev);
155 spi_set_drvdata(spi, indio_dev);
161 indio_dev->
name = spi->
dev.driver->name;
162 indio_dev->
channels = adis16080_channels;
164 indio_dev->
dev.parent = &spi->
dev;
165 indio_dev->
info = &adis16080_info;
193 .probe = adis16080_probe,