aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/pressure
diff options
context:
space:
mode:
authorDenis CIOCCA <denis.ciocca@st.com>2013-06-19 04:28:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-08-03 13:40:28 -0400
commit23cde4d65cc7d11e2048d2b240cdf13927ac50d0 (patch)
tree3fd2d23f8c092056244e14703bce9842c203ba13 /drivers/iio/pressure
parent36e607a16b8def1b184d48a4489b716d6dbe3379 (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/pressure')
-rw-r--r--drivers/iio/pressure/st_pressure.h11
-rw-r--r--drivers/iio/pressure/st_pressure_core.c15
-rw-r--r--drivers/iio/pressure/st_pressure_i2c.c2
-rw-r--r--drivers/iio/pressure/st_pressure_spi.c2
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 @@
16 16
17#define LPS331AP_PRESS_DEV_NAME "lps331ap" 17#define LPS331AP_PRESS_DEV_NAME "lps331ap"
18 18
19int st_press_common_probe(struct iio_dev *indio_dev); 19/**
20 * struct st_sensors_platform_data - default press platform data
21 * @drdy_int_pin: default press DRDY is available on INT1 pin.
22 */
23static const struct st_sensors_platform_data default_press_pdata = {
24 .drdy_int_pin = 1,
25};
26
27int st_press_common_probe(struct iio_dev *indio_dev,
28 struct st_sensors_platform_data *pdata);
20void st_press_common_remove(struct iio_dev *indio_dev); 29void st_press_common_remove(struct iio_dev *indio_dev);
21 30
22#ifdef CONFIG_IIO_BUFFER 31#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 @@
58#define ST_PRESS_1_BDU_ADDR 0x20 58#define ST_PRESS_1_BDU_ADDR 0x20
59#define ST_PRESS_1_BDU_MASK 0x04 59#define ST_PRESS_1_BDU_MASK 0x04
60#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 60#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22
61#define ST_PRESS_1_DRDY_IRQ_MASK 0x04 61#define ST_PRESS_1_DRDY_IRQ_INT1_MASK 0x04
62#define ST_PRESS_1_DRDY_IRQ_INT2_MASK 0x20
62#define ST_PRESS_1_MULTIREAD_BIT true 63#define ST_PRESS_1_MULTIREAD_BIT true
63#define ST_PRESS_1_TEMP_OFFSET 42500 64#define ST_PRESS_1_TEMP_OFFSET 42500
64 65
@@ -116,7 +117,8 @@ static const struct st_sensors st_press_sensors[] = {
116 }, 117 },
117 .drdy_irq = { 118 .drdy_irq = {
118 .addr = ST_PRESS_1_DRDY_IRQ_ADDR, 119 .addr = ST_PRESS_1_DRDY_IRQ_ADDR,
119 .mask = ST_PRESS_1_DRDY_IRQ_MASK, 120 .mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK,
121 .mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK,
120 }, 122 },
121 .multi_read_bit = ST_PRESS_1_MULTIREAD_BIT, 123 .multi_read_bit = ST_PRESS_1_MULTIREAD_BIT,
122 .bootime = 2, 124 .bootime = 2,
@@ -202,7 +204,8 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
202#define ST_PRESS_TRIGGER_OPS NULL 204#define ST_PRESS_TRIGGER_OPS NULL
203#endif 205#endif
204 206
205int st_press_common_probe(struct iio_dev *indio_dev) 207int st_press_common_probe(struct iio_dev *indio_dev,
208 struct st_sensors_platform_data *plat_data)
206{ 209{
207 int err; 210 int err;
208 struct st_sensor_data *pdata = iio_priv(indio_dev); 211 struct st_sensor_data *pdata = iio_priv(indio_dev);
@@ -224,7 +227,11 @@ int st_press_common_probe(struct iio_dev *indio_dev)
224 &pdata->sensor->fs.fs_avl[0]; 227 &pdata->sensor->fs.fs_avl[0];
225 pdata->odr = pdata->sensor->odr.odr_avl[0].hz; 228 pdata->odr = pdata->sensor->odr.odr_avl[0].hz;
226 229
227 err = st_sensors_init_sensor(indio_dev); 230 if (!plat_data)
231 plat_data =
232 (struct st_sensors_platform_data *)&default_press_pdata;
233
234 err = st_sensors_init_sensor(indio_dev, plat_data);
228 if (err < 0) 235 if (err < 0)
229 goto st_press_common_probe_error; 236 goto st_press_common_probe_error;
230 237
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,
36 36
37 st_sensors_i2c_configure(indio_dev, client, pdata); 37 st_sensors_i2c_configure(indio_dev, client, pdata);
38 38
39 err = st_press_common_probe(indio_dev); 39 err = st_press_common_probe(indio_dev, client->dev.platform_data);
40 if (err < 0) 40 if (err < 0)
41 goto st_press_common_probe_error; 41 goto st_press_common_probe_error;
42 42
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)
35 35
36 st_sensors_spi_configure(indio_dev, spi, pdata); 36 st_sensors_spi_configure(indio_dev, spi, pdata);
37 37
38 err = st_press_common_probe(indio_dev); 38 err = st_press_common_probe(indio_dev, spi->dev.platform_data);
39 if (err < 0) 39 if (err < 0)
40 goto st_press_common_probe_error; 40 goto st_press_common_probe_error;
41 41