summaryrefslogtreecommitdiffstats
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>2017-09-17 18:17:10 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-10-10 21:39:28 +0200
commit7d245172675a66bf3dc7f8fa51e81f80559a40a3 (patch)
tree8cf0e53dcc6bd8fddafd824e1555fde55af35ae1 /drivers/iio/common
parentiio: st_sensors: split open-drain parameters for irq1 and irq2 (diff)
downloadlinux-7d245172675a66bf3dc7f8fa51e81f80559a40a3.tar.xz
linux-7d245172675a66bf3dc7f8fa51e81f80559a40a3.zip
iio: common: st_sensors: check odr address value in st_sensors_set_odr()
Do not try to configure sample frequency if the sensor do not export odr register address in register map. That change will be used to properly support LIS3DHH accel sensor. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/common')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 40dfdfc0906b..57db19182e95 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -93,6 +93,9 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
struct st_sensor_odr_avl odr_out = {0, 0};
struct st_sensor_data *sdata = iio_priv(indio_dev);
+ if (!sdata->sensor_settings->odr.addr)
+ return 0;
+
err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
if (err < 0)
goto st_sensors_match_odr_error;