]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iio: st_sensors: Disable DRDY at init time
authorCrestez Dan Leonard <leonard.crestez@intel.com>
Fri, 13 May 2016 18:43:34 +0000 (21:43 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 29 May 2016 19:27:16 +0000 (20:27 +0100)
This fixes odd behavior after reboot.

The fact that we set the device to powerdown mode is not sufficient to
prevent DRDY being active because we might still have an unread sample.

Even if powerdown was sufficient keeping DRDY disabled while trigger is
not active is a good idea.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/st_sensors/st_sensors_core.c

index 928ee68fcc5fa1a9ab0238bdba687a57d8d249cf..9e59c90f6a8d7baa1ee091ea588b75a39414032c 100644 (file)
@@ -363,6 +363,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
        if (err < 0)
                return err;
 
+       /* Disable DRDY, this might be still be enabled after reboot. */
+       err = st_sensors_set_dataready_irq(indio_dev, false);
+       if (err < 0)
+               return err;
+
        if (sdata->current_fullscale) {
                err = st_sensors_set_fullscale(indio_dev,
                                                sdata->current_fullscale->num);