drivers:iio:stm:imu: Fix check when odr change

The callback function raw_get_fmt does not check mask
IIO_CHAN_INFO_SAMP_FREQ and returns error when sensor
odr is changed.

Signed-off-by: Mario Tesi <mario.tesi@st.com>
Change-Id: Idf4ee04e89d67d8d2ad52611c28c9314b3dca1e7
Reviewed-on: https://gerrit.st.com/c/linuxandroidopen/stm-ldd-iio/+/303978
Tested-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: Matteo DAMENO <matteo.dameno@st.com>
This commit is contained in:
Mario Tesi 2023-05-03 11:01:32 +02:00 committed by Matteo DAMENO
parent 87a218df8b
commit b1f69ff9c6
4 changed files with 16 additions and 7 deletions

View File

@ -1026,7 +1026,8 @@ static int st_ism330dhcx_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{
if (mask == IIO_CHAN_INFO_SCALE) {
switch (mask) {
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_ANGL_VEL:
case IIO_ACCEL:
@ -1034,8 +1035,10 @@ static int st_ism330dhcx_write_raw_get_fmt(struct iio_dev *indio_dev,
case IIO_TEMP:
return IIO_VAL_FRACTIONAL;
default:
return -EINVAL;
return IIO_VAL_INT_PLUS_MICRO;
}
default:
return IIO_VAL_INT_PLUS_MICRO;
}
return -EINVAL;

View File

@ -425,7 +425,7 @@ static int st_lsm6dso16is_write_raw_get_fmt(struct iio_dev *indio_dev,
case IIO_TEMP:
return IIO_VAL_FRACTIONAL;
default:
return -EINVAL;
return IIO_VAL_INT_PLUS_MICRO;
}
default:
return IIO_VAL_INT_PLUS_MICRO;

View File

@ -1594,7 +1594,8 @@ static int st_lsm6dsox_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{
if (mask == IIO_CHAN_INFO_SCALE) {
switch (mask) {
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_ANGL_VEL:
case IIO_ACCEL:
@ -1602,8 +1603,10 @@ static int st_lsm6dsox_write_raw_get_fmt(struct iio_dev *indio_dev,
case IIO_TEMP:
return IIO_VAL_FRACTIONAL;
default:
return -EINVAL;
return IIO_VAL_INT_PLUS_MICRO;
}
default:
return IIO_VAL_INT_PLUS_MICRO;
}
return -EINVAL;

View File

@ -1413,7 +1413,8 @@ static int st_lsm6dsrx_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{
if (mask == IIO_CHAN_INFO_SCALE) {
switch (mask) {
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_ANGL_VEL:
case IIO_ACCEL:
@ -1421,8 +1422,10 @@ static int st_lsm6dsrx_write_raw_get_fmt(struct iio_dev *indio_dev,
case IIO_TEMP:
return IIO_VAL_FRACTIONAL;
default:
return -EINVAL;
return IIO_VAL_INT_PLUS_MICRO;
}
default:
return IIO_VAL_INT_PLUS_MICRO;
}
return -EINVAL;