From: Gustavo Silva <gustavograzs@gmail.com>
To: "Alex Lanzano" <lanzano.alex@gmail.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Gustavo Silva <gustavograzs@gmail.com>
Subject: [PATCH v6 0/2] BMI270: Add support for step counter and motion events
Date: Tue, 16 Sep 2025 20:38:22 -0300 [thread overview]
Message-ID: <20250916-bmi270-v6-0-6acd8d26a862@gmail.com> (raw)
This series adds support for step counter and motion events using
interrupts in the BMI270 driver.
The step counter can be enabled, disabled, and configured with a
watermark, all from userspace.
Any-motion and no-motion events are generated by detecting changes
in acceleration on each axis.
Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
---
Changes in v6:
- Use IIO_DEVICE_ATTR_RO instead of IIO_DEVICE_ATTR for
in_accel_value_available.
- Replace ternary operator with !! to fit the statement on a single line
- Change the description of in_accel_<x|y|z>_mag_adaptive_rising_en
attributes: 'adaptive magnitude' -> 'adaptive threshold'
- Group in_accel_mag_adaptive_rising_value together with similar
attributes
- Clarify in the description of in_accel_value_available that the values
apply to all in_accel_* channels
- Link to v5: https://lore.kernel.org/r/20250830115858.21477-1-gustavograzs@gmail.com
Changes in v5:
- BMI270_G_MACRO_M_S_2 -> BMI270_G_MICRO_M_S_2
- Add patch #4: ABI documentation for the exposed sysfs attributes
Link to v4: https://lore.kernel.org/r/20250711-bmi270-events-v4-3-53ec7da35046@gmail.com
Changes in v4:
- Reworked the threshold for the any-motion event so that threshold *
accel_scale is given in m/s^2, in accordance with the ABI
Also the range of available values for the threshold is now determined
dynamically based on the value of the accelerometer scale
- Fixed alignment and styling of some statements and macros
- Simplified the return statement in the bmi270_read_event_config()
function by returning the boolean expression directly
- Link to v3: https://lore.kernel.org/r/20250616-bmi270-events-v3-0-16e37588604f@gmail.com
Changes in v3:
- Avoid the usage of set_mask_bits() macro on 16-bit integers,
use the bitwise operators instead
- Fix indentation, alignment and style issues
- Link to v2: https://lore.kernel.org/r/20250605-bmi270-events-v2-0-8b2c07d0c213@gmail.com
Changes in v2:
- Reduce the scope of mutex lock when clearing the step counter
- Change the type of the 'steps_enabled' variable from int to bool
- Add a new DMA safe variable to the device's private data to access the
feature registers
- Remove unnecessary mutex lock
- Fix a build error found by the kernel test robot by initializing a
local variable in the `bmi270_update_feature_reg()` function
- Remove dead code in the `bmi270_write_event_config()` function
- Add macro definitions and corresponding datasheet references for
relevant constants: step counter maximum value, step counter factor,
and threshold upper limit
- Remove the event bitmask from the device's private data. Read the
registers directly to retrieve this information instead
- Use IIO_UNMOD_EVENT_CODE instead of IIO_MOD_EVENT_CODE where
appropriate
- Fix shadowed error codes
- Change motion event to be enabled on a per-axis basis
- Create pseudo channel of type accel_x&y&z for the no-motion event
- Change no-motion event type to IIO_EV_TYPE_ROC
- Link to v1: https://lore.kernel.org/r/20250424-bmi270-events-v1-0-a6c722673e5f@gmail.com
---
Gustavo Silva (2):
iio: imu: bmi270: add support for motion events
iio: ABI: document accel and roc event attributes
Documentation/ABI/testing/sysfs-bus-iio | 40 +++
drivers/iio/imu/bmi270/bmi270_core.c | 384 ++++++++++++++++++++++--
2 files changed, 404 insertions(+), 20 deletions(-)
base-commit: 91812d3843409c235f336f32f1c37ddc790f1e03
--
2.51.0
---
Gustavo Silva (2):
iio: imu: bmi270: add support for motion events
iio: ABI: document accelerometer event attributes
Documentation/ABI/testing/sysfs-bus-iio | 34 +++
drivers/iio/imu/bmi270/bmi270_core.c | 381 ++++++++++++++++++++++++++++++--
2 files changed, 395 insertions(+), 20 deletions(-)
---
base-commit: 91812d3843409c235f336f32f1c37ddc790f1e03
change-id: 20250915-bmi270-9e71958cff0d
Best regards,
--
Gustavo Silva <gustavograzs@gmail.com>
next reply other threads:[~2025-09-16 23:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 23:38 Gustavo Silva [this message]
2025-09-16 23:38 ` [PATCH v6 1/2] iio: imu: bmi270: add support for " Gustavo Silva
2025-09-16 23:38 ` [PATCH v6 2/2] iio: ABI: document accelerometer event attributes Gustavo Silva
2025-09-17 8:47 ` Andy Shevchenko
2025-09-27 15:51 ` 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=20250916-bmi270-v6-0-6acd8d26a862@gmail.com \
--to=gustavograzs@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lanzano.alex@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@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®