From 149d37051e0b5672d21128128fde4a08402c931e Mon Sep 17 00:00:00 2001 From: John Stultz Date: Thu, 31 Mar 2016 00:35:00 -0700 Subject: HACK: hdmi: Restrict HDMI output modes to known good hikey mode clocks Currently the hikey dsi logic cannot generate accurate byte clocks values for all pixel clock values. Thus if a mode clock is selected that cannot match the calculated byte clock, the device will boot with a blank screen. This patch enforces known good mode clocks for well known resolutions, which should allow the display to work from given EDID options, and ensures for a given resolution & refresh, the right mode clock is selected. 4.1 had similar logic, but keyed off off resolution & refresh, rather then resolution & mode clock (and thus 4.1 could select bad clock values for a given refresh rate). Change-Id: I19403f4ba08d8ef75fdddcf36754698f8e93c894 Suggested-by: Xinliang Liu Signed-off-by: John Stultz --- drivers/gpu/drm/i2c/adv7511.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c index 0b134d764adc..6b80bfc266fa 100644 --- a/drivers/gpu/drm/i2c/adv7511.c +++ b/drivers/gpu/drm/i2c/adv7511.c @@ -733,12 +733,28 @@ adv7511_detect(struct adv7511 *adv7511, } static int adv7511_mode_valid(struct adv7511 *adv7511, - const struct drm_display_mode *mode) + struct drm_display_mode *mode) { if (mode->clock > 165000) return MODE_CLOCK_HIGH; - - return MODE_OK; + /* + * some work well modes which want to put in the front of the mode list. + */ + DRM_DEBUG("Checking mode %ix%i@%i clock: %i...", + mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), mode->clock); + if ((mode->hdisplay == 1920 && mode->vdisplay == 1080 && mode->clock == 148500) || + (mode->hdisplay == 1280 && mode->vdisplay == 800 && mode->clock == 83496) || + (mode->hdisplay == 1280 && mode->vdisplay == 720 && mode->clock == 74440) || + (mode->hdisplay == 1280 && mode->vdisplay == 720 && mode->clock == 74250) || + (mode->hdisplay == 1024 && mode->vdisplay == 768 && mode->clock == 75000) || + (mode->hdisplay == 1024 && mode->vdisplay == 768 && mode->clock == 81833) || + (mode->hdisplay == 800 && mode->vdisplay == 600 && mode->clock == 40000)) { + mode->type |= DRM_MODE_TYPE_PREFERRED; + DRM_DEBUG("OK\n"); + return MODE_OK; + } + DRM_DEBUG("BAD\n"); + return MODE_BAD; } static void adv7511_mode_set(struct adv7511 *adv7511, -- cgit v1.2.3