iio: st_sensors: do not always write enable_axis register

New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Lorenzo Bianconi 2017-08-30 13:50:41 +02:00 коммит произвёл Jonathan Cameron
Родитель 75d4c6d2e1
Коммит 2e8325f489
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -221,11 +221,14 @@ EXPORT_SYMBOL(st_sensors_set_enable);
int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable)
{
struct st_sensor_data *sdata = iio_priv(indio_dev);
int err = 0;
return st_sensors_write_data_with_mask(indio_dev,
if (sdata->sensor_settings->enable_axis.addr)
err = st_sensors_write_data_with_mask(indio_dev,
sdata->sensor_settings->enable_axis.addr,
sdata->sensor_settings->enable_axis.mask,
axis_enable);
return err;
}
EXPORT_SYMBOL(st_sensors_set_axis_enable);