[PATCH] iio: pressure: bmp280: fix bmp580 buffer channel order

From: Eric Westphal

Date: Thu Dec 03 2026 - 22:45:38 EST


MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
bmp580_channels[] declares pressure at scan_index 0 and temperature at
scan_index 1, matching enum bmp280_scan. The original triggered-buffer
support filled data->sensor_data[] in that order: pressure at offset 0,
then temperature.
Commit 872c8014e05e replaced the array with a stack-local scan struct,
but declared the fields as temperature then pressure. The memcpy
targets stayed correct, so the pushed buffer has the samples swapped
relative to scan_index. Userspace therefore sees temperature counts in
the pressure slot and vice versa.
On a BMP581 this was observed as buffered values of about 26,800 Pa and
98 °C while the sysfs in_*_input attributes correctly reported about
100,601 Pa and 26.2 °C.
Reorder the struct fields to match the scan_index mapping, as the
bmp280, bme280, bmp380, and bmp180 trigger handlers already do.
Fixes: 872c8014e05e ("iio: pressure: bmp280: drop sensor_data array")
Cc: stable@xxxxxxxxxxxxxxx
# Replace the placeholder Signed-off-by before sending (do not use
# Eric Westphal unless he is the submitter and agrees to the DCO):
Signed-off-by: [Your Name] <your.email@xxxxxxxxxxx>
---
drivers/iio/pressure/bmp280-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/pressure/bmp280-core.c
b/drivers/iio/pressure/bmp280-core.c
index 3940b8e..6f3c3a8 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -2625,8 +2625,8 @@ static irqreturn_t bmp580_trigger_handler(int
irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct bmp280_data *data = iio_priv(indio_dev);
struct {
- __le32 comp_temp;
__le32 comp_press;
+ __le32 comp_temp;
aligned_s64 timestamp;
} buffer = { };
int ret;
--
2.47.3