Re: [PATCH v5 4/8] iio: accel: adxl313: add activity sensing

From: Andy Shevchenko
Date: Mon Jun 16 2025 - 05:36:23 EST


On Mon, Jun 16, 2025 at 1:23 AM Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote:
>
> Add support for configuring an activity detection threshold. Extend the
> interrupt handler to process activity-related interrupts, and provide
> functions to set the threshold as well as to enable or disable activity
> sensing. Additionally, introduce a virtual channel that represents the
> logical AND of the x, y, and z axes in the IIO channel.
>
> This patch serves as a preparatory step; some definitions and functions
> introduced here are intended to be extended later to support inactivity
> detection.

...

> +static int adxl313_is_act_inact_en(struct adxl313_data *data,
> + enum adxl313_activity_type type)
> +{
> + unsigned int axis_ctrl;
> + unsigned int regval;
> + int axis_en, ret;
> +
> + ret = regmap_read(data->regmap, ADXL313_REG_ACT_INACT_CTL, &axis_ctrl);
> + if (ret)
> + return ret;
> +
> + axis_en = FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl);

> +

Remove this blank line. If needed, can be added later.

> + if (!axis_en)
> + return false;
> +
> + /* Check if specific interrupt is enabled */
> + ret = regmap_read(data->regmap, ADXL313_REG_INT_ENABLE, &regval);
> + if (ret)
> + return ret;
> +
> + return adxl313_act_int_reg[type] & regval;
> +}

--
With Best Regards,
Andy Shevchenko