Commit 2375e964 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

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: 9e37a53e ("pwm: sifive: Add a driver for SiFive SoC PWM")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: default avatarEmil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent ace41d75
...@@ -308,6 +308,9 @@ static int pwm_sifive_remove(struct platform_device *dev) ...@@ -308,6 +308,9 @@ static int pwm_sifive_remove(struct platform_device *dev)
struct pwm_device *pwm; struct pwm_device *pwm;
int ch; int ch;
pwmchip_remove(&ddata->chip);
clk_notifier_unregister(ddata->clk, &ddata->notifier);
for (ch = 0; ch < ddata->chip.npwm; ch++) { for (ch = 0; ch < ddata->chip.npwm; ch++) {
pwm = &ddata->chip.pwms[ch]; pwm = &ddata->chip.pwms[ch];
if (pwm->state.enabled) if (pwm->state.enabled)
...@@ -315,8 +318,6 @@ static int pwm_sifive_remove(struct platform_device *dev) ...@@ -315,8 +318,6 @@ static int pwm_sifive_remove(struct platform_device *dev)
} }
clk_unprepare(ddata->clk); clk_unprepare(ddata->clk);
pwmchip_remove(&ddata->chip);
clk_notifier_unregister(ddata->clk, &ddata->notifier);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment