From 33e8e066af31c3af1d18d615f5e8ab5e528e0000 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Wed, 21 Apr 2021 15:15:42 +0100 Subject: [PATCH] vc4/drm: hdmi: Handle case when bvb clock is null Pi2/3 have no bvb clock but want the other clocks to remain enabled here See: https://github.com/raspberrypi/linux/issues/4299 Signed-off-by: Dom Cobley --- drivers/gpu/drm/vc4/vc4_hdmi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -610,7 +610,8 @@ static void vc4_hdmi_encoder_post_crtc_p HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); - clk_request_done(vc4_hdmi->bvb_req); + if (vc4_hdmi->bvb_req) + clk_request_done(vc4_hdmi->bvb_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->pixel_clock); @@ -935,7 +936,8 @@ static void vc4_hdmi_encoder_pre_crtc_co else bvb_rate = 75000000; - vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate); + if (vc4_hdmi->pixel_bvb_clock) + vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate); if (IS_ERR(vc4_hdmi->bvb_req)) { DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req)); clk_request_done(vc4_hdmi->hsm_req); @@ -947,7 +949,8 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); - clk_request_done(vc4_hdmi->bvb_req); + if (vc4_hdmi->bvb_req) + clk_request_done(vc4_hdmi->bvb_req); clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock);