aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_edid.c19
-rw-r--r--drivers/gpu/drm/drm_edid_modes.h4
-rw-r--r--drivers/gpu/drm/drm_modes.c6
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv17_tv.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv17_tv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nv17_tv_modes.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c5
-rw-r--r--include/drm/drm_crtc.h6
9 files changed, 27 insertions, 23 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index a245d17165ae..af60d9be9632 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -449,12 +449,11 @@ static void edid_fixup_preferred(struct drm_connector *connector,
449struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 449struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
450 int hsize, int vsize, int fresh) 450 int hsize, int vsize, int fresh)
451{ 451{
452 struct drm_display_mode *mode = NULL;
452 int i; 453 int i;
453 struct drm_display_mode *ptr, *mode;
454 454
455 mode = NULL;
456 for (i = 0; i < drm_num_dmt_modes; i++) { 455 for (i = 0; i < drm_num_dmt_modes; i++) {
457 ptr = &drm_dmt_modes[i]; 456 const struct drm_display_mode *ptr = &drm_dmt_modes[i];
458 if (hsize == ptr->hdisplay && 457 if (hsize == ptr->hdisplay &&
459 vsize == ptr->vdisplay && 458 vsize == ptr->vdisplay &&
460 fresh == drm_mode_vrefresh(ptr)) { 459 fresh == drm_mode_vrefresh(ptr)) {
@@ -885,7 +884,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
885} 884}
886 885
887static bool 886static bool
888mode_is_rb(struct drm_display_mode *mode) 887mode_is_rb(const struct drm_display_mode *mode)
889{ 888{
890 return (mode->htotal - mode->hdisplay == 160) && 889 return (mode->htotal - mode->hdisplay == 160) &&
891 (mode->hsync_end - mode->hdisplay == 80) && 890 (mode->hsync_end - mode->hdisplay == 80) &&
@@ -894,7 +893,8 @@ mode_is_rb(struct drm_display_mode *mode)
894} 893}
895 894
896static bool 895static bool
897mode_in_hsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t) 896mode_in_hsync_range(const struct drm_display_mode *mode,
897 struct edid *edid, u8 *t)
898{ 898{
899 int hsync, hmin, hmax; 899 int hsync, hmin, hmax;
900 900
@@ -910,7 +910,8 @@ mode_in_hsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t)
910} 910}
911 911
912static bool 912static bool
913mode_in_vsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t) 913mode_in_vsync_range(const struct drm_display_mode *mode,
914 struct edid *edid, u8 *t)
914{ 915{
915 int vsync, vmin, vmax; 916 int vsync, vmin, vmax;
916 917
@@ -941,7 +942,7 @@ range_pixel_clock(struct edid *edid, u8 *t)
941} 942}
942 943
943static bool 944static bool
944mode_in_range(struct drm_display_mode *mode, struct edid *edid, 945mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
945 struct detailed_timing *timing) 946 struct detailed_timing *timing)
946{ 947{
947 u32 max_clock; 948 u32 max_clock;
@@ -1472,7 +1473,7 @@ int drm_add_modes_noedid(struct drm_connector *connector,
1472 int hdisplay, int vdisplay) 1473 int hdisplay, int vdisplay)
1473{ 1474{
1474 int i, count, num_modes = 0; 1475 int i, count, num_modes = 0;
1475 struct drm_display_mode *mode, *ptr; 1476 struct drm_display_mode *mode;
1476 struct drm_device *dev = connector->dev; 1477 struct drm_device *dev = connector->dev;
1477 1478
1478 count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); 1479 count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
@@ -1482,7 +1483,7 @@ int drm_add_modes_noedid(struct drm_connector *connector,
1482 vdisplay = 0; 1483 vdisplay = 0;
1483 1484
1484 for (i = 0; i < count; i++) { 1485 for (i = 0; i < count; i++) {
1485 ptr = &drm_dmt_modes[i]; 1486 const struct drm_display_mode *ptr = &drm_dmt_modes[i];
1486 if (hdisplay && vdisplay) { 1487 if (hdisplay && vdisplay) {
1487 /* 1488 /*
1488 * Only when two are valid, they will be used to check 1489 * Only when two are valid, they will be used to check
diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h
index 6eb7592e152f..5f2064489fd5 100644
--- a/drivers/gpu/drm/drm_edid_modes.h
+++ b/drivers/gpu/drm/drm_edid_modes.h
@@ -32,7 +32,7 @@
32 * This table is copied from xfree86/modes/xf86EdidModes.c. 32 * This table is copied from xfree86/modes/xf86EdidModes.c.
33 * But the mode with Reduced blank feature is deleted. 33 * But the mode with Reduced blank feature is deleted.
34 */ 34 */
35static struct drm_display_mode drm_dmt_modes[] = { 35static const struct drm_display_mode drm_dmt_modes[] = {
36 /* 640x350@85Hz */ 36 /* 640x350@85Hz */
37 { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672, 37 { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672,
38 736, 832, 0, 350, 382, 385, 445, 0, 38 736, 832, 0, 350, 382, 385, 445, 0,
@@ -266,7 +266,7 @@ static struct drm_display_mode drm_dmt_modes[] = {
266static const int drm_num_dmt_modes = 266static const int drm_num_dmt_modes =
267 sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); 267 sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
268 268
269static struct drm_display_mode edid_est_modes[] = { 269static const struct drm_display_mode edid_est_modes[] = {
270 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840, 270 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840,
271 968, 1056, 0, 600, 601, 605, 628, 0, 271 968, 1056, 0, 600, 601, 605, 628, 0,
272 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@60Hz */ 272 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@60Hz */
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 58e65f92c232..25bf87390f53 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -593,7 +593,7 @@ EXPORT_SYMBOL(drm_mode_height);
593 * 593 *
594 * Return @modes's hsync rate in kHz, rounded to the nearest int. 594 * Return @modes's hsync rate in kHz, rounded to the nearest int.
595 */ 595 */
596int drm_mode_hsync(struct drm_display_mode *mode) 596int drm_mode_hsync(const struct drm_display_mode *mode)
597{ 597{
598 unsigned int calc_val; 598 unsigned int calc_val;
599 599
@@ -627,7 +627,7 @@ EXPORT_SYMBOL(drm_mode_hsync);
627 * If it is 70.288, it will return 70Hz. 627 * If it is 70.288, it will return 70Hz.
628 * If it is 59.6, it will return 60Hz. 628 * If it is 59.6, it will return 60Hz.
629 */ 629 */
630int drm_mode_vrefresh(struct drm_display_mode *mode) 630int drm_mode_vrefresh(const struct drm_display_mode *mode)
631{ 631{
632 int refresh = 0; 632 int refresh = 0;
633 unsigned int calc_val; 633 unsigned int calc_val;
@@ -725,7 +725,7 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
725 * a pointer to it. Used to create new instances of established modes. 725 * a pointer to it. Used to create new instances of established modes.
726 */ 726 */
727struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 727struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
728 struct drm_display_mode *mode) 728 const struct drm_display_mode *mode)
729{ 729{
730 struct drm_display_mode *nmode; 730 struct drm_display_mode *nmode;
731 int new_id; 731 int new_id;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 6a09c1413d60..318f398e6b2e 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1460,7 +1460,7 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1460 * Note! This is in reply order (see loop in get_tv_modes). 1460 * Note! This is in reply order (see loop in get_tv_modes).
1461 * XXX: all 60Hz refresh? 1461 * XXX: all 60Hz refresh?
1462 */ 1462 */
1463struct drm_display_mode sdvo_tv_modes[] = { 1463static const struct drm_display_mode sdvo_tv_modes[] = {
1464 { DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 5815, 320, 321, 384, 1464 { DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 5815, 320, 321, 384,
1465 416, 0, 200, 201, 232, 233, 0, 1465 416, 0, 200, 201, 232, 233, 0,
1466 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 1466 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c
index 28119fd19d03..3900cebba560 100644
--- a/drivers/gpu/drm/nouveau/nv17_tv.c
+++ b/drivers/gpu/drm/nouveau/nv17_tv.c
@@ -197,10 +197,12 @@ static int nv17_tv_get_ld_modes(struct drm_encoder *encoder,
197 struct drm_connector *connector) 197 struct drm_connector *connector)
198{ 198{
199 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); 199 struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder);
200 struct drm_display_mode *mode, *tv_mode; 200 const struct drm_display_mode *tv_mode;
201 int n = 0; 201 int n = 0;
202 202
203 for (tv_mode = nv17_tv_modes; tv_mode->hdisplay; tv_mode++) { 203 for (tv_mode = nv17_tv_modes; tv_mode->hdisplay; tv_mode++) {
204 struct drm_display_mode *mode;
205
204 mode = drm_mode_duplicate(encoder->dev, tv_mode); 206 mode = drm_mode_duplicate(encoder->dev, tv_mode);
205 207
206 mode->clock = tv_norm->tv_enc_mode.vrefresh * 208 mode->clock = tv_norm->tv_enc_mode.vrefresh *
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.h b/drivers/gpu/drm/nouveau/nv17_tv.h
index 6bf03840f9eb..622e72221682 100644
--- a/drivers/gpu/drm/nouveau/nv17_tv.h
+++ b/drivers/gpu/drm/nouveau/nv17_tv.h
@@ -112,7 +112,7 @@ extern struct nv17_tv_norm_params {
112} nv17_tv_norms[NUM_TV_NORMS]; 112} nv17_tv_norms[NUM_TV_NORMS];
113#define get_tv_norm(enc) (&nv17_tv_norms[to_tv_enc(enc)->tv_norm]) 113#define get_tv_norm(enc) (&nv17_tv_norms[to_tv_enc(enc)->tv_norm])
114 114
115extern struct drm_display_mode nv17_tv_modes[]; 115extern const struct drm_display_mode nv17_tv_modes[];
116 116
117static inline int interpolate(int y0, int y1, int y2, int x) 117static inline int interpolate(int y0, int y1, int y2, int x)
118{ 118{
diff --git a/drivers/gpu/drm/nouveau/nv17_tv_modes.c b/drivers/gpu/drm/nouveau/nv17_tv_modes.c
index 9d3893c50a41..4d1d29f60307 100644
--- a/drivers/gpu/drm/nouveau/nv17_tv_modes.c
+++ b/drivers/gpu/drm/nouveau/nv17_tv_modes.c
@@ -438,7 +438,7 @@ void nv17_tv_state_load(struct drm_device *dev, struct nv17_tv_state *state)
438 438
439/* Timings similar to the ones the blob sets */ 439/* Timings similar to the ones the blob sets */
440 440
441struct drm_display_mode nv17_tv_modes[] = { 441const struct drm_display_mode nv17_tv_modes[] = {
442 { DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 0, 442 { DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 0,
443 320, 344, 392, 560, 0, 200, 200, 202, 220, 0, 443 320, 344, 392, 560, 0, 200, 200, 202, 220, 0,
444 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC 444 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
index 29113c9b26a8..b3a2cd5118d7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
@@ -345,7 +345,7 @@ static enum drm_connector_status
345 return connector_status_disconnected; 345 return connector_status_disconnected;
346} 346}
347 347
348static struct drm_display_mode vmw_ldu_connector_builtin[] = { 348static const struct drm_display_mode vmw_ldu_connector_builtin[] = {
349 /* 640x480@60Hz */ 349 /* 640x480@60Hz */
350 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, 350 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656,
351 752, 800, 0, 480, 489, 492, 525, 0, 351 752, 800, 0, 480, 489, 492, 525, 0,
@@ -429,7 +429,6 @@ static int vmw_ldu_connector_fill_modes(struct drm_connector *connector,
429 struct drm_device *dev = connector->dev; 429 struct drm_device *dev = connector->dev;
430 struct vmw_private *dev_priv = vmw_priv(dev); 430 struct vmw_private *dev_priv = vmw_priv(dev);
431 struct drm_display_mode *mode = NULL; 431 struct drm_display_mode *mode = NULL;
432 struct drm_display_mode *bmode;
433 struct drm_display_mode prefmode = { DRM_MODE("preferred", 432 struct drm_display_mode prefmode = { DRM_MODE("preferred",
434 DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, 433 DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
435 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 434 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -459,6 +458,8 @@ static int vmw_ldu_connector_fill_modes(struct drm_connector *connector,
459 } 458 }
460 459
461 for (i = 0; vmw_ldu_connector_builtin[i].type != 0; i++) { 460 for (i = 0; vmw_ldu_connector_builtin[i].type != 0; i++) {
461 const struct drm_display_mode *bmode;
462
462 bmode = &vmw_ldu_connector_builtin[i]; 463 bmode = &vmw_ldu_connector_builtin[i];
463 if (bmode->hdisplay > max_width || 464 if (bmode->hdisplay > max_width ||
464 bmode->vdisplay > max_height) 465 bmode->vdisplay > max_height)
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 080a6e33470e..60edf9be31e5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -659,7 +659,7 @@ extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid
659extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 659extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
660extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 660extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
661extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 661extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
662 struct drm_display_mode *mode); 662 const struct drm_display_mode *mode);
663extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 663extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
664extern void drm_mode_config_init(struct drm_device *dev); 664extern void drm_mode_config_init(struct drm_device *dev);
665extern void drm_mode_config_reset(struct drm_device *dev); 665extern void drm_mode_config_reset(struct drm_device *dev);
@@ -685,8 +685,8 @@ extern void drm_mode_validate_size(struct drm_device *dev,
685extern void drm_mode_prune_invalid(struct drm_device *dev, 685extern void drm_mode_prune_invalid(struct drm_device *dev,
686 struct list_head *mode_list, bool verbose); 686 struct list_head *mode_list, bool verbose);
687extern void drm_mode_sort(struct list_head *mode_list); 687extern void drm_mode_sort(struct list_head *mode_list);
688extern int drm_mode_hsync(struct drm_display_mode *mode); 688extern int drm_mode_hsync(const struct drm_display_mode *mode);
689extern int drm_mode_vrefresh(struct drm_display_mode *mode); 689extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
690extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, 690extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
691 int adjust_flags); 691 int adjust_flags);
692extern void drm_mode_connector_list_update(struct drm_connector *connector); 692extern void drm_mode_connector_list_update(struct drm_connector *connector);