Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/6] iio: pressure: dps310: fix pressure overflow, add Zilltek ZTS8032
@ 2026-10-13 11:21 Paulius Zaleckas
  2026-10-13 11:21 ` [PATCH v2 1/6] iio: pressure: dps310: fix overflow in the pressure compensation Paulius Zaleckas
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Paulius Zaleckas @ 2026-10-13 11:21 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Eddie James, Joel Stanley, David Lechner, Nuno Sá,
	Andy Shevchenko, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Rupesh Majhi, devicetree,
	linux-kernel, Paulius Zaleckas

The Zilltek ZTS8032 is a register compatible DPS310 with two more
pressure calibration coefficients. Bringing it up showed that the DPS310
pressure compensation overflows s64 at most oversampling rates, so patch
1 fixes that first (Fixes: + stable); the rest adds the ZTS8032.

1: Evaluate the compensation polynomial in Q20 fixed point. The current
   p^3 * c30 / kP^3 sum overflows, losing the c30 term: about 20 Pa low
   near sea level at oversampling 2, 4, 8, 64 and 128.
2-3: Vendor prefix and the zilltek,zts8032 compatible.
4: Per-chip data in the I2C and ACPI match data, no functional change.
5: OF match table.
6: ZTS8032 chip data: the coefficient count (c31, c40) and the TMP_CFG
   startup value, since TMP_CFG bit 7 is a rate bit on the ZTS8032.

Based on iio/togreg, on top of 4334dc4092c2 ("iio: pressure: dps310: fix
CFG_REG bit definitions"), without which oversampling 16 and above
returns -ERANGE.

Testing: ZTS8032 on an arm64 (MT7987) board, the series backported to
6.12. in_pressure_input matches the datasheet formula evaluated from the
raw and coefficient registers to within 1 Pa at every oversampling rate
from 1 to 128; the fixed point math was also checked against a floating
point model over 300-1200 hPa for all rates. Every patch builds without
warnings with W=1 on x86_64 and i386, dt_binding_check passes. I have no
DPS310, so patches 1 and 4-5 are untested on one.

checkpatch --strict suggests BIT_ULL() for DPS310_Q_ONE; it stays a
signed 1LL << 20 because it multiplies signed raw values.

An LLM coding assistant (Claude Code) was used for this series: it
found the overflow while porting the ZTS8032 vendor driver, wrote the
code and changelogs, the floating point model and the hardware test
scripts, under my direction. I reviewed and tested the result.

Changes in v2:
- Split the driver patch into per-chip data (4), OF match table (5) and
  ZTS8032 support (6) (Andy)
- Drop the linux/mod_devicetable.h include (Andy)
- Return -ENODATA when there is no match data (Andy)
- Add Conor's Acked-by to 2-3
- Link to v1: https://lore.kernel.org/r/20261012114550.1680054-1-paulius.zaleckas@ui.com

Paulius Zaleckas (6):
  iio: pressure: dps310: fix overflow in the pressure compensation
  dt-bindings: vendor-prefixes: Add ZillTek Technology
  dt-bindings: iio: pressure: infineon,dps310: Add Zilltek ZTS8032
  iio: pressure: dps310: add per-chip data
  iio: pressure: dps310: add an OF match table
  iio: pressure: dps310: add Zilltek ZTS8032 support

 .../iio/pressure/infineon,dps310.yaml         |   4 +-
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/iio/pressure/Kconfig                  |   4 +-
 drivers/iio/pressure/dps310.c                 | 148 +++++++++++-------
 4 files changed, 98 insertions(+), 60 deletions(-)


base-commit: a3b3580713f3ac5a32dc2874ee546828977a1d68
-- 
2.55.0


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

end of thread, other threads:[~2026-10-13 11:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 11:21 [PATCH v2 0/6] iio: pressure: dps310: fix pressure overflow, add Zilltek ZTS8032 Paulius Zaleckas
2026-10-13 11:21 ` [PATCH v2 1/6] iio: pressure: dps310: fix overflow in the pressure compensation Paulius Zaleckas
2026-10-13 11:31   ` sashiko-bot
2026-10-13 11:21 ` [PATCH v2 2/6] dt-bindings: vendor-prefixes: Add ZillTek Technology Paulius Zaleckas
2026-10-13 11:21 ` [PATCH v2 3/6] dt-bindings: iio: pressure: infineon,dps310: Add Zilltek ZTS8032 Paulius Zaleckas
2026-10-13 11:21 ` [PATCH v2 4/6] iio: pressure: dps310: add per-chip data Paulius Zaleckas
2026-10-13 11:21 ` [PATCH v2 5/6] iio: pressure: dps310: add an OF match table Paulius Zaleckas
2026-10-13 11:21 ` [PATCH v2 6/6] iio: pressure: dps310: add Zilltek ZTS8032 support Paulius Zaleckas

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