Skip to content

Commit

Permalink
IIO: GYRO: IIO driver for Analog Devices Digital Output Gyroscope ADX…
Browse files Browse the repository at this point in the history
…RS450

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

Add new IIO driver for Analog Devices digital output gyroscope ADXRS450

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Apr 20, 2011
1 parent d489463 commit 24742ac
Show file tree
Hide file tree
Showing 4 changed files with 517 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/staging/iio/gyro/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ config ADIS16260

This driver can also be built as a module. If so, the module
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.
3 changes: 3 additions & 0 deletions drivers/staging/iio/gyro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ obj-$(CONFIG_ADIS16260) += adis16260.o

adis16251-y := adis16251_core.o
obj-$(CONFIG_ADIS16251) += adis16251.o

adxrs450-y := adxrs450_core.o
obj-$(CONFIG_ADXRS450) += adxrs450.o
58 changes: 58 additions & 0 deletions drivers/staging/iio/gyro/adxrs450.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#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_ */
Loading

0 comments on commit 24742ac

Please sign in to comment.