diff options
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f84a98f2e37..e2d5f515f7b 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 | } |
1217 | EXPORT_SYMBOL(drm_add_edid_modes); | 1217 | EXPORT_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 | */ | ||
1230 | int 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 | } | ||
1263 | EXPORT_SYMBOL(drm_add_modes_noedid); | ||