staging: iio: resolver: ad2s1210: convert LOS threshold to event attr
authorDavid Lechner <dlechner@baylibre.com>
Fri, 6 Oct 2023 00:50:25 +0000 (19:50 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 11 Oct 2023 14:54:40 +0000 (15:54 +0100)
commitaf8b284f23a600a86bb51a591d27e85d5f861b93
treef65faac3443d491674ec3870f910edfe07ecde18
parent235e4b988046d29097523703bb5e5e3ba77259ca
staging: iio: resolver: ad2s1210: convert LOS threshold to event attr

The AD2S1210 has a programmable threshold for the loss of signal (LOS)
fault. This fault is triggered when either the sine or cosine input
falls below the threshold voltage.

This patch converts the custom device LOS threshold attribute to an
event falling edge threshold attribute on a new monitor signal channel.
The monitor signal is an internal signal that combines the amplitudes
of the sine and cosine inputs as well as the current angle and position
output. This signal is used to detect faults in the input signals.

The attribute now uses millivolts instead of the raw register value in
accordance with the IIO ABI.

Emitting the event will be implemented in a later patch.

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