Skip to content

Commit 258e483

Browse files
committed
drm/vc4: hdmi: Rework power up
The current code tries to handle the case where CONFIG_PM isn't selected by first calling our runtime_resume implementation and then properly report the power state to the runtime_pm core. This allows to have a functionning device even if pm_runtime_get_* functions are nops. However, the device power state if CONFIG_PM is enabled is RPM_SUSPENDED, and thus our vc4_hdmi_write() and vc4_hdmi_read() calls in the runtime_pm hooks will now report a warning since the device might not be properly powered. Even more so, we need CONFIG_PM enabled since the previous RaspberryPi have a power domain that needs to be powered up for the HDMI controller to be usable. The previous patch has created a dependency on CONFIG_PM, now we can just assume it's there and only call pm_runtime_resume_and_get() to make sure our device is powered in bind. Link: https://lore.kernel.org/r/[email protected] Acked-by: Thomas Zimmermann <[email protected]> Tested-by: Stefan Wahren <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> (cherry picked from commit 53565c2) Signed-off-by: Maxime Ripard <[email protected]>
1 parent 72e2329 commit 258e483

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,17 +2972,15 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
29722972
vc4_hdmi->disable_4kp60 = true;
29732973
}
29742974

2975+
pm_runtime_enable(dev);
2976+
29752977
/*
2976-
* We need to have the device powered up at this point to call
2977-
* our reset hook and for the CEC init.
2978+
* We need to have the device powered up at this point to call
2979+
* our reset hook and for the CEC init.
29782980
*/
2979-
ret = vc4_hdmi_runtime_resume(dev);
2981+
ret = pm_runtime_resume_and_get(dev);
29802982
if (ret)
2981-
goto err_put_ddc;
2982-
2983-
pm_runtime_get_noresume(dev);
2984-
pm_runtime_set_active(dev);
2985-
pm_runtime_enable(dev);
2983+
goto err_disable_runtime_pm;
29862984

29872985
if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") ||
29882986
of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) &&
@@ -3028,6 +3026,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
30283026
err_destroy_encoder:
30293027
drm_encoder_cleanup(encoder);
30303028
pm_runtime_put_sync(dev);
3029+
err_disable_runtime_pm:
30313030
pm_runtime_disable(dev);
30323031
err_put_ddc:
30333032
put_device(&vc4_hdmi->ddc->dev);

0 commit comments

Comments
 (0)