iio: st-sensors: add support for single full scale device
Some sensors could have only one full scale value. This means that the sensor hasn't a full scale register. This commit add a check on the configured full scale address to support such kind of sensors. Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
bc27381edb
commit
bb602f8c61
|
@ -126,6 +126,9 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
|
||||||
int err, i = 0;
|
int err, i = 0;
|
||||||
struct st_sensor_data *sdata = iio_priv(indio_dev);
|
struct st_sensor_data *sdata = iio_priv(indio_dev);
|
||||||
|
|
||||||
|
if (sdata->sensor_settings->fs.addr == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
err = st_sensors_match_fs(sdata->sensor_settings, fs, &i);
|
err = st_sensors_match_fs(sdata->sensor_settings, fs, &i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto st_accel_set_fullscale_error;
|
goto st_accel_set_fullscale_error;
|
||||||
|
|
Loading…
Reference in a new issue