File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -490,6 +490,7 @@ module_init(vc4_drm_register);
490490module_exit (vc4_drm_unregister );
491491
492492MODULE_ALIAS ("platform:vc4-drm" );
493+ MODULE_SOFTDEP ("pre: snd-soc-hdmi-codec" );
493494MODULE_DESCRIPTION ("Broadcom VC4 DRM Driver" );
494495MODULE_AUTHOR ("Eric Anholt <eric@anholt.net>" );
495496MODULE_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)
33183318 struct vc4_hdmi * vc4_hdmi = dev_get_drvdata (dev );
33193319 unsigned long __maybe_unused flags ;
33203320 u32 __maybe_unused value ;
3321+ unsigned long rate ;
33213322 int ret ;
33223323
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+
33233333 ret = clk_prepare_enable (vc4_hdmi -> hsm_clock );
33243334 if (ret )
33253335 return ret ;
33263336
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+
33273352 if (vc4_hdmi -> variant -> reset )
33283353 vc4_hdmi -> variant -> reset (vc4_hdmi );
33293354
@@ -3345,6 +3370,10 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
33453370#endif
33463371
33473372 return 0 ;
3373+
3374+ err_disable_clk :
3375+ clk_disable_unprepare (vc4_hdmi -> hsm_clock );
3376+ return ret ;
33483377}
33493378
33503379static void vc4_hdmi_put_ddc_device (void * ptr )
You can’t perform that action at this time.
0 commit comments