Re: [PATCH v3 26/27] staging: iio: resolver: ad2s1210: implement fault events

From: David Lechner
Date: Mon Oct 02 2023 - 12:43:36 EST


On Sat, Sep 30, 2023 at 11:00 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> On Fri, 29 Sep 2023 12:23:31 -0500
> David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
> > From: David Lechner <david@xxxxxxxxxxxxxx>
> >
> > From: David Lechner <dlechner@xxxxxxxxxxxx>
> >
> > When reading the position and velocity on the AD2S1210, there is also a
> > 3rd byte following the two data bytes that contains the fault flag bits.
> > This patch adds support for reading this byte and generating events when
> > faults occur.
> >
> > The faults are mapped to various channels and event types in order to
> > have a unique event for each fault.
> >
> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
>
> Use of x and y modifiers is a little odd. What was your reasoning?
> Was it just that there was a X_OR_Y modifier? If so, don't use that!
> It seemed like a good idea at the time, but it's not nice to deal with
> and requires a channel with that modifier to hang the controls off
> + make sure userspace expects that event code.
>

Yes, I was perhaps getting a bit too creative here (the two inputs
come from transformers mounted 90 degrees apart so measure X and Y
component of an angle). The only reason I did this was to take
advantage of the possibility of an "OR" event to avoid double events
for a single fault bit. We can just go with the double event on the
two different input channels as discussed in "[PATCH v3 22/27]
staging: iio: resolver: ad2s1210: convert LOS threshold to event
attr".