]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
iio: trigger: stm32-timer: fix a corner case to write preset
authorFabrice Gasnier <fabrice.gasnier@st.com>
Mon, 18 Sep 2017 10:05:31 +0000 (12:05 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 19 Oct 2017 14:48:52 +0000 (09:48 -0500)
BugLink: http://bugs.launchpad.net/bugs/1723145
commit b7a9776c1f9443326632486fcbd82dca82f8511e upstream.

Balance timer start routine that sets ARPE: clear it in stop routine.
This fixes a corner case, when timer is used successively as trigger
(with sampling_frequency start/stop routines), then as a counter
(with preset).

Fixes: 93fbe91b5521 ("iio: Add STM32 timer trigger driver")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/iio/trigger/stm32-timer-trigger.c

index 03da395c6cbccb8dbe7d5996e71dddf4555fc18c..ea128bd82a28eb6a29d8b1293c6f52bdaa5ea8f0 100644 (file)
@@ -138,6 +138,7 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv)
                clk_disable(priv->clk);
 
        /* Stop timer */
+       regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
        regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
        regmap_write(priv->regmap, TIM_PSC, 0);
        regmap_write(priv->regmap, TIM_ARR, 0);