Skip to content

Commit

Permalink
Staging: IIO: lis3l02dq ring buffer and data ready trigger support
Browse files Browse the repository at this point in the history
Example of relatively common case of device sampling
based on internal clock and providing a data ready
signal to indicate that new data is available to be
read out.

Generic trigger approach used to allow other devices
to be sampled 'at the same time' as this the accelerometer.
This is very useful in various motion estimation algorithms.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent 2235acb commit 14cd9a7
Show file tree
Hide file tree
Showing 3 changed files with 621 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/staging/iio/accel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
obj-$(CONFIG_KXSD9) += kxsd9.o

lis3l02dq-y := lis3l02dq_core.o
lis3l02dq-$(CONFIG_IIO_RING_BUFFER) += lis3l02dq_ring.o
obj-$(CONFIG_LIS3L02DQ) += lis3l02dq.o

sca3000-y := sca3000_core.o sca3000_ring.o
Expand Down
22 changes: 21 additions & 1 deletion drivers/staging/iio/accel/lis3l02dq.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,26 @@ int lis3l02dq_spi_write_reg_8(struct device *dev,
#define LIS3L02DQ_SCAN_ACC_Y 1
#define LIS3L02DQ_SCAN_ACC_Z 2


#ifdef CONFIG_IIO_RING_BUFFER
/* At the moment triggers are only used for ring buffer
* filling. This may change!
*/
void lis3l02dq_remove_trigger(struct iio_dev *indio_dev);
int lis3l02dq_probe_trigger(struct iio_dev *indio_dev);

ssize_t lis3l02dq_read_accel_from_ring(struct device *dev,
struct device_attribute *attr,
char *buf);


int lis3l02dq_configure_ring(struct iio_dev *indio_dev);
void lis3l02dq_unconfigure_ring(struct iio_dev *indio_dev);

int lis3l02dq_initialize_ring(struct iio_ring_buffer *ring);
void lis3l02dq_uninitialize_ring(struct iio_ring_buffer *ring);
#else /* CONFIG_IIO_RING_BUFFER */

static inline void lis3l02dq_remove_trigger(struct iio_dev *indio_dev) {};
static inline int lis3l02dq_probe_trigger(struct iio_dev *indio_dev)
{
Expand All @@ -208,5 +228,5 @@ static inline int lis3l02dq_initialize_ring(struct iio_ring_buffer *ring)
return 0;
};
static inline void lis3l02dq_uninitialize_ring(struct iio_ring_buffer *ring) {};

#endif /* CONFIG_IIO_RING_BUFFER */
#endif /* SPI_LIS3L02DQ_H_ */
Loading

0 comments on commit 14cd9a7

Please sign in to comment.