diff options
author | Denis CIOCCA <denis.ciocca@st.com> | 2013-06-19 09:28:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-08-03 18:40:28 +0100 |
commit | 23cde4d65cc7d11e2048d2b240cdf13927ac50d0 (patch) | |
tree | 3fd2d23f8c092056244e14703bce9842c203ba13 /drivers/iio/pressure | |
parent | 36e607a16b8def1b184d48a4489b716d6dbe3379 (diff) | |
download | linux-23cde4d65cc7d11e2048d2b240cdf13927ac50d0.tar.gz linux-23cde4d65cc7d11e2048d2b240cdf13927ac50d0.tar.bz2 linux-23cde4d65cc7d11e2048d2b240cdf13927ac50d0.zip |
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/pressure')
-rw-r--r-- | drivers/iio/pressure/st_pressure.h | 11 | ||||
-rw-r--r-- | drivers/iio/pressure/st_pressure_core.c | 15 | ||||
-rw-r--r-- | drivers/iio/pressure/st_pressure_i2c.c | 2 | ||||
-rw-r--r-- | drivers/iio/pressure/st_pressure_spi.c | 2 |
4 files changed, 23 insertions, 7 deletions
diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h index 414e45ac9b9b..b0b630688da6 100644 --- a/drivers/iio/pressure/st_pressure.h +++ b/drivers/iio/pressure/st_pressure.h @@ -16,7 +16,16 @@ #define LPS331AP_PRESS_DEV_NAME "lps331ap" -int st_press_common_probe(struct iio_dev *indio_dev); +/** + * struct st_sensors_platform_data - default press platform data + * @drdy_int_pin: default press DRDY is available on INT1 pin. + */ +static const struct st_sensors_platform_data default_press_pdata = { + .drdy_int_pin = 1, +}; + +int st_press_common_probe(struct iio_dev *indio_dev, + struct st_sensors_platform_data *pdata); void st_press_common_remove(struct iio_dev *indio_dev); #ifdef CONFIG_IIO_BUFFER diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 3ffbc56917b4..81e2d5b030a6 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -58,7 +58,8 @@ #define ST_PRESS_1_BDU_ADDR 0x20 #define ST_PRESS_1_BDU_MASK 0x04 #define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 -#define ST_PRESS_1_DRDY_IRQ_MASK 0x04 +#define ST_PRESS_1_DRDY_IRQ_INT1_MASK 0x04 +#define ST_PRESS_1_DRDY_IRQ_INT2_MASK 0x20 #define ST_PRESS_1_MULTIREAD_BIT true #define ST_PRESS_1_TEMP_OFFSET 42500 @@ -116,7 +117,8 @@ static const struct st_sensors st_press_sensors[] = { }, .drdy_irq = { .addr = ST_PRESS_1_DRDY_IRQ_ADDR, - .mask = ST_PRESS_1_DRDY_IRQ_MASK, + .mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK, + .mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK, }, .multi_read_bit = ST_PRESS_1_MULTIREAD_BIT, .bootime = 2, @@ -202,7 +204,8 @@ static const struct iio_trigger_ops st_press_trigger_ops = { #define ST_PRESS_TRIGGER_OPS NULL #endif -int st_press_common_probe(struct iio_dev *indio_dev) +int st_press_common_probe(struct iio_dev *indio_dev, + struct st_sensors_platform_data *plat_data) { int err; struct st_sensor_data *pdata = iio_priv(indio_dev); @@ -224,7 +227,11 @@ int st_press_common_probe(struct iio_dev *indio_dev) &pdata->sensor->fs.fs_avl[0]; pdata->odr = pdata->sensor->odr.odr_avl[0].hz; - err = st_sensors_init_sensor(indio_dev); + if (!plat_data) + plat_data = + (struct st_sensors_platform_data *)&default_press_pdata; + + err = st_sensors_init_sensor(indio_dev, plat_data); if (err < 0) goto st_press_common_probe_error; diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c index 7cebcc73bfb0..306599307a96 100644 --- a/drivers/iio/pressure/st_pressure_i2c.c +++ b/drivers/iio/pressure/st_pressure_i2c.c @@ -36,7 +36,7 @@ static int st_press_i2c_probe(struct i2c_client *client, st_sensors_i2c_configure(indio_dev, client, pdata); - err = st_press_common_probe(indio_dev); + err = st_press_common_probe(indio_dev, client->dev.platform_data); if (err < 0) goto st_press_common_probe_error; diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c index 17a14907940a..b2aded6d2108 100644 --- a/drivers/iio/pressure/st_pressure_spi.c +++ b/drivers/iio/pressure/st_pressure_spi.c @@ -35,7 +35,7 @@ static int st_press_spi_probe(struct spi_device *spi) st_sensors_spi_configure(indio_dev, spi, pdata); - err = st_press_common_probe(indio_dev); + err = st_press_common_probe(indio_dev, spi->dev.platform_data); if (err < 0) goto st_press_common_probe_error; |