Re: [PATCH v3] iio: pressure: dps310: add triggered buffer support

From: Andy Shevchenko

Date: Sun Jul 19 2026 - 04:51:18 EST


On Sun, Jul 19, 2026 at 02:51:58AM +0300, Rupesh Majhi wrote:
> Add triggered buffer support so pressure and temperature can be captured
> into a buffer instead of only through one-shot sysfs reads.
>
> Pressure is a processed value in kPa computed from a non-linear
> calibration polynomial. To keep full resolution in the buffer without
> disagreeing with the sysfs unit, add raw and scale attributes for
> pressure (raw in Pa, scale 1/1000 to kPa), following bme680; the existing
> processed attribute is kept for ABI compatibility. Temperature is already
> a full-resolution value in its base unit (millidegrees Celsius) and stays
> a processed channel.
>
> Pressure compensation depends on a temperature reading, so both channels
> are always captured together. The device already runs in continuous
> background mode, so no buffer setup ops are needed. Sysfs reads and
> reconfiguration return -EBUSY while the buffer is enabled, as they share
> the capture path's raw values and configuration.

Do not reply to the same thread with a new version.
Do not reply within less than 24h.

The change needs more work, See my comments below.

...

> + /* Buffer to hold a scan; timestamp is naturally aligned */
> + struct {
> + s32 chan[2];
> + aligned_s64 timestamp;
> + } scan __aligned(8);

We have a macro for this (alignment). Or even for the entire struct.

...

> +static const unsigned long dps310_scan_masks[] = { GENMASK(1, 0), 0 };

Jonathan usually asks to provide a bit-wise definitions and use them here
instead of GENMASK().

...

> + case IIO_CHAN_INFO_SCALE:
> + /* Raw pressure is in Pa; scale to kPa per IIO ABI */
> + *val = 1;
> + *val2 = 1000;

So, we have KILO in units.h.

> + return IIO_VAL_FRACTIONAL;

--
With Best Regards,
Andy Shevchenko