Skip to content

Commit 8865dd7

Browse files
committed
Merge tag 'drm-misc-fixes-2022-10-13' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Short summary of fixes pull: * vc4: HDMI fixes Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/Y0gGdlujszCstDeP@linux-uq9g
2 parents 9abf231 + 4190e8b commit 8865dd7

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ module_init(vc4_drm_register);
490490
module_exit(vc4_drm_unregister);
491491

492492
MODULE_ALIAS("platform:vc4-drm");
493+
MODULE_SOFTDEP("pre: snd-soc-hdmi-codec");
493494
MODULE_DESCRIPTION("Broadcom VC4 DRM Driver");
494495
MODULE_AUTHOR("Eric Anholt <[email protected]>");
495496
MODULE_LICENSE("GPL v2");

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff 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

33503379
static void vc4_hdmi_put_ddc_device(void *ptr)

0 commit comments

Comments
 (0)