]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit6b88c3b9774cd72501991383a8f800114f722208
tree948500fb0d45d578e1d01a16ae367bed38d51076
parent0b8daef4bc0fcaf744bde23e72bb6be4870b9bcc
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