mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: pressure: bmp280: fix bmp580 buffer channel order
@ 2026-12-04  3:45 Eric Westphal
  2026-12-04  6:53 ` Joshua Crofts
  2026-12-04 16:58 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Westphal @ 2026-12-04  3:45 UTC (permalink / raw)
  To: linux-iio, jic23; +Cc: nuno.sa, dlechner, andy, linux-kernel, stable

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@vger.kernel.org
# 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@example.com>
---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04  3:45 [PATCH] iio: pressure: bmp280: fix bmp580 buffer channel order Eric Westphal
2026-12-04  6:53 ` Joshua Crofts
2026-12-04 16:58 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®