Re: [PATCH v9 1/3] iio: pressure: dps310: read buffered samples from the hardware FIFO
From: Andy Shevchenko
Date: Mon Sep 28 2026 - 17:55:54 EST
On Tue, Sep 29, 2026 at 12:11:25AM +0300, Rupesh Majhi wrote:
> The DPS310 has a 32-entry FIFO shared by both measurements. Drain it from
> a work item and push what it held, so a buffered capture needs no
> trigger. Nothing in tree wires the interrupt pin, so the work rearms
> itself at half the time the FIFO takes to fill.
>
> Entries carry one measurement each, so a pressure entry is compensated
> with the temperature ahead of it. Pressure read before the first
> temperature of a session is held until one arrives rather than dropped,
> so the first push can wait a temperature period.
>
> FIFO entries are not timestamped, so postenable refuses the timestamp
> channel unless a trigger is attached.
>
> Tested on a DPS310 on a BeagleBone Black.
...
> +#define DPS310_DRAIN_MAX_MS (2 * MSEC_PER_SEC)
+ time.h
...
> +/* Returns which measurement the entry came from, or a negative error */
> +static int dps310_fifo_read_entry(struct dps310_data *data, s32 *value)
> + __must_hold(&data->lock)
Hmm... Don't you want to also add lockdep annotations?
...
> + if (kind[i] == DPS310_FIFO_TEMP) {
> + data->fifo_temp_raw = raw[i];
> + data->fifo_temp_valid = true;
> +
> + if (!pressure_enabled) {
> + if (!dps310_fifo_push_scan(data, raw[i], 0))
> + pushed++;
> + continue;
> + }
> +
> + pushed += dps310_fifo_push_held(data);
> + continue;
You may deduplicate 'continue'.
> + }
--
With Best Regards,
Andy Shevchenko