Commit 24742ac6 authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

IIO: GYRO: IIO driver for Analog Devices Digital Output Gyroscope ADXRS450

From: Cliff Cai <cliff.cai@analog.com>

Add new IIO driver for Analog Devices digital output gyroscope ADXRS450
Signed-off-by: default avatarCliff Cai <cliff.cai@analog.com>
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d4894635
...@@ -35,3 +35,13 @@ config ADIS16260 ...@@ -35,3 +35,13 @@ config ADIS16260
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called adis16260. will be called adis16260.
config ADXRS450
tristate "Analog Devices ADXRS450 Digital Output Gyroscope SPI driver"
depends on SPI
help
Say yes here to build support for Analog Devices ADXRS450 programmable
digital output gyroscope.
This driver can also be built as a module. If so, the module
will be called adxrs450.
...@@ -17,3 +17,6 @@ obj-$(CONFIG_ADIS16260) += adis16260.o ...@@ -17,3 +17,6 @@ obj-$(CONFIG_ADIS16260) += adis16260.o
adis16251-y := adis16251_core.o adis16251-y := adis16251_core.o
obj-$(CONFIG_ADIS16251) += adis16251.o obj-$(CONFIG_ADIS16251) += adis16251.o
adxrs450-y := adxrs450_core.o
obj-$(CONFIG_ADXRS450) += adxrs450.o
#ifndef SPI_ADXRS450_H_
#define SPI_ADXRS450_H_
#define ADXRS450_STARTUP_DELAY 50 /* ms */
/* The MSB for the spi commands */
#define ADXRS450_SENSOR_DATA 0x20
#define ADXRS450_WRITE_DATA 0x40
#define ADXRS450_READ_DATA 0x80
#define ADXRS450_RATE1 0x00 /* Rate Registers */
#define ADXRS450_TEMP1 0x02 /* Temperature Registers */
#define ADXRS450_LOCST1 0x04 /* Low CST Memory Registers */
#define ADXRS450_HICST1 0x06 /* High CST Memory Registers */
#define ADXRS450_QUAD1 0x08 /* Quad Memory Registers */
#define ADXRS450_FAULT1 0x0A /* Fault Registers */
#define ADXRS450_PID1 0x0C /* Part ID Register 1 */
#define ADXRS450_SNH 0x0E /* Serial Number Registers, 4 bytes */
#define ADXRS450_SNL 0x10
#define ADXRS450_DNC1 0x12 /* Dynamic Null Correction Registers */
/* Check bits */
#define ADXRS450_P 0x01
#define ADXRS450_CHK 0x02
#define ADXRS450_CST 0x04
#define ADXRS450_PWR 0x08
#define ADXRS450_POR 0x10
#define ADXRS450_NVM 0x20
#define ADXRS450_Q 0x40
#define ADXRS450_PLL 0x80
#define ADXRS450_UV 0x100
#define ADXRS450_OV 0x200
#define ADXRS450_AMP 0x400
#define ADXRS450_FAIL 0x800
#define ADXRS450_WRERR_MASK (0x7 << 29)
#define ADXRS450_MAX_RX 4
#define ADXRS450_MAX_TX 4
#define ADXRS450_GET_ST(a) ((a >> 26) & 0x3)
/**
* struct adxrs450_state - device instance specific data
* @us: actual spi_device
* @indio_dev: industrial I/O device structure
* @tx: transmit buffer
* @rx: recieve buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adxrs450_state {
struct spi_device *us;
struct iio_dev *indio_dev;
u8 *tx;
u8 *rx;
struct mutex buf_lock;
};
#endif /* SPI_ADXRS450_H_ */
This diff is collapsed.
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