[PATCH 0/4] iio: resolver: move ad2s1210 out of staging

From: David Lechner
Date: Wed Sep 20 2023 - 13:03:30 EST


This series moves the ad2s1210 resolver driver out of staging (after 13 years!).

We have made quite a few fixes and improvements to the driver (specifics are
listed in "iio: resolver: add new driver for AD2S1210"). The driver has been
tested on actual hardware using a EVAL-AD2S1210 evaluation board. (Note: not
all device tree features have been implemented in the driver since the eval
board doesn't support them out of the box. We plan to add them later if needed.)

One thing left over from the staging driver that probably needs more attention
still is the fault handling (both the fault threshold attributes and how
userspace gets notified of fault conditions). We considered adding these as
events, but the fault conditions are related to internal measurements in the
chip that aren't available as channels.

Since the chip is designed to read the fault register each time we read the
data registers for one of the two channels it seems like faults should be
associated with channels one way or another. Would it make sense to add extra
channels for the internal signals that only have fault events (mostly with
IIO_EV_TYPE_THRESH)? Or would it make sense to add a new "flags" channel type
where the "raw" value is bit flags? Or something else?

Here is the table of available faults for context. Sine/cosine inputs are
internal signals.

| Bit | Description
+-----+------------
| D7 | Sine/cosine inputs clipped
| D6 | Sine/cosine inputs below LOS threshold
| D5 | Sine/cosine inputs exceed DOS overrange threshold
| D4 | Sine/cosine inputs exceed DOS mismatch threshold
| D3 | Tracking error exceeds LOT threshold
| D2 | Velocity exceeds maximum tracking rate
| D1 | Phase error exceeds phase lock range
| D0 | Configuration parity error


David Lechner (4):
dt-bindings: iio: resolver: add devicetree bindings for ad2s1210
iio: sysfs: add IIO_DEVICE_ATTR_NAMED_RW macro
staging: iio: resolver: remove ad2s1210 driver
iio: resolver: add new driver for AD2S1210

.../testing/sysfs-bus-iio-resolver-ad2s1210 | 109 ++
.../bindings/iio/resolver/adi,ad2s1210.yaml | 150 +++
drivers/iio/resolver/Kconfig | 13 +
drivers/iio/resolver/Makefile | 1 +
drivers/iio/resolver/ad2s1210.c | 948 ++++++++++++++++++
drivers/staging/iio/Kconfig | 1 -
drivers/staging/iio/Makefile | 1 -
drivers/staging/iio/resolver/Kconfig | 18 -
drivers/staging/iio/resolver/Makefile | 6 -
drivers/staging/iio/resolver/ad2s1210.c | 716 -------------
include/linux/iio/sysfs.h | 4 +
11 files changed, 1225 insertions(+), 742 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-resolver-ad2s1210
create mode 100644 Documentation/devicetree/bindings/iio/resolver/adi,ad2s1210.yaml
create mode 100644 drivers/iio/resolver/ad2s1210.c
delete mode 100644 drivers/staging/iio/resolver/Kconfig
delete mode 100644 drivers/staging/iio/resolver/Makefile
delete mode 100644 drivers/staging/iio/resolver/ad2s1210.c

--
2.34.1