Skip to content

Commit 32e823c

Browse files
committed
drm/vc4: Reject HDMI modes with too high of clocks.
Peter Robinson reported issues on Fedora with 4k monitors not having their modes filtered down to 1920x1080 on Raspberry Pi. v2: Fix vc5 typo in place of vc4. Cc: Peter Robinson <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Acked-by: Daniel Vetter <[email protected]> (v1)
1 parent 2e2b96e commit 32e823c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,22 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
693693
}
694694
}
695695

696+
static enum drm_mode_status
697+
vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc,
698+
const struct drm_display_mode *mode)
699+
{
700+
/* HSM clock must be 108% of the pixel clock. Additionally,
701+
* the AXI clock needs to be at least 25% of pixel clock, but
702+
* HSM ends up being the limiting factor.
703+
*/
704+
if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100))
705+
return MODE_CLOCK_HIGH;
706+
707+
return MODE_OK;
708+
}
709+
696710
static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = {
711+
.mode_valid = vc4_hdmi_encoder_mode_valid,
697712
.disable = vc4_hdmi_encoder_disable,
698713
.enable = vc4_hdmi_encoder_enable,
699714
};

0 commit comments

Comments
 (0)