OSDN Git Service

pwm: stm32: Improve capture by tuning counter prescaler
authorFabrice Gasnier <fabrice.gasnier@st.com>
Wed, 16 May 2018 07:35:59 +0000 (09:35 +0200)
committerLee Jones <lee.jones@linaro.org>
Wed, 16 May 2018 08:11:13 +0000 (09:11 +0100)
commitd66ffb91c374fc500fe666645184e278774bad38
tree999aae9d7ca17a10e2614f0cd4b1a518be514bb8
parent53e38fe73f941291fd20794c15c3bb7b104a4a17
pwm: stm32: Improve capture by tuning counter prescaler

Currently, capture is based on timeout window to configure prescaler.
PWM capture framework provides 1s window at the time of writing.

There's place for improvement, after input signal has been captured once:
- Finer tune counter clock prescaler, by using 1st capture result (with
arbitrary margin).
- Do a 2nd capture, with scaled capture window.
This increases accuracy, especially at high rates.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/pwm/pwm-stm32.c