Re: [RFC 2/2] iio: accel: bma400: Add support for single and double tap events
From: Jonathan Cameron
Date: Mon Jun 06 2022 - 11:01:05 EST
On Sun, 5 Jun 2022 10:38:10 +0530
Jagath Jog J <jagathjog1996@xxxxxxxxx> wrote:
> Hi Jonathan and Andy.
>
> On Sat, Jun 4, 2022 at 8:22 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> >
> > On Sun, 29 May 2022 09:31:53 +0530
> > Jagath Jog J <jagathjog1996@xxxxxxxxx> wrote:
> >
> > > Add support for single and double tap events based on the tap threshold
> > > value and minimum quite time value between the taps. INT1 pin is used to
> > > interrupt and event is pushed to userspace.
> > >
> > > Signed-off-by: Jagath Jog J <jagathjog1996@xxxxxxxxx>
> >
> > Hi Jagath,
> >
> > A few comments inline.
> >
> > Thanks,
> >
> > Jonathan
> > > +
> > > + /*
> > > + * acc_filt1 is the data source for the tap interrupt and it is
> > > + * operating on an input data rate of 200Hz.
> > > + */
> > > + if (!data->tap_event_en) {
> >
> > Feels like checking the wrong thing. If we need 200Hz, check if the
> > data rate is at 200Hz rather than if the tap_event is not enabled.
> > Obviously same result, but one seems more obvious.
>
> if (!data->tap_event_en)
> This checking is to make sure not to execute
> bma400_set_accel_output_data_rate() function while disabling the
> tap event to avoid the negative (-EBUSY) return value from the
> function bma400_set_accel_output_data_rate() when either of
> the tap is enabled.
Ah. Fair enough. It's a little odd looking though. You could push
the check out of bma400_set_accel_output_data_rate() and into
write_raw though would need to be within the lock to avoid potential
race conditions. Perhaps just not worth the effort.
Jonathan