HDMI: just list common format when edid is not valid.
authorZheng Yang <zhengyang@rock-chips.com>
Thu, 21 May 2015 02:26:34 +0000 (10:26 +0800)
committerZheng Yang <zhengyang@rock-chips.com>
Thu, 21 May 2015 02:26:34 +0000 (10:26 +0800)
If EDID is not valid, list following common format:
1920x1080p-60
1920x1080p-50
1280x720p-60
1280x720p-50
720px576p-50
720px480p-60

Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

index d737a852ae132700b15f808250da88e170cf812f..25f938f0c4b03594206b4be97b2bac07699915ff 100644 (file)
@@ -528,7 +528,7 @@ int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok)
        struct list_head *head = &hdmi->edid.modelist;
        struct fb_monspecs *specs = hdmi->edid.specs;
        struct fb_videomode *modedb = NULL, *mode = NULL;
-       int i, pixclock;
+       int i, pixclock, feature = hdmi->property->feature;
 
        if (edid_ok != HDMI_ERROR_SUCESS) {
                dev_err(hdmi->dev, "warning: EDID error, assume sink as HDMI !!!!");
@@ -580,12 +580,30 @@ int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok)
                                    (mode->yres > modedb->yres))
                                        continue;
                        } else {
-                               if (!(hdmi->property->feature & SUPPORT_4K) &&
-                                   mode->xres >= 3840)
-                                       continue;
-                               else if (mode->pixclock > 340000000)
+                               /* If there is no valid information in EDID,
+                                  just list common hdmi foramt. */
+                               if (mode->xres > 3840 ||
+                                   mode->refresh < 50 ||
+                                   mode->vmode == FB_VMODE_INTERLACED)
                                        continue;
                        }
+                       if ((feature & SUPPORT_TMDS_600M) == 0 &&
+                           mode->pixclock > 340000000)
+                               continue;
+                       if ((feature & SUPPORT_4K) == 0 &&
+                           mode->xres >= 3840)
+                               continue;
+                       if ((feature & SUPPORT_4K_4096) == 0 &&
+                           mode->xres == 4096)
+                               continue;
+                       if ((feature & SUPPORT_1080I) == 0 &&
+                           mode->xres == 1920 &&
+                           mode->vmode == FB_VMODE_INTERLACED)
+                               continue;
+                       if ((feature & SUPPORT_480I_576I) == 0 &&
+                           mode->xres == 720 &&
+                           mode->vmode == FB_VMODE_INTERLACED)
+                               continue;
                        hdmi_add_videomode(mode, head);
                }
        } else {