Commit 7d245172 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jonathan Cameron

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: default avatarLorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent a542f9a0
...@@ -93,6 +93,9 @@ int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) ...@@ -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_odr_avl odr_out = {0, 0};
struct st_sensor_data *sdata = iio_priv(indio_dev); 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); err = st_sensors_match_odr(sdata->sensor_settings, odr, &odr_out);
if (err < 0) if (err < 0)
goto st_sensors_match_odr_error; goto st_sensors_match_odr_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment