summaryrefslogtreecommitdiff
path: root/drivers/iio/common
diff options
context:
space:
mode:
authorGiuseppe Barba <giuseppe.barba@st.com>2015-07-21 11:35:42 +0300
committerJonathan Cameron <jic23@kernel.org>2015-07-23 22:43:10 +0300
commitbb602f8c61e289389e7c2af1b577303a841f6d34 (patch)
tree46f8f8e4006d5f15452319b47cce62f17bd5a0f0 /drivers/iio/common
parentbc27381edbeb654d819b7e1464091c456a0d3e64 (diff)
downloadlinux-bb602f8c61e289389e7c2af1b577303a841f6d34.tar.xz
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>
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 d44bf1680859..2e7fdb502645 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -126,6 +126,9 @@ static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
int err, i = 0;
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);
if (err < 0)
goto st_accel_set_fullscale_error;