diff options
author | Denis CIOCCA <denis.ciocca@st.com> | 2013-06-19 04:28:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 13:40:28 -0400 |
commit | 23cde4d65cc7d11e2048d2b240cdf13927ac50d0 (patch) | |
tree | 3fd2d23f8c092056244e14703bce9842c203ba13 /drivers/iio/gyro | |
parent | 36e607a16b8def1b184d48a4489b716d6dbe3379 (diff) |
iio: Added ST-sensors platform data to select the DRDY interrupt pin
This patch add support to redirect the DRDY interrupt on INT1 or INT2
on accelerometer and pressure sensors.
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/st_gyro.h | 11 | ||||
-rw-r--r-- | drivers/iio/gyro/st_gyro_core.c | 13 | ||||
-rw-r--r-- | drivers/iio/gyro/st_gyro_i2c.c | 3 | ||||
-rw-r--r-- | drivers/iio/gyro/st_gyro_spi.c | 3 |
4 files changed, 21 insertions, 9 deletions
diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index 3ad9907bb154..f8f2bf84a5a2 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h | |||
@@ -23,7 +23,16 @@ | |||
23 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" | 23 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" |
24 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" | 24 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" |
25 | 25 | ||
26 | int st_gyro_common_probe(struct iio_dev *indio_dev); | 26 | /** |
27 | * struct st_sensors_platform_data - gyro platform data | ||
28 | * @drdy_int_pin: DRDY on gyros is available only on INT2 pin. | ||
29 | */ | ||
30 | static const struct st_sensors_platform_data gyro_pdata = { | ||
31 | .drdy_int_pin = 2, | ||
32 | }; | ||
33 | |||
34 | int st_gyro_common_probe(struct iio_dev *indio_dev, | ||
35 | struct st_sensors_platform_data *pdata); | ||
27 | void st_gyro_common_remove(struct iio_dev *indio_dev); | 36 | void st_gyro_common_remove(struct iio_dev *indio_dev); |
28 | 37 | ||
29 | #ifdef CONFIG_IIO_BUFFER | 38 | #ifdef CONFIG_IIO_BUFFER |
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index f9ed3488c314..85fa8d343bb2 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #define ST_GYRO_1_BDU_ADDR 0x23 | 60 | #define ST_GYRO_1_BDU_ADDR 0x23 |
61 | #define ST_GYRO_1_BDU_MASK 0x80 | 61 | #define ST_GYRO_1_BDU_MASK 0x80 |
62 | #define ST_GYRO_1_DRDY_IRQ_ADDR 0x22 | 62 | #define ST_GYRO_1_DRDY_IRQ_ADDR 0x22 |
63 | #define ST_GYRO_1_DRDY_IRQ_MASK 0x08 | 63 | #define ST_GYRO_1_DRDY_IRQ_INT2_MASK 0x08 |
64 | #define ST_GYRO_1_MULTIREAD_BIT true | 64 | #define ST_GYRO_1_MULTIREAD_BIT true |
65 | 65 | ||
66 | /* CUSTOM VALUES FOR SENSOR 2 */ | 66 | /* CUSTOM VALUES FOR SENSOR 2 */ |
@@ -84,7 +84,7 @@ | |||
84 | #define ST_GYRO_2_BDU_ADDR 0x23 | 84 | #define ST_GYRO_2_BDU_ADDR 0x23 |
85 | #define ST_GYRO_2_BDU_MASK 0x80 | 85 | #define ST_GYRO_2_BDU_MASK 0x80 |
86 | #define ST_GYRO_2_DRDY_IRQ_ADDR 0x22 | 86 | #define ST_GYRO_2_DRDY_IRQ_ADDR 0x22 |
87 | #define ST_GYRO_2_DRDY_IRQ_MASK 0x08 | 87 | #define ST_GYRO_2_DRDY_IRQ_INT2_MASK 0x08 |
88 | #define ST_GYRO_2_MULTIREAD_BIT true | 88 | #define ST_GYRO_2_MULTIREAD_BIT true |
89 | 89 | ||
90 | static const struct iio_chan_spec st_gyro_16bit_channels[] = { | 90 | static const struct iio_chan_spec st_gyro_16bit_channels[] = { |
@@ -158,7 +158,7 @@ static const struct st_sensors st_gyro_sensors[] = { | |||
158 | }, | 158 | }, |
159 | .drdy_irq = { | 159 | .drdy_irq = { |
160 | .addr = ST_GYRO_1_DRDY_IRQ_ADDR, | 160 | .addr = ST_GYRO_1_DRDY_IRQ_ADDR, |
161 | .mask = ST_GYRO_1_DRDY_IRQ_MASK, | 161 | .mask_int2 = ST_GYRO_1_DRDY_IRQ_INT2_MASK, |
162 | }, | 162 | }, |
163 | .multi_read_bit = ST_GYRO_1_MULTIREAD_BIT, | 163 | .multi_read_bit = ST_GYRO_1_MULTIREAD_BIT, |
164 | .bootime = 2, | 164 | .bootime = 2, |
@@ -221,7 +221,7 @@ static const struct st_sensors st_gyro_sensors[] = { | |||
221 | }, | 221 | }, |
222 | .drdy_irq = { | 222 | .drdy_irq = { |
223 | .addr = ST_GYRO_2_DRDY_IRQ_ADDR, | 223 | .addr = ST_GYRO_2_DRDY_IRQ_ADDR, |
224 | .mask = ST_GYRO_2_DRDY_IRQ_MASK, | 224 | .mask_int2 = ST_GYRO_2_DRDY_IRQ_INT2_MASK, |
225 | }, | 225 | }, |
226 | .multi_read_bit = ST_GYRO_2_MULTIREAD_BIT, | 226 | .multi_read_bit = ST_GYRO_2_MULTIREAD_BIT, |
227 | .bootime = 2, | 227 | .bootime = 2, |
@@ -302,7 +302,8 @@ static const struct iio_trigger_ops st_gyro_trigger_ops = { | |||
302 | #define ST_GYRO_TRIGGER_OPS NULL | 302 | #define ST_GYRO_TRIGGER_OPS NULL |
303 | #endif | 303 | #endif |
304 | 304 | ||
305 | int st_gyro_common_probe(struct iio_dev *indio_dev) | 305 | int st_gyro_common_probe(struct iio_dev *indio_dev, |
306 | struct st_sensors_platform_data *pdata) | ||
306 | { | 307 | { |
307 | int err; | 308 | int err; |
308 | struct st_sensor_data *gdata = iio_priv(indio_dev); | 309 | struct st_sensor_data *gdata = iio_priv(indio_dev); |
@@ -324,7 +325,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev) | |||
324 | &gdata->sensor->fs.fs_avl[0]; | 325 | &gdata->sensor->fs.fs_avl[0]; |
325 | gdata->odr = gdata->sensor->odr.odr_avl[0].hz; | 326 | gdata->odr = gdata->sensor->odr.odr_avl[0].hz; |
326 | 327 | ||
327 | err = st_sensors_init_sensor(indio_dev); | 328 | err = st_sensors_init_sensor(indio_dev, pdata); |
328 | if (err < 0) | 329 | if (err < 0) |
329 | goto st_gyro_common_probe_error; | 330 | goto st_gyro_common_probe_error; |
330 | 331 | ||
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 8a310500573d..c7a29a4d7e82 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c | |||
@@ -36,7 +36,8 @@ static int st_gyro_i2c_probe(struct i2c_client *client, | |||
36 | 36 | ||
37 | st_sensors_i2c_configure(indio_dev, client, gdata); | 37 | st_sensors_i2c_configure(indio_dev, client, gdata); |
38 | 38 | ||
39 | err = st_gyro_common_probe(indio_dev); | 39 | err = st_gyro_common_probe(indio_dev, |
40 | (struct st_sensors_platform_data *)&gyro_pdata); | ||
40 | if (err < 0) | 41 | if (err < 0) |
41 | goto st_gyro_common_probe_error; | 42 | goto st_gyro_common_probe_error; |
42 | 43 | ||
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index f3540390eb22..14b0762847f5 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c | |||
@@ -35,7 +35,8 @@ static int st_gyro_spi_probe(struct spi_device *spi) | |||
35 | 35 | ||
36 | st_sensors_spi_configure(indio_dev, spi, gdata); | 36 | st_sensors_spi_configure(indio_dev, spi, gdata); |
37 | 37 | ||
38 | err = st_gyro_common_probe(indio_dev); | 38 | err = st_gyro_common_probe(indio_dev, |
39 | (struct st_sensors_platform_data *)&gyro_pdata); | ||
39 | if (err < 0) | 40 | if (err < 0) |
40 | goto st_gyro_common_probe_error; | 41 | goto st_gyro_common_probe_error; |
41 | 42 | ||