mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francesco Lavra <flavra@baylibre.com>
To: "Nuno Sá" <noname.nuno@gmail.com>,
	"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: accel: adxl380: Add support for 1 kHz sampling frequency
Date: Wed, 07 Jan 2026 16:39:54 +0100	[thread overview]
Message-ID: <9a5db937dc7072d95d6757cdf2eb8d6fde4abbd0.camel@baylibre.com> (raw)
In-Reply-To: <52e5cea72b99fc23c922cf74d7dce3403f43c9cd.camel@gmail.com>

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

On Wed, 2026-01-07 at 13:56 +0000, Nuno Sá wrote:
> Hi Francesco,
> 
> On Wed, 2026-01-07 at 13:35 +0100, Francesco Lavra wrote:
> > In sensor variants (such as ADXL380 and ADXL382) that support low-power
> > mode, the SAR signal path allows sampling acceleration data at lower
> > rates;
> > more specifically, when the sensor operates in VLP mode, the sampling
> > frequency is 1 kHz.
> > To add support for the 1kHz sampling frequency value, modify the
> > operating
> > mode selection logic to take into account the sampling frequency, and
> > configure the decimation filters only when applicable (i.e. when using
> > a
> > sampling frequency that relies on the DSM signal path).
> > 
> > Signed-off-by: Francesco Lavra <flavra@baylibre.com>
> > ---
> >  drivers/iio/accel/adxl380.c | 49 +++++++++++++++++++++++--------------
> >  drivers/iio/accel/adxl380.h | 10 +++++++-
> >  2 files changed, 40 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
> > index bbf1f88ca781..a6919dfce2e9 100644
> > --- a/drivers/iio/accel/adxl380.c
> > +++ b/drivers/iio/accel/adxl380.c
> > @@ -245,12 +245,14 @@ static int adxl380_set_measure_en(struct
> > adxl380_state *st, bool en)
> >  
> >                 /*
> >                  * Activity/Inactivity detection available only in
> > VLP/ULP
> > -                * mode and for devices that support low power modes.
> > Otherwise
> > -                * go straight to measure mode (same bits as
> > ADXL380_OP_MODE_HP).
> > +                * mode and for devices that support low power modes.
> >                  */
> >                 if (st->chip_info->has_low_power &&
> >                     (FIELD_GET(ADXL380_ACT_EN_MSK, act_inact_ctl) ||
> >                      FIELD_GET(ADXL380_INACT_EN_MSK, act_inact_ctl)))
> > +                       st->odr = ADXL380_ODR_VLP;
> > +
> 
> So before this change we would go to low power mode but still report
> whatever sampling frequency
> userspace had configured (which I guess would not correspond to reality)?

Correct.

> With the above we'll
> update the reported odr right?

Right.

> Some things/doubts that come to mind:
> 
> 1. If I'm right not sure if this shouldn't be treated as a fix.

Yes, this technically fixes an existing issue, but I didn't advertise it as
a fix because solving the issue requires adding support for the 1kHz
frequency, which seems to go beyond the strict definition of a fix and
sounds more like a new feature.
 
> 2. Should we cache the current odr so that we restore it when
> appropriate?

Do you mean caching it when activity detection is enabled and restoring it
when detection is disabled? It could be done.

> 3. Other thing that comes to mind is if it makes sense to allow
> controlling odr if
> Activity/Inactivity detection is enabled?

Disallowing odr control when activity detection is enabled could be an
option, but what error code should be returned if the user tries to set the
sampling frequency value when not allowed? -EBUSY?

> 
> Thx!
> - Nuno Sá
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2026-01-07 15:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07 12:35 [PATCH 0/2] " Francesco Lavra
2026-01-07 12:35 ` [PATCH 1/2] iio: accel: adxl380: Store sampling frequency index in odr struct member Francesco Lavra
2026-01-07 13:50   ` Nuno Sá
2026-01-07 12:35 ` [PATCH 2/2] iio: accel: adxl380: Add support for 1 kHz sampling frequency Francesco Lavra
2026-01-07 13:56   ` Nuno Sá
2026-01-07 15:39     ` Francesco Lavra [this message]
2026-01-08 13:45       ` Nuno Sá
2026-01-08 14:07         ` Francesco Lavra
2026-01-12 13:26           ` Nuno Sá
2026-01-11 13:24         ` 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=9a5db937dc7072d95d6757cdf2eb8d6fde4abbd0.camel@baylibre.com \
    --to=flavra@baylibre.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=ramona.gradinariu@analog.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

all inboxes | Powered by JetHome®