File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -490,6 +490,7 @@ module_init(vc4_drm_register);
490
490
module_exit (vc4_drm_unregister );
491
491
492
492
MODULE_ALIAS ("platform:vc4-drm" );
493
+ MODULE_SOFTDEP ("pre: snd-soc-hdmi-codec" );
493
494
MODULE_DESCRIPTION ("Broadcom VC4 DRM Driver" );
494
495
MODULE_AUTHOR (
"Eric Anholt <[email protected] >" );
495
496
MODULE_LICENSE ("GPL v2" );
Original file line number Diff line number Diff line change @@ -3318,12 +3318,37 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
3318
3318
struct vc4_hdmi * vc4_hdmi = dev_get_drvdata (dev );
3319
3319
unsigned long __maybe_unused flags ;
3320
3320
u32 __maybe_unused value ;
3321
+ unsigned long rate ;
3321
3322
int ret ;
3322
3323
3324
+ /*
3325
+ * The HSM clock is in the HDMI power domain, so we need to set
3326
+ * its frequency while the power domain is active so that it
3327
+ * keeps its rate.
3328
+ */
3329
+ ret = clk_set_min_rate (vc4_hdmi -> hsm_clock , HSM_MIN_CLOCK_FREQ );
3330
+ if (ret )
3331
+ return ret ;
3332
+
3323
3333
ret = clk_prepare_enable (vc4_hdmi -> hsm_clock );
3324
3334
if (ret )
3325
3335
return ret ;
3326
3336
3337
+ /*
3338
+ * Whenever the RaspberryPi boots without an HDMI monitor
3339
+ * plugged in, the firmware won't have initialized the HSM clock
3340
+ * rate and it will be reported as 0.
3341
+ *
3342
+ * If we try to access a register of the controller in such a
3343
+ * case, it will lead to a silent CPU stall. Let's make sure we
3344
+ * prevent such a case.
3345
+ */
3346
+ rate = clk_get_rate (vc4_hdmi -> hsm_clock );
3347
+ if (!rate ) {
3348
+ ret = - EINVAL ;
3349
+ goto err_disable_clk ;
3350
+ }
3351
+
3327
3352
if (vc4_hdmi -> variant -> reset )
3328
3353
vc4_hdmi -> variant -> reset (vc4_hdmi );
3329
3354
@@ -3345,6 +3370,10 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
3345
3370
#endif
3346
3371
3347
3372
return 0 ;
3373
+
3374
+ err_disable_clk :
3375
+ clk_disable_unprepare (vc4_hdmi -> hsm_clock );
3376
+ return ret ;
3348
3377
}
3349
3378
3350
3379
static void vc4_hdmi_put_ddc_device (void * ptr )
You can’t perform that action at this time.
0 commit comments