OSDN Git Service

pwm: stm32: Add capture support
authorFabrice Gasnier <fabrice.gasnier@st.com>
Wed, 16 May 2018 07:35:58 +0000 (09:35 +0200)
committerLee Jones <lee.jones@linaro.org>
Wed, 16 May 2018 08:10:53 +0000 (09:10 +0100)
commit53e38fe73f941291fd20794c15c3bb7b104a4a17
tree948500fb0d45d578e1d01a16ae367bed38d51076
parent0c6609805b638debcb7d9d44556546b043ded2e9
pwm: stm32: Add capture support

Add support for PMW input mode on pwm-stm32. STM32 timers support
period and duty cycle capture as long as they have at least two PWM
channels. One capture channel is used for period (rising-edge), one
for duty-cycle (falling-edge).
When there's only one channel available, only period can be captured.
Duty-cycle is simply zero'ed in such a case.

Capture requires exclusive access (e.g. no pwm output running at the
same time, to protect common prescaler).
Timer DMA burst mode (from MFD core) is being used, to take two
snapshots of capture registers (upon each period rising edge).

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
include/linux/mfd/stm32-timers.h