]> Git Repo - linux.git/commit
pwm: stm32-lp: Add check in case requested period cannot be achieved
authorFabrice Gasnier <[email protected]>
Wed, 18 Sep 2019 14:54:21 +0000 (16:54 +0200)
committerThierry Reding <[email protected]>
Sat, 21 Sep 2019 01:25:10 +0000 (03:25 +0200)
commitc91e3234c6035baf5a79763cb4fcd5d23ce75c2b
treeff657840c6b1869f809e4d2b5afc5b7bbeee93bf
parent71523d1812aca61e32e742e87ec064e3d8c615e1
pwm: stm32-lp: Add check in case requested period cannot be achieved

LPTimer can use a 32KHz clock for counting. It depends on clock tree
configuration. In such a case, PWM output frequency range is limited.
Although unlikely, nothing prevents user from requesting a PWM frequency
above counting clock (32KHz for instance):
- This causes (prd - 1) = 0xffff to be written in ARR register later in
the apply() routine.
This results in badly configured PWM period (and also duty_cycle).
Add a check to report an error is such a case.

Signed-off-by: Fabrice Gasnier <[email protected]>
Reviewed-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
drivers/pwm/pwm-stm32-lp.c
This page took 0.051496 seconds and 4 git commands to generate.