Skip to content

Commit 0614a49

Browse files
mripardpopcornmix
authored andcommitted
drm/vc4: hdmi: Properly compute the BVB clock rate
The BVB clock rate computation doesn't take into account a mode clock of 594MHz that we're going to need to support 4k60. Acked-by: Thomas Zimmermann <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Maxime Ripard <[email protected]>
1 parent a3d06ae commit 0614a49

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
# define VC4_HD_M_ENABLE BIT(0)
9797

9898
#define CEC_CLOCK_FREQ 40000
99-
#define VC4_HSM_MID_CLOCK 149985000
10099

101100
#define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000)
102101

@@ -1233,7 +1232,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
12331232
conn_state_to_vc4_hdmi_conn_state(conn_state);
12341233
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
12351234
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
1236-
unsigned long pixel_rate, hsm_rate;
1235+
unsigned long bvb_rate, pixel_rate, hsm_rate;
12371236
int ret;
12381237

12391238
ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
@@ -1280,12 +1279,14 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
12801279

12811280
vc4_hdmi_cec_update_clk_div(vc4_hdmi);
12821281

1283-
/*
1284-
* FIXME: When the pixel freq is 594MHz (4k60), this needs to be setup
1285-
* at 300MHz.
1286-
*/
1287-
vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock,
1288-
(hsm_rate > VC4_HSM_MID_CLOCK ? 150000000 : 75000000));
1282+
if (pixel_rate > 297000000)
1283+
bvb_rate = 300000000;
1284+
else if (pixel_rate > 148500000)
1285+
bvb_rate = 150000000;
1286+
else
1287+
bvb_rate = 75000000;
1288+
1289+
vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate);
12891290
if (IS_ERR(vc4_hdmi->bvb_req)) {
12901291
DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req));
12911292
clk_request_done(vc4_hdmi->hsm_req);

0 commit comments

Comments
 (0)