aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2009-09-02 21:33:48 -0400
committerDave Airlie <airlied@redhat.com>2009-09-07 04:44:40 -0400
commitf0fda0a47b26aba986fe65897891956c1792b526 (patch)
treec3f53a5653179b51625f5f7962bae89f30282691
parent559ee21d261a54c42594ef9405d27e9008eedf44 (diff)
drm/kms: add a function that can add the mode for the output device without EDID
Add a function that can be used to add the default mode for the output device without EDID. It will add the default mode that meets with the requirements of given hdisplay/vdisplay limit. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_edid.c46
-rw-r--r--include/drm/drm_crtc.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index f84a98f2e373..e2d5f515f7b2 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1215,3 +1215,49 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
1215 return num_modes; 1215 return num_modes;
1216} 1216}
1217EXPORT_SYMBOL(drm_add_edid_modes); 1217EXPORT_SYMBOL(drm_add_edid_modes);
1218
1219/**
1220 * drm_add_modes_noedid - add modes for the connectors without EDID
1221 * @connector: connector we're probing
1222 * @hdisplay: the horizontal display limit
1223 * @vdisplay: the vertical display limit
1224 *
1225 * Add the specified modes to the connector's mode list. Only when the
1226 * hdisplay/vdisplay is not beyond the given limit, it will be added.
1227 *
1228 * Return number of modes added or 0 if we couldn't find any.
1229 */
1230int drm_add_modes_noedid(struct drm_connector *connector,
1231 int hdisplay, int vdisplay)
1232{
1233 int i, count, num_modes = 0;
1234 struct drm_display_mode *mode, *ptr;
1235 struct drm_device *dev = connector->dev;
1236
1237 count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
1238 if (hdisplay < 0)
1239 hdisplay = 0;
1240 if (vdisplay < 0)
1241 vdisplay = 0;
1242
1243 for (i = 0; i < count; i++) {
1244 ptr = &drm_dmt_modes[i];
1245 if (hdisplay && vdisplay) {
1246 /*
1247 * Only when two are valid, they will be used to check
1248 * whether the mode should be added to the mode list of
1249 * the connector.
1250 */
1251 if (ptr->hdisplay > hdisplay ||
1252 ptr->vdisplay > vdisplay)
1253 continue;
1254 }
1255 mode = drm_mode_duplicate(dev, ptr);
1256 if (mode) {
1257 drm_mode_probed_add(connector, mode);
1258 num_modes++;
1259 }
1260 }
1261 return num_modes;
1262}
1263EXPORT_SYMBOL(drm_add_modes_noedid);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index b0427a70fcbd..ae1e9e166959 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -750,4 +750,6 @@ extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
750extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev, 750extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
751 int hdisplay, int vdisplay, int vrefresh, 751 int hdisplay, int vdisplay, int vrefresh,
752 bool interlaced, int margins); 752 bool interlaced, int margins);
753extern int drm_add_modes_noedid(struct drm_connector *connector,
754 int hdisplay, int vdisplay);
753#endif /* __DRM_CRTC_H__ */ 755#endif /* __DRM_CRTC_H__ */