Re: [PATCH v1 10/12] iio: accel: adxl313: add inactivity sensing

From: Andy Shevchenko
Date: Mon May 19 2025 - 08:18:56 EST


On Sun, May 18, 2025 at 11:13:19AM +0000, Lothar Rubusch wrote:
> Extend the interrupt handler to process interrupts as inactivity events.
> Add functions to set threshold and period registers for inactivity. Add
> functions to enable / disable inactivity. Extend the fake iio channel to
> deal with inactivity events on x, y and z combined with AND.

...

> en = false;

You see, now it becomes even useless code.

> - if (type == ADXL313_ACTIVITY)
> + if (type == ADXL313_ACTIVITY) {
> en = cmd_en && threshold;
> + } else {
> + ret = regmap_read(data->regmap, ADXL313_REG_TIME_INACT, &inact_time_s);
> + if (ret)
> + return ret;
> +
> + en = cmd_en && threshold && inact_time_s;
> + }

...

> + case IIO_EV_DIR_FALLING:
> + ret = regmap_read(data->regmap,
> + adxl313_act_thresh_reg[ADXL313_INACTIVITY],
> + &inact_threshold);
> + if (ret)
> + return ret;
> + *val = inact_threshold * 15625;
> + *val2 = 1000000;

MICRO ?

> + return IIO_VAL_FRACTIONAL;
> default:
> return -EINVAL;
> }

--
With Best Regards,
Andy Shevchenko