Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249775
b: refs/heads/master
c: 25888dc
h: refs/heads/master
i:
  249773: 4ff330e
  249771: b7b20f6
  249767: 650b80e
  249759: 67931ed
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 9a3ec18 commit 68dca9b
Show file tree
Hide file tree
Showing 4 changed files with 511 additions and 710 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e3345bc2c118c43f7f8a6db5d71c06e02b989da
refs/heads/master: 25888dc51163a566f8c8f18a84c100851d12738c
76 changes: 22 additions & 54 deletions trunk/drivers/staging/iio/accel/sca3000.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@

/**
* struct sca3000_state - device instance state information
* @us: the associated spi device
* @info: chip variant information
* @indio_dev: device information used by the IIO core
* @interrupt_handler_ws: event interrupt handler for all events
* @last_timestamp: the timestamp of the last event
* @mo_det_use_count: reference counter for the motion detection unit
* @lock: lock used to protect elements of sca3000_state
* and the underlying device state.
* @bpse: number of bits per scan element
* @tx: dma-able transmit buffer
* @rx: dma-able receive buffer
* @us: the associated spi device
* @info: chip variant information
* @indio_dev: device information used by the IIO core
* @interrupt_handler_ws: event interrupt handler for all events
* @last_timestamp: the timestamp of the last event
* @mo_det_use_count: reference counter for the motion detection unit
* @lock: lock used to protect elements of sca3000_state
* and the underlying device state.
* @bpse: number of bits per scan element
* @tx: dma-able transmit buffer
* @rx: dma-able receive buffer
**/
struct sca3000_state {
struct spi_device *us;
Expand All @@ -179,15 +179,15 @@ struct sca3000_state {
int mo_det_use_count;
struct mutex lock;
int bpse;
u8 *tx;
/* not used during a ring buffer read */
u8 *rx;
/* Can these share a cacheline ? */
u8 rx[2] ____cacheline_aligned;
u8 tx[6] ____cacheline_aligned;
};

/**
* struct sca3000_chip_info - model dependent parameters
* @name: model identification
* @scale: string containing floating point scale factor
* @name: model identification
* @scale: scale * 10^-6
* @temp_output: some devices have temperature sensors.
* @measurement_mode_freq: normal mode sampling frequency
* @option_mode_1: first optional mode. Not all models have one
Expand All @@ -200,29 +200,20 @@ struct sca3000_state {
**/
struct sca3000_chip_info {
const char *name;
const char *scale;
unsigned int scale;
bool temp_output;
int measurement_mode_freq;
int option_mode_1;
int option_mode_1_freq;
int option_mode_2;
int option_mode_2_freq;
int mot_det_mult_xz[6];
int mot_det_mult_y[7];
};

/**
* sca3000_read_data() read a series of values from the device
* @dev: device
* @reg_address_high: start address (decremented read)
* @rx: pointer where received data is placed. Callee
* responsible for freeing this.
* @len: number of bytes to read
*
* The main lock must be held.
**/
int sca3000_read_data(struct sca3000_state *st,
u8 reg_address_high,
u8 **rx_p,
int len);
int sca3000_read_data_short(struct sca3000_state *st,
u8 reg_address_high,
int len);

/**
* sca3000_write_reg() write a single register
Expand All @@ -233,29 +224,6 @@ int sca3000_read_data(struct sca3000_state *st,
**/
int sca3000_write_reg(struct sca3000_state *st, u8 address, u8 val);

/* Conversion function for use with the ring buffer when in 11bit mode */
static inline int sca3000_11bit_convert(uint8_t msb, uint8_t lsb)
{
int16_t val;

val = ((lsb >> 3) & 0x1C) | (msb << 5);
val |= (val & (1 << 12)) ? 0xE000 : 0;

return val;
}

static inline int sca3000_13bit_convert(uint8_t msb, uint8_t lsb)
{
s16 val;

val = ((lsb >> 3) & 0x1F) | (msb << 5);
/* sign fill */
val |= (val & (1 << 12)) ? 0xE000 : 0;

return val;
}


#ifdef CONFIG_IIO_RING_BUFFER
/**
* sca3000_register_ring_funcs() setup the ring state change functions
Expand Down
Loading

0 comments on commit 68dca9b

Please sign in to comment.