Re: [PATCH v2 7/9] iio: imu: st_lsm6dsx: add event configurability on a per axis basis

Andy Shevchenko
2025-11-20T09:06:53Z

On Thu, Nov 20, 2025 at 09:26:13AM +0100, Francesco Lavra wrote:
> In order to be able to configure event detection on a per axis
> basis (for either setting an event threshold/sensitivity value, or
> enabling/disabling event detection), add new axis-specific fields
> to struct st_lsm6dsx_event_src, and modify the logic that handles
> event configuration to properly handle axis-specific settings when
> supported by a given event source.
> A future commit will add actual event sources with per-axis
> configurability.

...

> + /*
> + * If the set of axes for which the event source is enabled does not
> + * change from empty to non-empty or vice versa, there is nothing else
> + * to do.
> + */
> + old_enable = hw->enable_event[event];
> + new_enable = state ? (old_enable | BIT(axis)) :
> + (old_enable & ~BIT(axis));
> + if (!!old_enable == !!new_enable)
> + return 0;

Oh, seems I forgot to click "send" for the previous reply.
In the old round I proposed better way of doing that (spoiler, no hweight()
needed at all).

--
With Best Regards,
Andy Shevchenko