drm/sun4i: no picture when connected to a 4k display

Hans Verkuil hverkuil at xs4all.nl
Thu Nov 30 17:14:13 UTC 2017


Hi Maxime, Chen-Yu,

When I connect my cubieboard running 4.15-rc1 to my 4k display I get no picture. Some
digging found that there is no check against the upper pixelclock limit of the HDMI
output, so X selects a 4kp60 format at 594 MHz, which obviously won't work.

I whipped up the quick patch below, but this information about the max support HDMI
frequency should probably come from the device tree. Although for the A10 and A20 I
guess it could also be hardcoded in the source since this code is only used for sun4i.

Anyway, when I use this patch I get a proper 1080p60 picture.

Regards,

	Hans

Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
---
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index dda904ec0534..dc2f550f54ff 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -208,8 +208,17 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector)
 	return ret;
 }

+static int sun4i_hdmi_mode_valid(struct drm_connector *connector,
+				 struct drm_display_mode *mode)
+{
+	if (mode->clock > 170000)
+		return MODE_CLOCK_HIGH;
+	return MODE_OK;
+}
+
 static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = {
 	.get_modes	= sun4i_hdmi_get_modes,
+	.mode_valid	= sun4i_hdmi_mode_valid,
 };

 static enum drm_connector_status


More information about the dri-devel mailing list