Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32e823c6 authored by Eric Anholt's avatar Eric Anholt
Browse files

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 <pbrobinson@redhat.com>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20170920225935.14566-1-eric@anholt.net
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v1)
parent 2e2b96ef
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -693,7 +693,22 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
	}
}

static enum drm_mode_status
vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc,
			    const struct drm_display_mode *mode)
{
	/* HSM clock must be 108% of the pixel clock.  Additionally,
	 * the AXI clock needs to be at least 25% of pixel clock, but
	 * HSM ends up being the limiting factor.
	 */
	if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100))
		return MODE_CLOCK_HIGH;

	return MODE_OK;
}

static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = {
	.mode_valid = vc4_hdmi_encoder_mode_valid,
	.disable = vc4_hdmi_encoder_disable,
	.enable = vc4_hdmi_encoder_enable,
};