All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
To: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	linux-iio@vger.kernel.org, "Eddie James" <eajames@linux.ibm.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Rupesh Majhi" <zoone.rupert@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] iio: pressure: dps310: add Zilltek ZTS8032 support
Date: Tue, 13 Oct 2026 16:49:30 +0200	[thread overview]
Message-ID: <as5EOfOqsF5iEHct@monoceros> (raw)
In-Reply-To: <20261012114550.1680054-5-paulius.zaleckas@ui.com>

[-- Attachment #1: Type: text/plain, Size: 3232 bytes --]

On Mon, Oct 12, 2026 at 02:45:50PM +0300, Paulius Zaleckas wrote:
> From: Paulius Zaleckas <paulius.zaleckas@gmail.com>
> 
> The Zilltek ZTS8032 has the DPS310 register map, scale factors and
> compensation, 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 a per-chip table holding the coefficient count and the TMP_CFG
> startup value, and an OF match table to select it.
> 
> Tested on a ZTS8032 at 0x76 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, and TMP_CFG reads
> 0x00 after probe.
> 
> Assisted-by: LLM
> Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
> ---
>  drivers/iio/pressure/Kconfig  |  4 +--
>  drivers/iio/pressure/dps310.c | 66 ++++++++++++++++++++++++++++++-----
>  2 files changed, 60 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig
> index cef8b90b9ae7..e407243e131c 100644
> --- a/drivers/iio/pressure/Kconfig
> +++ b/drivers/iio/pressure/Kconfig
> @@ -115,8 +115,8 @@ 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 Infineon DPS310 and Zilltek ZTS8032 digital
> +	  barometric pressure sensors. 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 3bc690cc8609..3b0f6d344409 100644
> --- a/drivers/iio/pressure/dps310.c
> +++ b/drivers/iio/pressure/dps310.c
> @@ -7,6 +7,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
>   *
> @@ -18,6 +22,7 @@
>  #include <linux/i2c.h>
>  #include <linux/limits.h>
>  #include <linux/math64.h>
> +#include <linux/mod_devicetable.h>

Adding that header mainly results in pulling in many unneeded
dependencies, so please don't.

of_device_id is already provided by <linux/i2c.h>, so you can just drop
the #include.

>  static const struct acpi_device_id dps310_acpi_match[] = {
> -	{ "IFX3100" },
> +	{ "IFX3100", (kernel_ulong_t)&dps310_chip_info },
>  	{ }
>  };

While touching that struct, please make this:

	{ .id = "IFX3100", .driver_data = (kernel_ulong_t)&dps310_chip_info },

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      parent reply	other threads:[~2026-10-13 14:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 11:45 [PATCH 0/4] iio: pressure: dps310: fix pressure overflow, add Zilltek ZTS8032 Paulius Zaleckas
2026-10-12 11:45 ` [PATCH 1/4] iio: pressure: dps310: fix overflow in the pressure compensation Paulius Zaleckas
2026-10-12 11:45 ` [PATCH 2/4] dt-bindings: vendor-prefixes: Add ZillTek Technology Paulius Zaleckas
2026-10-12 18:58   ` Conor Dooley
2026-10-12 11:45 ` [PATCH 3/4] dt-bindings: iio: pressure: infineon,dps310: Add Zilltek ZTS8032 Paulius Zaleckas
2026-10-12 18:57   ` Conor Dooley
2026-10-12 11:45 ` [PATCH 4/4] iio: pressure: dps310: add Zilltek ZTS8032 support Paulius Zaleckas
2026-10-12 20:48   ` Andy Shevchenko
2026-10-13 14:49   ` Uwe Kleine-König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=as5EOfOqsF5iEHct@monoceros \
    --to=u.kleine-koenig@baylibre.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=jic23@kernel.org \
    --cc=joel@jms.id.au \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=paulius.zaleckas@gmail.com \
    --cc=robh@kernel.org \
    --cc=zoone.rupert@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.