diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2022-07-21 12:31:29 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2022-07-29 13:41:13 +0200 |
commit | 2375e964d541bb09158cd2dff67b5d74e8de61cd (patch) | |
tree | e8bc12e39f8b49618218719fc6a4edfd3b7e30dc /drivers/pwm | |
parent | ace41d7564e655c39f709a78c035188a460c7cbd (diff) |
pwm: sifive: Shut down hardware only after pwmchip_remove() completed
The PWMs are expected to be functional until pwmchip_remove() is called.
So disable the clks only afterwards.
Fixes: 9e37a53eb051 ("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>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/pwm-sifive.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index da40ade0ebdf..2d4fa5e5fdd4 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -308,6 +308,9 @@ static int pwm_sifive_remove(struct platform_device *dev) struct pwm_device *pwm; int ch; + pwmchip_remove(&ddata->chip); + clk_notifier_unregister(ddata->clk, &ddata->notifier); + for (ch = 0; ch < ddata->chip.npwm; ch++) { pwm = &ddata->chip.pwms[ch]; if (pwm->state.enabled) @@ -315,8 +318,6 @@ static int pwm_sifive_remove(struct platform_device *dev) } clk_unprepare(ddata->clk); - pwmchip_remove(&ddata->chip); - clk_notifier_unregister(ddata->clk, &ddata->notifier); return 0; } |