linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v11 0/8] iio: accel: adxl345: add interrupt based sensor events
@ 2025-07-02 23:03 Lothar Rubusch
  2025-07-02 23:03 ` [PATCH v11 1/8] iio: accel: adxl345: simplify interrupt mapping Lothar Rubusch
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Lothar Rubusch @ 2025-07-02 23:03 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, dlechner, nuno.sa, andy, corbet
  Cc: linux-iio, linux-kernel, linux-doc, eraretuya, l.rubusch

Add several interrupt based sensor detection events:
- refactoring and fixes
- activity/inactivity linked and auto-sleep
- AC-coupled activity/inactivity
- Extend inactivity for inactivity under 1s (using free-fall register)
- documentation

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
---
v10 -> v11:
- [PATCH v10 1/7]: prefixed `_get_int_line()`
- [PATCH v10 3/7]: add `ADXL345_ACT_XYZ_EN` to reduce LoC occupation, in
  cases of added features, the line formatting is actually kept the same as
  in v10
- [PATCH v10 4/7]: add `ADXL345_INACT_XYZ_EN` to simplify and reduce LoC
  ocupation
- [PATCH v10 5/7]: Break the variable declaration and assignment into two
  distinct lines
- [PATCH v10 6/7]: `adxl345_set_inact_time()`: Extract conditional cases
  into separate helper functions; Use a nested if/else to eliminate
  redundant val_int == 0sec checks
- [PATCH v10 7/7]: Separate the documentation sections for free-fall
  detection and inactivity detection into anothe patch

v9 -> v10:

- [PATCH v9 01/11]: Dropped
- [PATCH v9 02/11]: Applied
- [PATCH v9 03/11]: Applied
- [PATCH v9 05/11]: Replace literal number 2 by a `sizeof()` statement.
- [PATCH v9 06/11]: Applied
- [PATCH v9 01/11]: Tap scaling patch is kept unmodified, since the
  threshold has been in raw register values, the patch scales that to
  g/LSB. There was no other advice (so far/to my understanding) to drop or
  modify this patch
- all (remaing) patches: Rephrased commit messages
- `adxl345_is_act_inact_en()`: Refactor the function; Check for a valid
  threshold earlier based on the enable flag; incrementally construct the
  switch/case conditions
- `adxl345_set_act_inact_en()`: Refactor the function; implement helper
  functions; group checks at the beginning, return soon in case of `false`,
  group `cmd_en` using calls to the end
- `adxl345_read/write_mag_config()`: Introduce the helper functions when
  activity is added, and prefer using switch/case statements. However,
  retain the internal nested switch/case structure, as it appears more
  appropriate in the context of handling other channel values and
  configurations
- `adxl345_read/write_mag_value()`: Introduce helpers when activity is
  added (keep internal nested switch/case)
- `adxl345_core_probe()`: Rephrase comment on default values
- `adxl345_set_inact_time()`: Rephrase function description
- `adxl345_set_act_inact_linkbit()`: Factor link-bit and auto-sleep
  handling in a separate function
- `adxl345_set_inact_time()`: Use `clamp()` and convert `min_boundary` and
  `max_boundary` to int; in cases of `>max_boundary` stay with the clamp
  behavior for inactive period
- `adxl345_set_odr()`: The return statement is kept as is, due to several
  refacs it won't change so `return adxl345_set_inact_time(st, 0);` only
  becomes `return adxl345_set_inact_time(st, 0, 0);` throughout the patch
  series
- `adxl345_set_act_inact_linkbit()`: Apply `ADXL345_POWER_CTL_INACT_MSK`
  directly
- `adxl345_is_act_inact_ac()`: Change to use switch/case for clarity
- `adxl345_set_act_inact_ac()`: Additionally accept `cmd_en` to turn
  coupling on/off
- `adxl345_set_inact_time()`: Return from within the conditional cases as
  of the last source patch [PATCH v9 10/11]
- documentation: rephrased major parts (ai based rephrasing)

v8 -> v9:
- githook: apply codespell checks, extend by spellcheck using ispell
- refac: apply `regmap_assing_bits()` in several places
- refac: remove ADXL345_POWER_CTL_STANDBY in adxl345.h not needed anymore
- refac: rename `ADXL345_ACT_INACT_DC/AC` to `ADXL345_COUPLING_DC/AC`
- refac: remove variable irq from `struct adxl345_state`
- refac: apply expressions, such as MILLI or MICRO from linux/units.h
- refac: apply (missing) scaling factor 62.5mg/LSB to tap detection
- change `IIO_EV_TYPE_MAG_REFERENCED` to `IIO_EV_TYPE_MAG_ADAPTIVE`
- `adxl345_fifo_transfer()`: eliminate variable for expression count / 2
- `adxl345_is_act_inact_ac()`: make return boolean, or negative error
- make activity enable cover x, y and z axis together, while signals come
  on particular axis
- `adxl345_read_mag_value()`: separate `MAG` and `MAG_ADAPTIVE` event
  value read and write function to reduce redundant code
- `adxl345_read_mag_config()`: separate `MAG` and `MAG_ADAPTIVE` event
  config read and write functions to reduce redundant code
- `adxl345_set_act_inact_en()`: move linkbit detection out to
  `adxl345_set_act_inact_linkbit()`
- `adxl345_set_act_inact_en()`: fix unsetting register INT ENABLE at
  disabling feature(s)
- apply scaling factor 62.5mg/LSB to activity/inactivity
- apply scaling factor 62.5mg/LSB to activity AC/inactivity AC
- drop dedicated freefall patch
- add patch: fix missing scale factor for tap detection
- add patch: make irq a function local variable
- add patch: simplify measure enable
- add patch: simplify interrupt mapping
- add patch: simplify FIFO reading
- add patch: replace magic numbers by unit expressions
- rename `adxl345_set_inact_time_s()` to `adxl345_set_inact_time()`
- `adxl345_set_inact_time()`: implement inactivity using inactivity
  register (period 1s or higher), freefall register (below 1s) or let it
  setup a period based on given ODR (0s provided)
- doc: update documentation

v7 -> v8:
- activity/inactivity are MAG events
- separate AC coupled activity/inactivity events as MAG_REFERENCED events,
  since AC coupling introduces a (some kind of) reference relation
- since freefall and inactivity (DC coupled) are then actually identical,
  this results in a challenging situation for the freefall patch. Thus,
  the freefall patch is moved to end of this series (before documentation)
- freefall: provide separate sysfs handles to configure and enable freefall
- documentation: update sections on activity/inactivity, freefall, event
  names and examples

v6 -> v7:
- freefall: add a virtual channel, replace OR'ing the axis by AND'ing them
- inactivity: add a virtual channel, replace OR'ing the axis by AND'ing them

v5 -> v6:
- replace bool axis_en for tap and activity/inactivity
- apply freefall bit mask
- change `measure_en` to use `regmap_update_bits()` for POWER_CTL register
- fix comments and update documentation, particularly on inactivity time

v4 -> v5:
- read_config_value() and write_config_value() now use direct returns,
  in case of a failure, measurement stays turned off
- fifo evaluation returns 0 in case of success
- axis enum turned into three different set of defines for tap, act and inact
- turn the suppress bit into a separate define macro
- variable naming, generally use axis_ctrl for similar variables

v3 -> v4:
- rename patch "add double tap suppress bit" to
  "set the tap suppress bit permanently" to make it more comprehensive
- added patch "cleanup regmap return values"
- added patch "introduce adxl345_push_event function", as a solution
  to the return value problem, group all int_stat evaluating pieces
  in the same function
- tap, act and inact axis enabling are using now regmap cache
- activity enable depending on individual axis now, as the sensor offers
  such feature
- inactivity enable depending on individual axis now, as the sensor offers
  such feature
- fix bug in previous patch: separate axis direction in interrupt handler
  sharing the same variable for tap and activity, if tap and activity
  enabled together
- refac of the direction identification of previous patch: only read
  act/tap axis once now in interrupt handler if both is enabled
- fix bug in previous patch: return value of pushed event in interrupt
  handler
- several cleanups

v2 -> v3:
- generally introduction of regmap cache for all directly stored 8-bit
  values, specification of volatile regs and cleanup
- moving thresholds, unchanged values and flags to regmap cache, in
  consequence removal of corresponding member values of the state
  instance
- removal of intio and int_map member fields due to regmap cache, thus
  split of set_interrupts() patches in two parts
- rework documentation
- rework of ac-bit comment

v1 -> v2:
- implementation of all events (but tap2 suppress bit) by means IIO ABI
- add sample frequency / ODR configuration
- add g ranges configuration
- add activity/inactivity using auto-sleep and powersave
- add dynamic adjustment of default values for
  activity/inactivity thresholds and time for inactivity based on ODR
  and g range (can be overwritten)
- add sensor documentation
---
Lothar Rubusch (8):
  iio: accel: adxl345: simplify interrupt mapping
  iio: accel: adxl345: simplify reading the FIFO
  iio: accel: adxl345: add activity event feature
  iio: accel: adxl345: add inactivity feature
  iio: accel: adxl345: add coupling detection for activity/inactivity
  iio: accel: adxl345: extend inactivity time for less than 1s
  docs: iio: add documentation for adxl345 driver
  docs: iio: describe inactivity and free-fall detection on the ADXL345

 Documentation/iio/adxl345.rst    | 443 +++++++++++++++++
 Documentation/iio/index.rst      |   1 +
 drivers/iio/accel/adxl345_core.c | 816 ++++++++++++++++++++++++++++++-
 3 files changed, 1237 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/iio/adxl345.rst


base-commit: 42498420746a4db923f03d048a0ebc9bd2371f56
prerequisite-patch-id: c3c61d8d9cbb12a2d79a094519bf07dfece74318
-- 
2.39.5


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-07-24 13:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 23:03 [PATCH v11 0/8] iio: accel: adxl345: add interrupt based sensor events Lothar Rubusch
2025-07-02 23:03 ` [PATCH v11 1/8] iio: accel: adxl345: simplify interrupt mapping Lothar Rubusch
2025-07-06 16:10   ` Jonathan Cameron
2025-07-02 23:03 ` [PATCH v11 2/8] iio: accel: adxl345: simplify reading the FIFO Lothar Rubusch
2025-07-06 16:11   ` Jonathan Cameron
2025-07-02 23:03 ` [PATCH v11 3/8] iio: accel: adxl345: add activity event feature Lothar Rubusch
2025-07-03 14:24   ` Andy Shevchenko
2025-07-06 16:09     ` Jonathan Cameron
2025-07-20 18:36       ` Lothar Rubusch
2025-07-24 13:43         ` Jonathan Cameron
2025-07-02 23:03 ` [PATCH v11 4/8] iio: accel: adxl345: add inactivity feature Lothar Rubusch
2025-07-03 14:26   ` Andy Shevchenko
2025-07-03 14:59     ` Lothar Rubusch
2025-07-03 15:45       ` Andy Shevchenko
2025-07-06 12:08         ` Jonathan Cameron
2025-07-02 23:03 ` [PATCH v11 5/8] iio: accel: adxl345: add coupling detection for activity/inactivity Lothar Rubusch
2025-07-02 23:03 ` [PATCH v11 6/8] iio: accel: adxl345: extend inactivity time for less than 1s Lothar Rubusch
2025-07-02 23:03 ` [PATCH v11 7/8] docs: iio: add documentation for adxl345 driver Lothar Rubusch
2025-07-02 23:03 ` [PATCH v11 8/8] docs: iio: describe inactivity and free-fall detection on the ADXL345 Lothar Rubusch
2025-07-06 16:16   ` Jonathan Cameron
2025-07-20 18:49     ` Lothar Rubusch
2025-07-24 13:47       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).