[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250525140351.559be514@jic23-huawei>
Date: Sun, 25 May 2025 14:03:51 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
corbet@....net, lucas.p.stankus@...il.com, lars@...afoo.de,
Michael.Hennerich@...log.com, linux-iio@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 09/12] iio: accel: adxl313: add activity sensing
On Fri, 23 May 2025 22:35:20 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:
> Add possibilities to set a threshold for activity sensing. Extend the
> interrupt handler to process activity interrupts. Provide functions to set
> the activity threshold and to enable/disable activity sensing. Further add
> a fake channel for having x, y and z axis anded on the iio channel.
>
> This is a preparatory patch. Some of the definitions and functions are
> supposed to be extended for inactivity later on.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
One comment I found confusing.
I see this hardware is similar to our friend the axl345 so some of the outcomes
of final reviews on that series may apply here as well.
> ---
> drivers/iio/accel/adxl313_core.c | 229 ++++++++++++++++++++++++++++++-
> 1 file changed, 227 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/accel/adxl313_core.c b/drivers/iio/accel/adxl313_core.c
> index 80991cd9bd79..74bb7cfe8a55 100644
> --- a/drivers/iio/accel/adxl313_core.c
> +++ b/drivers/iio/accel/adxl313_core.c
> static const unsigned long adxl313_scan_masks[] = {
> @@ -300,6 +334,60 @@ static int adxl313_read_freq_avail(struct iio_dev *indio_dev,
> }
> }
>
> +static int adxl313_is_act_inact_en(struct adxl313_data *data,
> + enum adxl313_activity_type type)
> +{
> + unsigned int axis_ctrl;
> + unsigned int regval;
> + int axis_en, int_en, ret;
> +
> + ret = regmap_read(data->regmap, ADXL313_REG_ACT_INACT_CTL, &axis_ctrl);
> + if (ret)
> + return ret;
> +
> + /* Check if axis for activity are enabled */
If all 3 axis perhaps? Or If any axis? I'm not sure what intent is here.
> + if (type != ADXL313_ACTIVITY)
> + return 0;
> +
> + axis_en = FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl);
> +
> + /* The axis are enabled, now check if specific interrupt is enabled */
> + ret = regmap_read(data->regmap, ADXL313_REG_INT_ENABLE, ®val);
> + if (ret)
> + return ret;
> +
> + int_en = adxl313_act_int_reg[type] & regval;
> +
> + return axis_en && int_en;
> +}
Powered by blists - more mailing lists