[PATCH v5 5/5] iio: pressure: dps310: add Zilltek ZTS8032 support

From: Paulius Zaleckas

Date: Mon Oct 19 2026 - 04:37:20 EST


The Zilltek ZTS8032 has the DPS310 register map, scale factors,
compensation and FIFO, with these differences:

- two more pressure coefficients, c31 and c40 at 0x22-0x25, adding
c40 * Praw_sc^4 + c31 * Traw_sc * Praw_sc^3 to the polynomial
- TMP_EXT is MEAS_CFG bit 3, and the temperature coefficients are for
the internal sensor (COEF_SRCE reads 0x06). TMP_CFG bit 7 is the top
bit of a 4-bit TMP_RATE, so the DPS310 TMP_EXT write would select a
25/16 Hz background rate instead of the external sensor.
- product ID 0x11 instead of 0x10, the driver does not check it

Add its chip data, reading 22 coefficient bytes and with TMP_EXT clear,
a Horner step for each of c40 and c31, and the I2C and OF IDs.

Tested on a ZTS8032 over I2C: in_pressure_input is within 1 Pa of the
datasheet formula evaluated from the raw and coefficient registers at
every oversampling rate from 1 to 128, TMP_CFG reads 0x00 after probe,
and buffered capture through the FIFO returns the same pressure and
temperature as direct reads.

Assisted-by: LLM
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@xxxxxxxxx>
---
drivers/iio/pressure/Kconfig | 6 ++++--
drivers/iio/pressure/dps310.c | 32 +++++++++++++++++++++++++++++---
2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig
index 9de63908936f..ffd072e4bb8f 100644
--- a/drivers/iio/pressure/Kconfig
+++ b/drivers/iio/pressure/Kconfig
@@ -115,8 +115,10 @@ config DPS310
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help
- Support for the Infineon DPS310 digital barometric pressure sensor.
- It can be accessed over I2C bus.
+ Support for the following digital barometric pressure sensors:
+ - Infineon DPS310
+ - Zilltek ZTS8032
+ They can be accessed over I2C bus.

This driver can also be built as a module. If so, the module will be
called dps310.
diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
index 999ae4ce73f7..a2ac8101ff31 100644
--- a/drivers/iio/pressure/dps310.c
+++ b/drivers/iio/pressure/dps310.c
@@ -5,6 +5,10 @@
*
* https://www.infineon.com/dgdl/?fileId=5546d462576f34750157750826c42242
*
+ * The Zilltek ZTS8032 is register compatible, with two more pressure
+ * calibration coefficients (c31, c40) and temperature calibrated against
+ * the internal sensor.
+ *
* Temperature calculation:
* c0 * 0.5 + c1 * T_raw / kT °C
*/
@@ -67,8 +71,9 @@
#define DPS310_RESET_MAGIC 0x09
#define DPS310_COEF_BASE 0x10
#define DPS310_COEF_LEN 18
+#define ZTS8032_COEF_LEN 22

-#define MAX_COEF_LEN 18
+#define MAX_COEF_LEN 22

/* Section 4.8: 32 shared entries. Stops when full, so late drains lose data */
#define DPS310_FIFO_DEPTH 32
@@ -109,6 +114,7 @@ struct dps310_chip_info {
const char *name;
bool coef_for_ext_sensor;
u8 coef_len;
+ bool has_c31_c40;
};

static const struct dps310_chip_info dps310_chip_info = {
@@ -117,6 +123,13 @@ static const struct dps310_chip_info dps310_chip_info = {
.coef_len = DPS310_COEF_LEN,
};

+static const struct dps310_chip_info zts8032_chip_info = {
+ .name = "zts8032",
+ .coef_for_ext_sensor = false,
+ .coef_len = ZTS8032_COEF_LEN,
+ .has_c31_c40 = true,
+};
+
struct dps310_data {
struct i2c_client *client;
struct regmap *regmap;
@@ -125,6 +138,7 @@ struct dps310_data {

s32 c0, c1;
s32 c00, c10, c20, c30, c01, c11, c21;
+ s32 c31, c40;
s32 pressure_raw;
s32 temp_raw;
bool timeout_recovery_failed;
@@ -244,6 +258,11 @@ static int dps310_get_coefs(struct dps310_data *data)
c30 = (coef[16] << 8) | coef[17];
data->c30 = sign_extend32(c30, 15);

+ if (data->info->has_c31_c40) {
+ data->c31 = sign_extend32(get_unaligned_be16(&coef[18]), 15);
+ data->c40 = sign_extend32(get_unaligned_be16(&coef[20]), 15);
+ }
+
return 0;
}

@@ -745,10 +764,15 @@ static int dps310_calculate_pressure(struct dps310_data *data, int *val)
if (rc)
return rc;

- /* Section 4.9.1 of the DPS310 spec, Horner form to avoid overflow */
- if (!dps310_horner_step(&prs, data->c30, p, kp) ||
+ /*
+ * Section 4.9.1 of the DPS310 spec, Horner form to avoid overflow.
+ * c40 and c31 are ZTS8032 only and zero on the DPS310.
+ */
+ if (!dps310_horner_step(&prs, data->c40, p, kp) ||
+ !dps310_horner_step(&prs, data->c30, p, kp) ||
!dps310_horner_step(&prs, data->c20, p, kp) ||
!dps310_horner_step(&prs, data->c10, p, kp) ||
+ !dps310_horner_step(&tmp, data->c31, p, kp) ||
!dps310_horner_step(&tmp, data->c21, p, kp) ||
!dps310_horner_step(&tmp, data->c11, p, kp) ||
!dps310_horner_step(&tmp, data->c01, t, kt))
@@ -1418,12 +1442,14 @@ static int dps310_probe(struct i2c_client *client)

static const struct i2c_device_id dps310_id[] = {
{ .name = "dps310", .driver_data = (kernel_ulong_t)&dps310_chip_info },
+ { .name = "zts8032", .driver_data = (kernel_ulong_t)&zts8032_chip_info },
{ }
};
MODULE_DEVICE_TABLE(i2c, dps310_id);

static const struct of_device_id dps310_of_match[] = {
{ .compatible = "infineon,dps310", .data = &dps310_chip_info },
+ { .compatible = "zilltek,zts8032", .data = &zts8032_chip_info },
{ }
};
MODULE_DEVICE_TABLE(of, dps310_of_match);
--
2.55.0