On Thu, 20 Feb 2025 10:42:27 +0000 Lothar Rubusch <l.rubusch@xxxxxxxxx> wrote: > Set the suppress bit feature to the double tap detection, whenever > double tap is enabled. > > Any tap event is defined by a rising signal edge above threshold, i.e. > duration time starts counting; and the falling edge under threshold > within duration time, i.e. then the tap event is issued. This means > duration is used individually for each tap event. > > For double tap detection after a single tap, a latency time needs to be > specified. Usually tap events, i.e. spikes above and returning below > threshold will be ignored within latency. After latency, the window > time starts counting for a second tap detection which has to happen > within a duration time. > > If the suppress bit is not set, spikes within latency time are ignored. > Setting the suppress bit will invalidate the double tap function. The > sensor will thus be able to save the window time for double tap > detection, and follow a more strict definition of what signal qualifies > for a double tap. > > In a summary having the suppress bit set, fewer signal spikes will be > considered as double taps. This is an optional add on to double tap, > thus a separate patch. > > Signed-off-by: Lothar Rubusch <l.rubusch@xxxxxxxxx> > --- > drivers/iio/accel/adxl345_core.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c > index c014bdf84e66..10cd81dd08bb 100644 > --- a/drivers/iio/accel/adxl345_core.c > +++ b/drivers/iio/accel/adxl345_core.c > @@ -34,6 +34,7 @@ > #define ADXL345_INT2 1 > > #define ADXL345_REG_TAP_AXIS_MSK GENMASK(2, 0) > +#define ADXL345_REG_TAP_SUPPRESS_MSK BIT(3) > > enum adxl345_axis { > ADXL345_Z_EN = BIT(0), > @@ -258,6 +259,18 @@ static int adxl345_set_singletap_en(struct adxl345_state *st, > > static int adxl345_set_doubletap_en(struct adxl345_state *st, bool en) > { > + int ret; > + > + /* > + * generally suppress detection of spikes during the latency period as Local style has large comments as sentences so capital letter at start and a full stop at the end preferred. > + * double taps here, this is fully optional for double tap detection > + */ > + ret = regmap_update_bits(st->regmap, ADXL345_REG_TAP_AXIS, > + ADXL345_REG_TAP_SUPPRESS_MSK, > + en ? ADXL345_TAP_SUPPRESS : 0x00); > + if (ret) > + return ret; > + > return _adxl345_set_tap_int(st, ADXL345_DOUBLE_TAP, en); > } >