staging: iio: resolver: ad2s1210: convert LOT threshold attrs to event attrs
authorDavid Lechner <dlechner@baylibre.com>
Fri, 6 Oct 2023 00:50:24 +0000 (19:50 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 11 Oct 2023 14:54:40 +0000 (15:54 +0100)
commit235e4b988046d29097523703bb5e5e3ba77259ca
tree380d6439ceeeb0e012b30d973b45f64ef5787997
parent128b9389db0ed66ab0a108a1b439cabf2537032f
staging: iio: resolver: ad2s1210: convert LOT threshold attrs to event attrs

The AD2S1210 monitors the internal error signal (difference between
estimated angle and measured angle) to determine a loss of position
tracking (LOT) condition. When the error value exceeds a threshold, a
fault is triggered. This threshold is user-configurable.

This patch converts the custom lot_high_thrd and lot_low_thrd attributes
in the ad2s1210 driver to standard event attributes. This will allow
tooling to be able to expose these in a generic way.

Since the low threshold determines the hysteresis, it requires some
special handling to expose the difference between the high and low
register values as the hysteresis instead of exposing the low register
value directly.

The attributes also return the values in radians now as required by the
ABI.

Actually emitting the fault event will be done in a later patch.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20231005-ad2s1210-mainline-v4-7-ec00746840fc@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/resolver/ad2s1210.c