From: Jonathan Cameron <jic23@kernel.org>
To: Petre Rodan <petre.rodan@subdimension.ro>
Cc: "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 4/6] iio: accel: bma220: add low-g event detection
Date: Sat, 18 Oct 2025 18:20:32 +0100 [thread overview]
Message-ID: <20251018182032.657d6af6@jic23-huawei> (raw)
In-Reply-To: <20251014-bma220_events-v1-4-153424d7ea08@subdimension.ro>
On Tue, 14 Oct 2025 19:43:00 +0300
Petre Rodan <petre.rodan@subdimension.ro> wrote:
> Add support for low-g detection.
>
> Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Just a follow on related units of _period attributes.
> ---
> drivers/iio/accel/bma220_core.c | 101 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 101 insertions(+)
>
> diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
> index c4bebf3e5548..daff22ec1f2d 100644
> --- a/drivers/iio/accel/bma220_core.c
> +++ b/drivers/iio/accel/bma220_core.c
> @@ -119,6 +119,14 @@ static const struct iio_event_spec bma220_events[] = {
> .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
> BIT(IIO_EV_INFO_PERIOD),
> },
> + {
> + .type = IIO_EV_TYPE_THRESH,
> + .dir = IIO_EV_DIR_FALLING,
> + .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE) |
> + BIT(IIO_EV_INFO_VALUE) |
> + BIT(IIO_EV_INFO_PERIOD) |
> + BIT(IIO_EV_INFO_HYSTERESIS),
> + },
> };
>
> #define BMA220_ACCEL_CHANNEL(index, reg, axis) { \
> @@ -509,6 +517,7 @@ static int bma220_read_event_config(struct iio_dev *indio_dev,
> @@ -602,6 +634,37 @@ static int bma220_read_event_value(struct iio_dev *indio_dev,
> default:
> return -EINVAL;
> }
> + case IIO_EV_TYPE_THRESH:
> + switch (dir) {
> + case IIO_EV_DIR_FALLING:
> + switch (info) {
> + case IIO_EV_INFO_VALUE:
> + ret = regmap_read(data->regmap, BMA220_REG_CONF1,
> + ®_val);
> + if (ret)
> + return ret;
> + *val = FIELD_GET(BMA220_LOW_TH_MSK, reg_val);
> + return IIO_VAL_INT;
> + case IIO_EV_INFO_PERIOD:
> + ret = regmap_read(data->regmap, BMA220_REG_CONF2,
> + ®_val);
> + if (ret)
> + return ret;
> + *val = FIELD_GET(BMA220_LOW_DUR_MSK, reg_val);
As in previous. Seems very unlikely period is in second here, given that would be far too long
to make sense! See the ABI docs. Looks to be samples which means
you need to deal with variable sampling frequencies as part of this
calculation.
> + return IIO_VAL_INT;
>
next prev parent reply other threads:[~2025-10-18 17:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 16:42 [PATCH 0/6] iio: accel: bma220: add events Petre Rodan
2025-10-14 16:42 ` [PATCH 1/6] iio: accel: bma220: white space cleanup Petre Rodan
2025-10-18 16:55 ` Jonathan Cameron
2025-10-14 16:42 ` [PATCH 2/6] iio: accel: bma220: remove useless include Petre Rodan
2025-10-18 16:55 ` Jonathan Cameron
2025-10-14 16:42 ` [PATCH 3/6] iio: accel: bma220: add tap detection Petre Rodan
2025-10-18 17:16 ` Jonathan Cameron
2025-11-01 7:56 ` Petre Rodan
2025-11-02 12:20 ` Jonathan Cameron
2025-11-07 0:30 ` Petre Rodan
2025-11-09 12:41 ` Jonathan Cameron
2025-10-14 16:43 ` [PATCH 4/6] iio: accel: bma220: add low-g event detection Petre Rodan
2025-10-18 17:20 ` Jonathan Cameron [this message]
2025-10-18 17:22 ` Jonathan Cameron
2025-10-14 16:43 ` [PATCH 5/6] iio: accel: bma220: add high-g " Petre Rodan
2025-10-14 16:43 ` [PATCH 6/6] iio: accel: bma220: add any-motion detection Petre Rodan
2025-10-18 17:32 ` 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=20251018182032.657d6af6@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=petre.rodan@subdimension.ro \
/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