On Tue, 10 Jun 2025 21:59:31 +0000 Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote: > Add adaptive coupling activity/inactivity detection by setting the AC/DC > bit. This is an additional configuration to the activity and inactivity > magnitude events, respectively. DC-coupled event generation takes the > configured threshold values directly, where AC-coupled event generation > references to the acceleration value at the start of the activity > detection. New samples of acceleration are then compared to this > reference. > > Both types are implemented using MAG for DC-coupled activity/inactivity, > but MAG_ADAPTIVE for AC-coupled activity inactivity events. Threshold and > periods can be configured by different sysfs handles, but share the same > registers at the sensor. Therefore activity and inactivity, > respectively, cannot be configured with AC- and DC-coupling at the same > time, e.g. configuring DC-coupled and AC-coupled activity will result in > AC-coupled activity, or generally the most recent one being configured. > > This patch implicitly regroups adxl345_read/write_event_value() and > adxl345_read/write_event_config() where now redundant parts, due to > similar event handling for AC-coupling, are moved to a separate function > adxl345_read/write_mag_config() and adxl345_read/write_mag_value(), > respectively. Can we introduce these helpers before this patch? It has become rather hard to read with the code movement and new stuff combined. Thanks Jonathan