linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Rupesh Majhi <zoone.rupert@gmail.com>
Cc: "Andy Shevchenko" <andy@kernel.org>,
	"Bill Wendling" <morbo@google.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Eddie James" <eajames@linux.ibm.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Justin Stitt" <justinstitt@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH v6 5/6] iio: pressure: dps310: add hardware FIFO support
Date: Thu, 10 Sep 2026 03:36:36 +0100	[thread overview]
Message-ID: <20260910033636.3a2ed151@jic23-hlaptop> (raw)
In-Reply-To: <20260906094622.433243-1-zoone.rupert@gmail.com>

On Sun,  6 Sep 2026 12:45:04 +0300
Rupesh Majhi <zoone.rupert@gmail.com> wrote:

> On Mon, 31 Aug 2026 02:14:41 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > Dropping data rather defeats the point of the fifo.  Can we avoid it
> > by holding them locally until we will definitely have seen a useable
> > temperature?  
> 
> The temperature is dropped too. dps310_fifo_drain() sets fifo_temp_valid
> only in its second pass but returns at "if (!scans)" first, and FIFO reads
> are destructive, so a batch that pushes nothing loses the temperature it
> read. With pressure enabled, only a batch holding one ahead of a pressure
> entry gets through.
> 
> DPS310 on a BeagleBone Black, pressure only, 32 Hz and 1 Hz, 3 s per trial:
> 
>   watermark 1  (31 ms drain):   4 of 6 enables produced nothing
>   watermark 32 (484 ms drain):  0 of 6
> 
> Other runs gave 3 of 8 and 3 of 6. Silent, nothing in dmesg.

Maybe we just set the minimum allowed watermark to something that
in practice always has a temperature (or almost does)? It's kind
of true that a watermark below that doesn't work because we end
up dropping data.

> 
> Seeding instead of holding, one temperature read in postenable, fixes it:
> 0 of 16. But TMP_RDY is cleared on read, so after a sysfs read the seed
> waits for the next conversion. Buffer enable took:
> 
>   temp 1 Hz:   661, 781, 802 ms
>   temp 32 Hz:  148, 151, 151 ms   (period is 31 ms, so this is the floor)
> 
> Timeout is 1000000/rate, and on timeout dps310_ready() reinits, putting
> PRS_CFG and TMP_CFG back to defaults. Not something I want in a buffer
> enable.
> 
> Hold across batches as you suggested, since a 31 ms batch usually has no
> temperature in it at all, or a non-blocking dps310_refresh_temp_locked()
> seed plus a validity flag?

Validity flag in the data we push to userspace?  That never works because
we don't have a universal encoding for one.

> 
> > For initial patch just reject starting the buffer if timestamps are
> > set to be captured.  
> 
> No sanctioned way that I can find. buffer->scan_timestamp is private and
> kept out of the scan mask: active_scan_mask reads 2 with in_timestamp_en
> set, and validate_scan_mask() sees the same. indio_dev->scan_timestamp is
> reachable and iio_enable_buffers() sets it before postenable:
> 
> 	if (ACCESS_PRIVATE(iio, scan_timestamp))
> 		return -EINVAL;
> 
> but it is __private, used only there and in
> iio_push_to_buffers_with_timestamp(). That, a helper, or drop the soft
> timestamp channel for now? Triggered-path timestamps are real, so I would
> rather keep those.

Given we have a user I'm fine with having a read only accessor function.
We can't drop anything already supported upstream as it would be an ABI
regression and we only do those when fixing bugs.

So just add a little helper that has the ACCESS_PRIVATE magic hidden away
in it. That stuff is really there to stop writes and ensure we have
an interface that lets us mess around with the internal storage without
changing lots of driver code.

Jonathan
> 
> Rupesh


  reply	other threads:[~2026-09-10  2:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 20:11 [PATCH v6 0/6] iio: pressure: dps310: FIFO and triggered buffer support Rupesh Majhi
2026-08-24 20:11 ` [PATCH v6 1/6] iio: pressure: dps310: fix CFG_REG bit definitions Rupesh Majhi
2026-08-24 20:11 ` [PATCH v6 2/6] iio: pressure: dps310: use a local device pointer in probe Rupesh Majhi
2026-08-24 20:12 ` [PATCH v6 3/6] iio: pressure: dps310: rework the raw read paths Rupesh Majhi
2026-08-25  8:59   ` Andy Shevchenko
2026-08-24 20:12 ` [PATCH v6 4/6] iio: pressure: dps310: add triggered buffer support Rupesh Majhi
2026-08-25  9:06   ` Andy Shevchenko
2026-08-31  0:41     ` Jonathan Cameron
2026-08-31  7:03       ` Andy Shevchenko
2026-09-06 10:06     ` Rupesh Majhi
2026-08-31  1:14   ` Jonathan Cameron
2026-08-24 20:12 ` [PATCH v6 5/6] iio: pressure: dps310: add hardware FIFO support Rupesh Majhi
2026-08-25  9:39   ` Andy Shevchenko
2026-09-06 10:07     ` Rupesh Majhi
2026-08-31  1:14   ` Jonathan Cameron
2026-09-06  9:45     ` Rupesh Majhi
2026-09-10  2:36       ` Jonathan Cameron [this message]
2026-08-24 20:12 ` [PATCH v6 6/6] iio: pressure: dps310: check the lock markings with context analysis Rupesh Majhi
2026-08-31  1:14   ` Jonathan Cameron

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=20260910033636.3a2ed151@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=joel@jms.id.au \
    --cc=justinstitt@google.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nuno.sa@analog.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).