-
Notifications
You must be signed in to change notification settings - Fork 1
/
linux.diff
243 lines (233 loc) · 8.34 KB
/
linux.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -154,6 +154,67 @@ static struct edid_quirk {
};
/*
+ * Arcade modelines
+ *
+ */
+static struct drm_display_mode drm_c15khz_modes[] = {
+ /* [email protected] 15.660 Khz */
+ { DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 6640, 320, 336,
+ 368, 424, 0, 240, 242, 245, 261, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
+ /* [email protected] 15.750 Khz */
+ { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 13104, 640, 664,
+ 728, 832, 0, 480, 484, 490, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+ /* [email protected] 15.7369 Khz */
+ { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 14856, 720, 752,
+ 824, 944, 0, 480, 484, 490, 525, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+ /* 768x576 15.6250 Khz */
+ { DRM_MODE("768x576", DRM_MODE_TYPE_DRIVER, 15625, 768, 800,
+ 872, 1000, 0, 576, 582, 588, 625, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+ /* [email protected] 15.725 Khz */
+ { DRM_MODE("800x576", DRM_MODE_TYPE_DRIVER, 16354, 800, 832,
+ 912, 1040, 0, 576, 584, 590, 629, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+ /* 1024@[email protected] 16.300 Khz */
+ { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 21386, 1024, 1072,
+ 1168, 1312, 0, 768, 774, 780, 815, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+};
+static const int drm_num_c15khz_modes =
+ sizeof(drm_c15khz_modes) / sizeof(struct drm_display_mode);
+
+static struct drm_display_mode drm_c25khz_modes[] = {
+ /* [email protected] 24.960 Khz */
+ { DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 10782, 320, 352,
+ 384, 432, 0, 240, 318, 322, 416, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
+ /* [email protected] 24.960 Khz */
+ { DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 16972, 512, 560,
+ 608, 680, 0, 384, 395, 399, 426, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
+ /* [email protected] 24.990 Khz */
+ { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 26989, 800, 880,
+ 960, 1080, 0, 600, 697, 705, 833, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+ /* [email protected] 24.975 Khz */
+ { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 34165, 1024, 1120,
+ 1216, 1368, 0, 768, 864, 872, 999, 0,
+ DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
+ DRM_MODE_FLAG_INTERLACE) },
+};
+static const int drm_num_c25khz_modes =
+ sizeof(drm_c25khz_modes) / sizeof(struct drm_display_mode);
+
+/*
* Autogenerated from the DMT spec.
* This table is copied from xfree86/modes/xf86EdidModes.c.
*/
@@ -1580,6 +1641,46 @@ mode_is_rb(const struct drm_display_mode *mode)
(mode->vsync_start - mode->vdisplay == 3);
}
+struct drm_display_mode *drm_mode_find_c15khz(struct drm_device *dev,
+ int hsize, int vsize, int fresh)
+{
+ int i;
+
+ for (i = 0; i < drm_num_c15khz_modes; i++) {
+ const struct drm_display_mode *ptr = &drm_c15khz_modes[i];
+ if (hsize != ptr->hdisplay)
+ continue;
+ if (vsize != ptr->vdisplay)
+ continue;
+ if ((fresh != 0) && (fresh != drm_mode_vrefresh(ptr)))
+ continue;
+
+ return drm_mode_duplicate(dev, ptr);
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(drm_mode_find_c15khz);
+
+struct drm_display_mode *drm_mode_find_c25khz(struct drm_device *dev,
+ int hsize, int vsize, int fresh)
+{
+ int i;
+
+ for (i = 0; i < drm_num_c25khz_modes; i++) {
+ const struct drm_display_mode *ptr = &drm_c25khz_modes[i];
+ if (hsize != ptr->hdisplay)
+ continue;
+ if (vsize != ptr->vdisplay)
+ continue;
+ if ((fresh != 0) && (fresh != drm_mode_vrefresh(ptr)))
+ continue;
+
+ return drm_mode_duplicate(dev, ptr);
+ }
+ return NULL;
+}
+EXPORT_SYMBOL(drm_mode_find_c25khz);
+
/*
* drm_mode_find_dmt - Create a copy of a mode if present in DMT
* @dev: Device to duplicate against
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1771,6 +1771,34 @@ struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_connector *f
if (cmdline_mode->rb || cmdline_mode->margins)
goto create_mode;
+ if (cmdline_mode->c15khz) {
+ mode = drm_mode_find_c15khz(fb_helper_conn->connector->dev,
+ cmdline_mode->xres,
+ cmdline_mode->yres,
+ (cmdline_mode->refresh_specified) ?
+ cmdline_mode->refresh : 0);
+
+ if (mode) {
+ drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+ list_add(&mode->head, &fb_helper_conn->connector->modes);
+ return mode;
+ }
+ }
+
+ if (cmdline_mode->c25khz) {
+ mode = drm_mode_find_c25khz(fb_helper_conn->connector->dev,
+ cmdline_mode->xres,
+ cmdline_mode->yres,
+ (cmdline_mode->refresh_specified) ?
+ cmdline_mode->refresh : 0);
+
+ if (mode) {
+ drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+ list_add(&mode->head, &fb_helper_conn->connector->modes);
+ return mode;
+ }
+ }
+
prefer_non_interlace = !cmdline_mode->interlace;
again:
list_for_each_entry(mode, &fb_helper_conn->connector->modes, head) {
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1312,6 +1312,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
bool interlace = false, margins = false, was_digit = false;
int i;
enum drm_connector_force force = DRM_FORCE_UNSPECIFIED;
+ int c15khz = 0;
+ int c25khz = 0;
#ifdef CONFIG_FB
if (!mode_option)
@@ -1401,6 +1403,14 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
force = DRM_FORCE_OFF;
break;
+ case 'c':
+ c15khz = 1;
+ c25khz = 0;
+ break;
+ case 'z':
+ c15khz = 0;
+ c25khz = 1;
+ break;
default:
goto done;
}
@@ -1445,6 +1455,10 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
mode->interlace = interlace;
mode->margins = margins;
mode->force = force;
+ mode->c15khz = c15khz ? true : false;
+ connector->c15khz = mode->c15khz;
+ mode->c25khz = c25khz ? true : false;
+ connector->c25khz = mode->c25khz;
return true;
}
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -305,6 +305,12 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connect
goto prune;
}
+ if (connector->c15khz)
+ goto prune;
+
+ if (connector->c25khz)
+ goto prune;
+
if (connector->override_edid) {
struct edid *edid = (struct edid *) connector->edid_blob_ptr->data;
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -548,6 +548,8 @@ struct drm_cmdline_mode {
bool cvt;
bool margins;
enum drm_connector_force force;
+ bool c15khz;
+ bool c25khz;
};
/**
@@ -759,6 +761,12 @@ struct drm_connector {
uint8_t num_h_tile, num_v_tile;
uint8_t tile_h_loc, tile_v_loc;
uint16_t tile_h_size, tile_v_size;
+
+ /* 15KHz output */
+ bool c15khz;
+
+ /* 25KHz output */
+ bool c25khz;
};
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -472,6 +472,10 @@ int drm_edid_header_is_valid(const u8 *raw_edid);
bool drm_edid_is_valid(struct edid *edid);
void drm_edid_get_monitor_name(struct edid *edid, char *name,
int buflen);
+struct drm_display_mode *drm_mode_find_c15khz(struct drm_device *dev,
+ int hsize, int vsize, int fresh);
+struct drm_display_mode *drm_mode_find_c25khz(struct drm_device *dev,
+ int hsize, int vsize, int fresh);
struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
int hsize, int vsize, int fresh,
bool rb);