diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-04-30 15:15:47 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-07 10:42:32 +0100 |
commit | d2bc431868a1c3172bb8fa3187a90fa806bba484 (patch) | |
tree | 15da3d0073ac1054623a9ca29510eabaaf3fb4b2 /drivers/iio/common | |
parent | 3337c9ff17948e1879fb06ea722baa9519533e0f (diff) | |
download | blackbird-op-linux-d2bc431868a1c3172bb8fa3187a90fa806bba484.tar.gz blackbird-op-linux-d2bc431868a1c3172bb8fa3187a90fa806bba484.zip |
iio: st_sensors: make interrupt optional
Some sensors such as magnetometers and pressure sensors doesn't
have interrupts at all, and thus no DRDY setting applies. Make
the assignment of an interrupt optional, and do not call
st_sensors_set_drdy_int_pin() if there is no drdy (data ready)
pin specified.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/common')
-rw-r--r-- | drivers/iio/common/st_sensors/st_sensors_core.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index edd13d2b4121..5a01093b29a2 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -245,6 +245,16 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev, { struct st_sensor_data *sdata = iio_priv(indio_dev); + /* Sensor does not support interrupts */ + if (sdata->sensor_settings->drdy_irq.addr == 0) { + if (pdata->drdy_int_pin) + dev_info(&indio_dev->dev, + "DRDY on pin INT%d specified, but sensor " + "does not support interrupts\n", + pdata->drdy_int_pin); + return 0; + } + switch (pdata->drdy_int_pin) { case 1: if (sdata->sensor_settings->drdy_irq.mask_int1 == 0) { @@ -285,7 +295,7 @@ static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev, if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2)) pdata->drdy_int_pin = (u8) val; else - pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 1; + pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 0; return pdata; } |