Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: pressure: bmp280: Remove config error check for IIR filter updates

When there is a change in the configuration of the BMP3xx device, several
steps take place. These steps include:

1) Update the OSR settings and check if there was an update
2) Update the ODR settings and check if there was an update
3) Update the IIR settings and check if there was an update
4) Check if there was an update with the following procedure:
a) Set sensor to SLEEP mode and after to NORMAL mode to trigger
a new measurement.
b) Wait the maximum amount possible depending on the OSR settings
c) Check the configuration error register if there was an error
during the configuration of the sensor.

This check is necessary, because there could be a case where the OSR is
too high for the requested ODR so either the ODR needs to be slower or the
OSR needs to be less. This is something that is checked internally by the
sensor when it runs in NORMAL mode.

In the BMP58x devices the previous steps are done internally by the sensor.

The IIR filter settings do not depend on the OSR or ODR settings, and there
is no need to run a check in case they change.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20240902184222.24874-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Vasileios Amoiridis and committed by
Jonathan Cameron
7e1df2ca 1a8a8787

+5 -9
+5 -9
drivers/iio/pressure/bmp280-core.c
··· 1555 1555 change = change || aux; 1556 1556 1557 1557 /* Set filter data */ 1558 - ret = regmap_update_bits_check(data->regmap, BMP380_REG_CONFIG, BMP380_FILTER_MASK, 1559 - FIELD_PREP(BMP380_FILTER_MASK, data->iir_filter_coeff), 1560 - &aux); 1558 + ret = regmap_update_bits(data->regmap, BMP380_REG_CONFIG, BMP380_FILTER_MASK, 1559 + FIELD_PREP(BMP380_FILTER_MASK, data->iir_filter_coeff)); 1561 1560 if (ret) { 1562 1561 dev_err(data->dev, "failed to write config register\n"); 1563 1562 return ret; 1564 1563 } 1565 - change = change || aux; 1566 1564 1567 1565 if (change) { 1568 1566 /* ··· 2149 2151 reg_val = FIELD_PREP(BMP580_DSP_IIR_PRESS_MASK, data->iir_filter_coeff) | 2150 2152 FIELD_PREP(BMP580_DSP_IIR_TEMP_MASK, data->iir_filter_coeff); 2151 2153 2152 - ret = regmap_update_bits_check(data->regmap, BMP580_REG_DSP_IIR, 2153 - BMP580_DSP_IIR_PRESS_MASK | 2154 - BMP580_DSP_IIR_TEMP_MASK, 2155 - reg_val, &aux); 2154 + ret = regmap_update_bits(data->regmap, BMP580_REG_DSP_IIR, 2155 + BMP580_DSP_IIR_PRESS_MASK | BMP580_DSP_IIR_TEMP_MASK, 2156 + reg_val); 2156 2157 if (ret) { 2157 2158 dev_err(data->dev, "failed to write config register\n"); 2158 2159 return ret; 2159 2160 } 2160 - change = change || aux; 2161 2161 2162 2162 /* Restore sensor to normal operation mode */ 2163 2163 ret = regmap_write_bits(data->regmap, BMP580_REG_ODR_CONFIG,