Re: [PATCH v10 5/7] iio: accel: adxl345: add coupling detection for activity/inactivity

From: Andy Shevchenko
Date: Mon Jun 23 2025 - 06:11:37 EST


On Sun, Jun 22, 2025 at 03:50:08PM +0000, Lothar Rubusch wrote:
> Enable AC/DC coupling configuration for activity and inactivity detection
> by setting the AC/DC bit. Extend existing magnitude-based detection with
> adaptive AC-coupled mode.
>
> Use DC-coupled mode to compare acceleration samples directly against
> configured thresholds. Use AC-coupled mode to compare samples against a
> reference taken at the start of activity detection. Implement DC-coupled
> events using MAG, and AC-coupled events using MAG_ADAPTIVE.
>
> Expose configuration of thresholds and periods via separate sysfs handles.
> Note that both coupling modes share the same sensor registers, so activity
> or inactivity detection cannot be configured for both AC and DC
> simultaneously. Apply the most recently configured mode.
>
> Simplify event handling and support adaptive AC-coupling.

...

> static int adxl345_set_act_inact_linkbit(struct adxl345_state *st,
> enum adxl345_activity_type type,
> bool en)
> {
> - int act_en, inact_en;
> + int act_en, act_ac_en, inact_en, inact_ac_en;

Just make it two,

int act_ac_en, inact_ac_en;
int act_en, inact_en;


--
With Best Regards,
Andy Shevchenko