drm/edid: output common tv resolution and hdmi mode if no read the correct edid

Change-Id: Ib7379340e8c1d59382553d21b60165fe5fb371e8
Signed-off-by: xuhuicong <xhc@rock-chips.com>
This commit is contained in:
xuhuicong 2017-09-26 17:32:56 +08:00 committed by Tao Huang
commit 7ab28c3914
3 changed files with 23 additions and 3 deletions

View file

@ -2527,7 +2527,9 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
struct hdr_static_metadata *metedata =
&connector->hdr_sink_metadata.hdmi_type1;
struct edid *edid;
int ret = 0;
struct drm_display_mode *mode;
const u8 def_modes[6] = {4, 16, 31, 19, 17, 2};
int i, ret = 0;
if (!hdmi->ddc)
return 0;
@ -2545,7 +2547,20 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
drm_mode_connector_update_hdr_property(connector, metedata);
kfree(edid);
} else {
dev_dbg(hdmi->dev, "failed to get edid\n");
hdmi->sink_is_hdmi = true;
hdmi->sink_has_audio = true;
for (i = 0; i < sizeof(def_modes); i++) {
mode = drm_display_mode_from_vic_index(connector,
def_modes,
31, i);
if (mode) {
if (!i)
mode->type = DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
ret++;
}
}
dev_info(hdmi->dev, "failed to get edid\n");
}
return ret;

View file

@ -3258,7 +3258,7 @@ static u8 svd_to_vic(u8 svd)
return svd;
}
static struct drm_display_mode *
struct drm_display_mode *
drm_display_mode_from_vic_index(struct drm_connector *connector,
const u8 *video_db, u8 video_len,
u8 video_index)
@ -3283,6 +3283,7 @@ drm_display_mode_from_vic_index(struct drm_connector *connector,
return newmode;
}
EXPORT_SYMBOL(drm_display_mode_from_vic_index);
/*
* do_y420vdb_modes - Parse YCBCR 420 only modes

View file

@ -495,4 +495,8 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name,
struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
int hsize, int vsize, int fresh,
bool rb);
struct drm_display_mode *
drm_display_mode_from_vic_index(struct drm_connector *connector,
const u8 *video_db, u8 video_len,
u8 video_index);
#endif /* __DRM_EDID_H__ */