Skip to content

Instantly share code, notes, and snippets.

@notro
Created September 1, 2022 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notro/23b984e7fa05cfbda2db50a421cac065 to your computer and use it in GitHub Desktop.
Save notro/23b984e7fa05cfbda2db50a421cac065 to your computer and use it in GitHub Desktop.
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index 55f6f490877c..4493f1c80af7 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -543,8 +543,6 @@ static void vc4_vec_encoder_disable(struct drm_encoder *encoder,
VEC_DAC_MISC_DAC_PWRDN |
VEC_DAC_MISC_LDO_PWRDN);
- clk_disable_unprepare(vec->clock);
-
ret = pm_runtime_put(&vec->pdev->dev);
if (ret < 0) {
DRM_ERROR("Failed to release power domain: %d\n", ret);
@@ -582,25 +580,6 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
goto err_dev_exit;
}
- /*
- * We need to set the clock rate each time we enable the encoder
- * because there's a chance we share the same parent with the HDMI
- * clock, and both drivers are requesting different rates.
- * The good news is, these 2 encoders cannot be enabled at the same
- * time, thus preventing incompatible rate requests.
- */
- ret = clk_set_rate(vec->clock, 108000000);
- if (ret) {
- DRM_ERROR("Failed to set clock rate: %d\n", ret);
- goto err_put_runtime_pm;
- }
-
- ret = clk_prepare_enable(vec->clock);
- if (ret) {
- DRM_ERROR("Failed to turn on core clock: %d\n", ret);
- goto err_put_runtime_pm;
- }
-
/* Reset the different blocks */
VEC_WRITE(VEC_WSE_RESET, 1);
VEC_WRITE(VEC_SOFT_RESET, 1);
@@ -739,6 +718,20 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;
+ pm_runtime_forbid(dev);
+
+ ret = clk_set_rate(vec->clock, 108000000);
+ if (ret) {
+ DRM_ERROR("Failed to set clock rate: %d\n", ret);
+ return ret;
+ }
+
+ ret = clk_prepare_enable(vec->clock);
+ if (ret) {
+ DRM_ERROR("Failed to turn on core clock: %d\n", ret);
+ return ret;
+ }
+
ret = drmm_encoder_init(drm, &vec->encoder.base,
&vc4_vec_encoder_funcs,
DRM_MODE_ENCODER_TVDAC,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment