drm/exynos/hdmi: workaround to check invalid modes with attached drm bridge
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 7 Sep 2016 01:09:29 +0000 (10:09 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:52:47 +0000 (13:52 +0900)
Currently, there is no way to check valid modes for bridge from
user and if the attached drm bridge, mhl adapter, does not support
a mode with fixup, then it is not possible to be set on exynos-hdmi.
So this patch adds workaround to check invalid modes with attached
drm bridge during mode_valid from exynos-hdmi.

Change-Id: I4dcd7edaa1261c1c3ed349c2dcddec226efcc6ec
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/gpu/drm/exynos/exynos_hdmi.c

index 7e4f321..9f099a0 100644 (file)
@@ -1269,6 +1269,7 @@ static int hdmi_mode_valid(struct drm_connector *connector,
                        struct drm_display_mode *mode)
 {
        struct hdmi_context *hdata = ctx_from_connector(connector);
+       struct drm_display_mode adjusted_mode;
        int ret;
 
        DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n",
@@ -1280,6 +1281,14 @@ static int hdmi_mode_valid(struct drm_connector *connector,
        if (ret < 0)
                return MODE_BAD;
 
+       /*
+        * If attached bridge does not support a mode with fixup, then
+        * it cannot be set, so not valid.
+        */
+       drm_mode_copy(&adjusted_mode, mode);
+       if (!drm_bridge_mode_fixup(hdata->bridge, mode, &adjusted_mode))
+               return MODE_BAD;
+
        return MODE_OK;
 }