[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250427134900.35d19116@jic23-huawei>
Date: Sun, 27 Apr 2025 13:49:00 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
eraretuya@...il.com
Subject: Re: [PATCH v7 09/11] iio: accel: adxl345: add inactivity feature
On Mon, 21 Apr 2025 22:06:39 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:
> Add the inactivity feature of the sensor. When activity and inactivity
> are enabled, a link bit will be set linking activity and inactivity
> handling. Additionally, the auto-sleep mode will be enabled. Due to the
> link bit the sensor is going to auto-sleep when inactivity was
> detected.
>
> Inactivity detection needs a threshold to be configured, and a time
> after which it will go into inactivity state if measurements under
> threshold.
>
> When a ODR is configured this time for inactivity is adjusted with a
> corresponding reasonable default value, in order to have higher
> frequencies and lower inactivity times, and lower sample frequency but
> give more time until inactivity. Both with reasonable upper and lower
> boundaries, since many of the sensor's features (e.g. auto-sleep) will
> need to operate beween 12.5 Hz and 400 Hz. This is a default setting
> when actively changing sample frequency, explicitly setting the time
> until inactivity will overwrite the default.
>
> Similarly, setting the g-range will provide a default value for the
> activity and inactivity thresholds. Both are implicit defaults, but
> equally can be overwritten to be explicitly configured.
>
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
One more thing I only noticed later...
> enum adxl345_odr {
> @@ -232,6 +241,16 @@ static const struct iio_event_spec adxl345_freefall_event_spec = {
> BIT(IIO_EV_INFO_PERIOD),
> };
>
> +/* inactivity */
> +static const struct iio_event_spec adxl345_inactivity_event_spec = {
> + .type = IIO_EV_TYPE_THRESH,
Similar to the activity detector. I'd expect inactivity to be magnitude
based not signed value (which EV_TYPE_THRESH is).
> + .dir = IIO_EV_DIR_FALLING,
> + .mask_separate = BIT(IIO_EV_INFO_ENABLE),
> + .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
> + BIT(IIO_EV_INFO_PERIOD),
> +
> +};
Powered by blists - more mailing lists