From: Jonathan Cameron <jic23@kernel.org>
To: Francesco Lavra <flavra@baylibre.com>
Cc: "Ramona Gradinariu" <ramona.gradinariu@analog.com>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"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 v2 3/3] iio: accel: adxl380: Add support for 1 kHz sampling frequency
Date: Fri, 16 Jan 2026 19:42:22 +0000 [thread overview]
Message-ID: <20260116194222.0723324a@jic23-huawei> (raw)
In-Reply-To: <20260115175350.1045887-4-flavra@baylibre.com>
On Thu, 15 Jan 2026 18:53:50 +0100
Francesco Lavra <flavra@baylibre.com> 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); in addition,
> constrain the available sampling frequency values based on whether the
> sensor is operating in low-power mode.
>
> Signed-off-by: Francesco Lavra <flavra@baylibre.com>
Hi Francesco,
A similar case to the one Andy pointed out in the earlier patch plus
a trivial comment. Given how trivial they are and where we are in the
cycle, I'll make them whilst applying.
Thanks,
Jonathan
>
> +static int adxl380_samp_freq_avail(struct adxl380_state *st, const int **vals,
> + int *length)
> +{
> + bool act_inact_enabled;
> + int ret;
> +
> + if (!st->chip_info->has_low_power) {
> + *vals = st->chip_info->samp_freq_tbl + ADXL380_ODR_DSM;
> + *length = ADXL380_ODR_MAX - ADXL380_ODR_DSM;
> + return 0;
> + }
> +
> + ret = adxl380_act_inact_enabled(st, &act_inact_enabled);
> + if (!ret) {
if (ret)
return ret;
/*
* Motion detection is only functional in low-power mode, and this
* affects the available sampling frequencies.
*/
*vals = st->chip_info->samp_freq_tbl;
*length = act_inact_enabled ? ADXL380_ODR_DSM : ADXL380_ODR_MAX;
return 0;
> + /*
> + * Motion detection is only functional in low-power mode, and
> + * this affects the available sampling frequencies.
> + */
> + *vals = st->chip_info->samp_freq_tbl;
> + *length = act_inact_enabled ? ADXL380_ODR_DSM : ADXL380_ODR_MAX;
> + }
> +
> + return ret;
> +}
> @@ -1261,12 +1296,18 @@ static int adxl380_write_raw(struct iio_dev *indio_dev,
> int val, int val2, long info)
> {
> struct adxl380_state *st = iio_priv(indio_dev);
> + const int *freq_vals;
> + int freq_count;
> int odr_index, lpf_index, hpf_index, range_index;
> + int ret;
Might as well combine the new variables on one line or even
int odr_index, lpf_index, hpf_index, range_index, freq_count, ret;
next prev parent reply other threads:[~2026-01-16 19:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 17:53 [PATCH v2 0/3] accel: adxl380: Add support for 1 kHz sampling frequency Francesco Lavra
2026-01-15 17:53 ` [PATCH v2 1/3] iio: accel: adxl380: Store sampling frequency index in odr struct member Francesco Lavra
2026-01-15 17:53 ` [PATCH v2 2/3] iio: accel: adxl380: Introduce helper function for activity detection Francesco Lavra
2026-01-15 20:28 ` Andy Shevchenko
2026-01-16 19:32 ` Jonathan Cameron
2026-01-15 17:53 ` [PATCH v2 3/3] iio: accel: adxl380: Add support for 1 kHz sampling frequency Francesco Lavra
2026-01-16 19:42 ` Jonathan Cameron [this message]
2026-01-16 19:43 ` [PATCH v2 0/3] " 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=20260116194222.0723324a@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=flavra@baylibre.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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