rockchip64: reworked PWM patch due to breakage in existing pwm dtbs (#3913)

This commit is contained in:
Paolo 2022-06-19 12:38:17 +02:00 committed by GitHub
parent 1a2800f384
commit c47922f71e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index f3647b317152..7905deaf7055 100644
index f3647b31715..627cc1931dd 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -1,9 +1,12 @@
@ -222,7 +222,7 @@ index f3647b317152..7905deaf7055 100644
+ */
+ rockchip_pwm_get_state(chip, pwm, state);
+
+ if (state->enabled || pc->oneshot)
+ if ((state->enabled || pc->oneshot) && pc->active_state)
+ ret = pinctrl_select_state(pc->pinctrl, pc->active_state);
out:
- clk_disable(pc->clk);
@ -309,7 +309,7 @@ index f3647b317152..7905deaf7055 100644
}
count = of_count_phandle_with_args(pdev->dev.of_node,
@@ -337,26 +398,44 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
@@ -337,26 +398,42 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
ret = clk_prepare_enable(pc->clk);
if (ret) {
@ -333,10 +333,8 @@ index f3647b317152..7905deaf7055 100644
+ }
+
+ pc->active_state = pinctrl_lookup_state(pc->pinctrl, "active");
+ if (IS_ERR(pc->active_state)) {
+ dev_err(&pdev->dev, "No active pinctrl state\n");
+ return PTR_ERR(pc->active_state);
+ }
+ if (IS_ERR(pc->active_state))
+ pc->active_state = NULL;
+
platform_set_drvdata(pdev, pc);
@ -360,7 +358,7 @@ index f3647b317152..7905deaf7055 100644
ret = pwmchip_add(&pc->chip);
if (ret < 0) {
@@ -365,15 +444,13 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
@@ -365,15 +442,13 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
}
/* Keep the PWM clk enabled if the PWM appears to be up and running. */
@ -378,7 +376,7 @@ index f3647b317152..7905deaf7055 100644
err_clk:
clk_disable_unprepare(pc->clk);
@@ -384,11 +461,24 @@ static int rockchip_pwm_remove(struct platform_device *pdev)
@@ -384,11 +459,24 @@ static int rockchip_pwm_remove(struct platform_device *pdev)
{
struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev);
@ -404,7 +402,7 @@ index f3647b317152..7905deaf7055 100644
return 0;
}
@@ -400,7 +490,21 @@ static struct platform_driver rockchip_pwm_driver = {
@@ -400,7 +488,21 @@ static struct platform_driver rockchip_pwm_driver = {
.probe = rockchip_pwm_probe,
.remove = rockchip_pwm_remove,
};