12 #include <linux/types.h>
14 #include <linux/device.h>
16 #include <linux/slab.h>
20 #include <linux/module.h>
25 #define DRV_NAME "ad2s1200"
31 #define AD2S1200_HZ 8192000
33 #define AD2S1200_TSCLK (1000000000/AD2S1200_HZ)
43 static int ad2s1200_read_raw(
struct iio_dev *indio_dev,
59 ret = spi_read(st->
sdev, st->rx, 2);
67 *val = (((
u16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4);
70 vel = (((
s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4);
71 vel = (vel << 4) >> 4;
97 static const struct iio_info ad2s1200_info = {
98 .read_raw = &ad2s1200_read_raw,
107 unsigned short *
pins = spi->
dev.platform_data;
111 pr_err(
"%s: request gpio pin %d failed\n",
116 if (indio_dev ==
NULL) {
120 spi_set_drvdata(spi, indio_dev);
121 st = iio_priv(indio_dev);
127 indio_dev->
dev.parent = &spi->
dev;
128 indio_dev->
info = &ad2s1200_info;
130 indio_dev->
channels = ad2s1200_channels;
147 for (--pn; pn >= 0; pn--)
172 .probe = ad2s1200_probe,
174 .id_table = ad2s1200_id,