[PATCH 3/3] iio: pressure: dps310: add Goermicro SPL07-003 support

From: Jorijn van der Graaf

Date: Tue Nov 17 2026 - 03:41:50 EST


The Goermicro SPL07-003 needs what the ZTS8032 chip data already
describes: c31 and c40 in the pressure polynomial, and TMP_CFG bit 7, a
rate bit on this chip too, left clear. Its TMP_EXT is MEAS_CFG bit 3 and
stays at the reset value, the internal sensor the datasheet recommends.

Its c31 and c40 are 12 bit values packed into 0x22-0x24, where the
ZTS8032 has 16 bit values in 0x22-0x25, so the coefficient block is 21
bytes. Add a chip flag for that layout, the chip data and the I2C and OF
IDs.

Tested on a Fairphone (Gen. 6). The DPS310 temperature workaround skips
this unit: bit 1 of register 0x32 is set.

Datasheet: https://media.digikey.com/pdf/Data%20Sheets/Goertek%20Microelectronics%20PDFs/SPL07-003.pdf
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@xxxxxxxxxxxxx>
---
drivers/iio/pressure/Kconfig | 1 +
drivers/iio/pressure/dps310.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig
index ffd072e4bb8f..26bbfe944980 100644
--- a/drivers/iio/pressure/Kconfig
+++ b/drivers/iio/pressure/Kconfig
@@ -116,6 +116,7 @@ config DPS310
select IIO_TRIGGERED_BUFFER
help
Support for the following digital barometric pressure sensors:
+ - Goermicro SPL07-003
- Infineon DPS310
- Zilltek ZTS8032
They can be accessed over I2C bus.
diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
index 5cee23986f30..22ed88d17926 100644
--- a/drivers/iio/pressure/dps310.c
+++ b/drivers/iio/pressure/dps310.c
@@ -9,6 +9,11 @@
* calibration coefficients (c31, c40) and temperature calibrated against
* the internal sensor.
*
+ * The Goermicro SPL07-003 has c31 and c40 too, as 12 bit values, and its
+ * datasheet recommends the internal temperature sensor.
+ *
+ * https://media.digikey.com/pdf/Data%20Sheets/Goertek%20Microelectronics%20PDFs/SPL07-003.pdf
+ *
* Temperature calculation:
* c0 * 0.5 + c1 * T_raw / kT °C
*/
@@ -71,6 +76,7 @@
#define DPS310_RESET_MAGIC 0x09
#define DPS310_COEF_BASE 0x10
#define DPS310_COEF_LEN 18
+#define SPL07_COEF_LEN 21
#define ZTS8032_COEF_LEN 22

#define MAX_COEF_LEN 22
@@ -115,6 +121,7 @@ struct dps310_chip_info {
bool coef_for_ext_sensor;
u8 coef_len;
bool has_c31_c40;
+ bool c31_c40_12bit;
};

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

+static const struct dps310_chip_info spl07_chip_info = {
+ .name = "spl07-003",
+ .coef_for_ext_sensor = false,
+ .coef_len = SPL07_COEF_LEN,
+ .has_c31_c40 = true,
+ .c31_c40_12bit = true,
+};
+
static const struct dps310_chip_info zts8032_chip_info = {
.name = "zts8032",
.coef_for_ext_sensor = false,
@@ -234,8 +249,8 @@ static int dps310_get_coefs(struct dps310_data *data)

/*
* Calculate pressure calibration coefficients. c00 and c10 are 20 bit
- * 2's complement numbers, while the rest are 16 bit 2's complement
- * numbers.
+ * 2's complement numbers, while c01, c11, c20, c21 and c30 are 16 bit
+ * 2's complement numbers.
*/
c00 = (coef[3] << 12) | (coef[4] << 4) | (coef[5] >> 4);
data->c00 = sign_extend32(c00, 19);
@@ -258,7 +273,14 @@ 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) {
+ if (!data->info->has_c31_c40)
+ return 0;
+
+ if (data->info->c31_c40_12bit) {
+ /* Two 12 bit values in three bytes, like c0 and c1 */
+ data->c31 = sign_extend32(get_unaligned_be16(&coef[18]) >> 4, 11);
+ data->c40 = sign_extend32(get_unaligned_be16(&coef[19]), 11);
+ } else {
data->c31 = sign_extend32(get_unaligned_be16(&coef[18]), 15);
data->c40 = sign_extend32(get_unaligned_be16(&coef[20]), 15);
}
@@ -810,7 +832,7 @@ static int dps310_calculate_pressure(struct dps310_data *data, int *val)

/*
* Section 4.9.1 of the DPS310 spec, Horner form to avoid overflow.
- * c40 and c31 are ZTS8032 only and zero on the DPS310.
+ * c40 and c31 are zero on the DPS310.
*/
if (!dps310_horner_step(&prs, data->c40, p, kp) ||
!dps310_horner_step(&prs, data->c30, p, kp) ||
@@ -1495,12 +1517,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 = "spl07-003", .driver_data = (kernel_ulong_t)&spl07_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 = "goermicro,spl07-003", .data = &spl07_chip_info },
{ .compatible = "infineon,dps310", .data = &dps310_chip_info },
{ .compatible = "zilltek,zts8032", .data = &zts8032_chip_info },
{ }
--
2.56.0