From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Francesco Lavra" <flavra@baylibre.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 1/2] iio: accel: adxl380: Store sampling frequency index in odr struct member
Date: Wed, 07 Jan 2026 13:50:07 +0000 [thread overview]
Message-ID: <d9bb518e29939cd8e3c7b62c3f5cb7e9d018ee52.camel@gmail.com> (raw)
In-Reply-To: <20260107123518.4017292-2-flavra@baylibre.com>
On Wed, 2026-01-07 at 13:35 +0100, Francesco Lavra wrote:
> The ADXL380 driver assumes that acceleration samples are always retrieved
> via the high-performance DSM signal path; as a result, the sampling
> frequency value depends exclusively on the decimation filter settings in
> the TRIG_CFG register.
> In preparation for adding support for sampling frequency values that rely
> on the low-power SAR signal path (on which the decimation filters are not
> supported), use the (currently unused) 'odr' member of struct adxl380_state
> to store the sampling frequency value, and when userspace requests the
> current frequency value, retrieve it from the struct instead of calculating
> it from the decimation filter settings.
>
> Signed-off-by: Francesco Lavra <flavra@baylibre.com>
> ---
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/iio/accel/adxl380.c | 13 ++-----------
> 1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
> index ce3643c5deb8..bbf1f88ca781 100644
> --- a/drivers/iio/accel/adxl380.c
> +++ b/drivers/iio/accel/adxl380.c
> @@ -417,17 +417,7 @@ static int adxl380_read_chn(struct adxl380_state *st, u8 addr)
>
> static int adxl380_get_odr(struct adxl380_state *st, int *odr)
> {
> - int ret;
> - unsigned int trig_cfg, odr_idx;
> -
> - ret = regmap_read(st->regmap, ADXL380_TRIG_CFG_REG, &trig_cfg);
> - if (ret)
> - return ret;
> -
> - odr_idx = (FIELD_GET(ADXL380_TRIG_CFG_SINC_RATE_MSK, trig_cfg) << 1) |
> - (FIELD_GET(ADXL380_TRIG_CFG_DEC_2X_MSK, trig_cfg) & 1);
> -
> - *odr = st->chip_info->samp_freq_tbl[odr_idx];
> + *odr = st->chip_info->samp_freq_tbl[st->odr];
>
> return 0;
> }
> @@ -500,6 +490,7 @@ static int adxl380_set_odr(struct adxl380_state *st, u8 odr)
> if (ret)
> return ret;
>
> + st->odr = odr;
> ret = adxl380_set_measure_en(st, true);
> if (ret)
> return ret;
next prev parent reply other threads:[~2026-01-07 13:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 12:35 [PATCH 0/2] accel: adxl380: Add support for 1 kHz sampling frequency 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á [this message]
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
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=d9bb518e29939cd8e3c7b62c3f5cb7e9d018ee52.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=flavra@baylibre.com \
--cc=jic23@kernel.org \
--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
all inboxes | Powered by JetHome®