Skip to content

Commit

Permalink
staging:iio:adis16220: Use adis library
Browse files Browse the repository at this point in the history
Use the new adis library for the adis16220 driver. The adis16220 driver is a bit
special and so we can only make use of the generic register access and control
functions for now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Nov 19, 2012
1 parent 511fb29 commit edcf600
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 240 deletions.
20 changes: 10 additions & 10 deletions drivers/staging/iio/accel/adis16220.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef SPI_ADIS16220_H_
#define SPI_ADIS16220_H_

#define ADIS16220_STARTUP_DELAY 220 /* ms */
#include "../imu/adis.h"

#define ADIS16220_READ_REG(a) a
#define ADIS16220_WRITE_REG(a) ((a) | 0x80)
#define ADIS16220_STARTUP_DELAY 220 /* ms */

/* Flash memory write count */
#define ADIS16220_FLASH_CNT 0x00
Expand Down Expand Up @@ -102,15 +101,15 @@
#define ADIS16220_DIAG_STAT_FLASH_CHK (1<<6)
#define ADIS16220_DIAG_STAT_SELF_TEST (1<<5)
/* Capture period violation/interruption */
#define ADIS16220_DIAG_STAT_VIOLATION (1<<4)
#define ADIS16220_DIAG_STAT_VIOLATION_BIT 4
/* SPI communications failure */
#define ADIS16220_DIAG_STAT_SPI_FAIL (1<<3)
#define ADIS16220_DIAG_STAT_SPI_FAIL_BIT 3
/* Flash update failure */
#define ADIS16220_DIAG_STAT_FLASH_UPT (1<<2)
#define ADIS16220_DIAG_STAT_FLASH_UPT_BIT 2
/* Power supply above 3.625 V */
#define ADIS16220_DIAG_STAT_POWER_HIGH (1<<1)
#define ADIS16220_DIAG_STAT_POWER_HIGH_BIT 1
/* Power supply below 3.15 V */
#define ADIS16220_DIAG_STAT_POWER_LOW (1<<0)
#define ADIS16220_DIAG_STAT_POWER_LOW_BIT 0

/* GLOB_CMD */
#define ADIS16220_GLOB_CMD_SW_RESET (1<<7)
Expand All @@ -125,13 +124,14 @@

/**
* struct adis16220_state - device instance specific data
* @us: actual spi_device
* @adis: adis device
* @tx: transmit buffer
* @rx: receive buffer
* @buf_lock: mutex to protect tx and rx
**/
struct adis16220_state {
struct spi_device *us;
struct adis adis;

struct mutex buf_lock;
u8 tx[ADIS16220_MAX_TX] ____cacheline_aligned;
u8 rx[ADIS16220_MAX_RX];
Expand Down
Loading

0 comments on commit edcf600

Please sign in to comment.