[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aWlN1c4miwb94mOZ@smile.fi.intel.com>
Date: Thu, 15 Jan 2026 22:28:05 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Francesco Lavra <flavra@...libre.com>
Cc: Ramona Gradinariu <ramona.gradinariu@...log.com>,
Antoniu Miclaus <antoniu.miclaus@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] iio: accel: adxl380: Introduce helper function
for activity detection
On Thu, Jan 15, 2026 at 06:53:49PM +0100, Francesco Lavra wrote:
> Motion detection functionalities (such as activity and inactivity
> detection) are only available when the chip is in a low-power mode; this
> affects the available sampling frequency values.
> In preparation for adding support for a new frequency value, introduce a
> helper function that checks whether activity/inactivity detection is
> currently enabled; this function will be reused in a future commit to
> determine what frequency values are available at any given time.
> No functional changes.
...
> +static int adxl380_act_inact_enabled(struct adxl380_state *st, bool *enabled)
> +{
> + unsigned int act_inact_ctl;
> + int ret;
> +
> + if (!st->chip_info->has_low_power) {
> + *enabled = false;
> + return 0;
> + }
> +
> + ret = regmap_read(st->regmap, ADXL380_ACT_INACT_CTL_REG, &act_inact_ctl);
> + if (!ret)
What's wrong with the standard pattern?
if (ret)
return ret;
> + *enabled = FIELD_GET(ADXL380_ACT_EN_MSK, act_inact_ctl) ||
> + FIELD_GET(ADXL380_INACT_EN_MSK, act_inact_ctl);
> +
> + return ret;
return 0;
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists