mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
a542f9a04d
commit
7d24517267
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue