blob: c197360c450bd8549a980a24941b322df4fca88f [file] [log] [blame]
Denis Ciocca7be56a82013-01-25 23:44:00 +00001/*
2 * STMicroelectronics gyroscopes driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 * v. 1.0.0
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_GYRO_H
12#define ST_GYRO_H
13
14#include <linux/types.h>
15#include <linux/iio/common/st_sensors.h>
16
17#define L3G4200D_GYRO_DEV_NAME "l3g4200d"
18#define LSM330D_GYRO_DEV_NAME "lsm330d_gyro"
19#define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro"
20#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro"
21#define L3GD20_GYRO_DEV_NAME "l3gd20"
Denis Ciocca7be56a82013-01-25 23:44:00 +000022#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui"
23#define LSM330_GYRO_DEV_NAME "lsm330_gyro"
24
Denis CIOCCA23cde4d2013-06-19 09:28:00 +010025/**
26 * struct st_sensors_platform_data - gyro platform data
27 * @drdy_int_pin: DRDY on gyros is available only on INT2 pin.
28 */
29static const struct st_sensors_platform_data gyro_pdata = {
30 .drdy_int_pin = 2,
31};
32
33int st_gyro_common_probe(struct iio_dev *indio_dev,
34 struct st_sensors_platform_data *pdata);
Denis Ciocca7be56a82013-01-25 23:44:00 +000035void st_gyro_common_remove(struct iio_dev *indio_dev);
36
37#ifdef CONFIG_IIO_BUFFER
38int st_gyro_allocate_ring(struct iio_dev *indio_dev);
39void st_gyro_deallocate_ring(struct iio_dev *indio_dev);
40int st_gyro_trig_set_state(struct iio_trigger *trig, bool state);
41#define ST_GYRO_TRIGGER_SET_STATE (&st_gyro_trig_set_state)
42#else /* CONFIG_IIO_BUFFER */
43static inline int st_gyro_allocate_ring(struct iio_dev *indio_dev)
44{
45 return 0;
46}
47static inline void st_gyro_deallocate_ring(struct iio_dev *indio_dev)
48{
49}
50#define ST_GYRO_TRIGGER_SET_STATE NULL
51#endif /* CONFIG_IIO_BUFFER */
52
53#endif /* ST_GYRO_H */