]> 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)
commit2c9b034b6d63c3aaa8b39a25fd2760014e0e2644
tree948500fb0d45d578e1d01a16ae367bed38d51076
parent7243580a3f5fe1febba3c295504eb369c01cd7ac
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