Skip to content

Commit bb602f8

Browse files
gbarba-stmjic23
authored andcommitted
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>
1 parent bc27381 commit bb602f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iio/common/st_sensors/st_sensors_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
126126
int err, i = 0;
127127
struct st_sensor_data *sdata = iio_priv(indio_dev);
128128

129+
if (sdata->sensor_settings->fs.addr == 0)
130+
return 0;
131+
129132
err = st_sensors_match_fs(sdata->sensor_settings, fs, &i);
130133
if (err < 0)
131134
goto st_accel_set_fullscale_error;

0 commit comments

Comments
 (0)