]> git.karo-electronics.de Git - karo-tx-linux.git/commit
iio: trigger: stm32-timer: fix get/set down count direction
authorFabrice Gasnier <fabrice.gasnier@st.com>
Thu, 27 Jul 2017 16:18:59 +0000 (18:18 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 30 Jul 2017 13:46:02 +0000 (14:46 +0100)
commit06e3fe89988b1c99a3d9953b1d3b1faf3f047017
tree793c2e9ab489063514a608bbe9d2c8916de38e35
parent1987a08cd989fd9e5690e90a04e70046e93315f4
iio: trigger: stm32-timer: fix get/set down count direction

Fixes: 4adec7da0536 ("iio: stm32 trigger: Add quadrature encoder device")
This fixes two issues:
- stm32_set_count_direction: to set down direction
- stm32_get_count_direction: to get down direction

IIO core provides/expects value to be an index of iio_enum items array.
This needs to be turned by these routines into TIM_CR1_DIR (e.g. BIT(4))
value.
Also, report error when attempting to write direction, when in encoder
mode: in this case, direction is read only (given by encoder inputs).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/trigger/stm32-timer-trigger.c