From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: "Rupesh Majhi" <zoone.rupert@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Petre Rodan" <petre.rodan@subdimension.ro>,
"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
"Akhilesh Patil" <akhilesh@ee.iitb.ac.in>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Eddie James" <eajames@linux.ibm.com>
Subject: Re: [PATCH v3] iio: pressure: dps310: add triggered buffer support
Date: Sun, 19 Jul 2026 22:48:10 +0100 [thread overview]
Message-ID: <20260719224758.21af4d55@jic23-huawei> (raw)
In-Reply-To: <alyPNM21R2PEzkli@ashevche-desk.local>
On Sun, 19 Jul 2026 11:47:48 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> 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.
If (and I haven't checked) that is the required alignment it doesn't
need any marking at all. The C spec requires a structure to be aligned
to the alignment of it's largest member. Here alignment is forced to 8
by the aligned_s64.
>
> ...
>
> > +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;
>
next prev parent reply other threads:[~2026-07-19 21:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 21:17 [PATCH] iio: pressure: dps310: add FIFO support Rupesh Majhi
2026-07-18 21:44 ` Jonathan Cameron
2026-07-18 23:51 ` [PATCH v3] iio: pressure: dps310: add triggered buffer support Rupesh Majhi
2026-07-19 8:47 ` Andy Shevchenko
2026-07-19 8:48 ` Andy Shevchenko
2026-07-19 21:48 ` Jonathan Cameron [this message]
2026-07-19 22:11 ` Jonathan Cameron
2026-07-20 5:56 ` Rupert Zoone
2026-07-23 23:42 ` 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=20260719224758.21af4d55@jic23-huawei \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akhilesh@ee.iitb.ac.in \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=eajames@linux.ibm.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.com \
--cc=petre.rodan@subdimension.ro \
--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