iio: stm32 trigger: Add quadrature encoder device
authorBenjamin Gaignard <benjamin.gaignard@linaro.org>
Tue, 4 Apr 2017 07:47:51 +0000 (09:47 +0200)
committerJonathan Cameron <jic23@kernel.org>
Fri, 14 Apr 2017 14:08:31 +0000 (15:08 +0100)
commit4adec7da0536a345d901d7ba55b6c93a14eeeaff
treef8eb05106b3e15c05e3241569aceebacf629bedc
parent510c01063085b5dc7788d9953f9bf58e16b631e8
iio: stm32 trigger: Add quadrature encoder device

One of the features of STM32 trigger hardware block is a quadrature
encoder that can counts up/down depending of the levels and edges
of the selected external pins.

This patch allow to read/write the counter, get it direction,
set/get quadrature modes and get scale factor.

When counting up preset value is the limit of the counter.
When counting down the counter start from preset value down to 0.
This preset value could be set/get by using
/sys/bus/iio/devices/iio:deviceX/in_count0_preset attribute.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/ABI/testing/sysfs-bus-iio-timer-stm32
drivers/iio/trigger/stm32-timer-trigger.c
include/linux/mfd/stm32-timers.h