]> git.baikalelectronics.ru Git - kernel.git/commit
pwm: sifive: Ensure the clk is enabled exactly once per running PWM
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 21 Jul 2022 10:31:28 +0000 (12:31 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 29 Jul 2022 11:41:05 +0000 (13:41 +0200)
commit01766489fd667bda025c6aaa0319bbbb973e50c6
treea14ec27c8de093a86c5921ce93fb2de65a66e63a
parent7ada1fbecee4896fa6decc82d976cde02bd31ce0
pwm: sifive: Ensure the clk is enabled exactly once per running PWM

.apply() assumes the clk to be for a given PWM iff the PWM is enabled.
So make sure this is the case when .probe() completes. And in .remove()
disable the according number of times.

This fixes a clk enable/disable imbalance, if some PWMs are already running
at probe time.

Fixes: 1afcd3819818 (pwm: sifive: Add a driver for SiFive SoC PWM)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-sifive.c