Commit | Line | Data |
---|---|---|
79e53945 JB |
1 | /* |
2 | * Copyright 2006 Dave Airlie <airlied@linux.ie> | |
3 | * Copyright © 2006-2007 Intel Corporation | |
4 | * | |
5 | * Permission is hereby granted, free of charge, to any person obtaining a | |
6 | * copy of this software and associated documentation files (the "Software"), | |
7 | * to deal in the Software without restriction, including without limitation | |
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
9 | * and/or sell copies of the Software, and to permit persons to whom the | |
10 | * Software is furnished to do so, subject to the following conditions: | |
11 | * | |
12 | * The above copyright notice and this permission notice (including the next | |
13 | * paragraph) shall be included in all copies or substantial portions of the | |
14 | * Software. | |
15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
22 | * DEALINGS IN THE SOFTWARE. | |
23 | * | |
24 | * Authors: | |
25 | * Eric Anholt <eric@anholt.net> | |
26 | */ | |
27 | #include <linux/i2c.h> | |
5a0e3ad6 | 28 | #include <linux/slab.h> |
79e53945 JB |
29 | #include "drmP.h" |
30 | #include "drm.h" | |
31 | #include "drm_crtc.h" | |
32 | #include "intel_drv.h" | |
33 | #include "i915_drm.h" | |
34 | #include "i915_drv.h" | |
35 | #include "dvo.h" | |
36 | ||
37 | #define SIL164_ADDR 0x38 | |
38 | #define CH7xxx_ADDR 0x76 | |
39 | #define TFP410_ADDR 0x38 | |
7434a255 | 40 | #define NS2501_ADDR 0x38 |
79e53945 | 41 | |
ea5b213a | 42 | static const struct intel_dvo_device intel_dvo_devices[] = { |
79e53945 JB |
43 | { |
44 | .type = INTEL_DVO_CHIP_TMDS, | |
45 | .name = "sil164", | |
46 | .dvo_reg = DVOC, | |
47 | .slave_addr = SIL164_ADDR, | |
48 | .dev_ops = &sil164_ops, | |
49 | }, | |
50 | { | |
51 | .type = INTEL_DVO_CHIP_TMDS, | |
52 | .name = "ch7xxx", | |
53 | .dvo_reg = DVOC, | |
54 | .slave_addr = CH7xxx_ADDR, | |
55 | .dev_ops = &ch7xxx_ops, | |
56 | }, | |
57 | { | |
58 | .type = INTEL_DVO_CHIP_LVDS, | |
59 | .name = "ivch", | |
60 | .dvo_reg = DVOA, | |
61 | .slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */ | |
62 | .dev_ops = &ivch_ops, | |
63 | }, | |
64 | { | |
65 | .type = INTEL_DVO_CHIP_TMDS, | |
66 | .name = "tfp410", | |
67 | .dvo_reg = DVOC, | |
68 | .slave_addr = TFP410_ADDR, | |
69 | .dev_ops = &tfp410_ops, | |
70 | }, | |
71 | { | |
72 | .type = INTEL_DVO_CHIP_LVDS, | |
73 | .name = "ch7017", | |
74 | .dvo_reg = DVOC, | |
75 | .slave_addr = 0x75, | |
a6b17b43 | 76 | .gpio = GMBUS_PORT_DPB, |
79e53945 | 77 | .dev_ops = &ch7017_ops, |
7434a255 TR |
78 | }, |
79 | { | |
80 | .type = INTEL_DVO_CHIP_TMDS, | |
81 | .name = "ns2501", | |
82 | .dvo_reg = DVOC, | |
83 | .slave_addr = NS2501_ADDR, | |
84 | .dev_ops = &ns2501_ops, | |
85 | } | |
79e53945 JB |
86 | }; |
87 | ||
ea5b213a CW |
88 | struct intel_dvo { |
89 | struct intel_encoder base; | |
90 | ||
91 | struct intel_dvo_device dev; | |
92 | ||
93 | struct drm_display_mode *panel_fixed_mode; | |
94 | bool panel_wants_dither; | |
95 | }; | |
96 | ||
97 | static struct intel_dvo *enc_to_intel_dvo(struct drm_encoder *encoder) | |
98 | { | |
4ef69c7a | 99 | return container_of(encoder, struct intel_dvo, base.base); |
ea5b213a CW |
100 | } |
101 | ||
df0e9248 CW |
102 | static struct intel_dvo *intel_attached_dvo(struct drm_connector *connector) |
103 | { | |
104 | return container_of(intel_attached_encoder(connector), | |
105 | struct intel_dvo, base); | |
106 | } | |
107 | ||
19c63fa8 DV |
108 | static void intel_disable_dvo(struct intel_encoder *encoder) |
109 | { | |
110 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | |
111 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(&encoder->base); | |
112 | u32 dvo_reg = intel_dvo->dev.dvo_reg; | |
113 | u32 temp = I915_READ(dvo_reg); | |
114 | ||
115 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, false); | |
116 | I915_WRITE(dvo_reg, temp & ~DVO_ENABLE); | |
117 | I915_READ(dvo_reg); | |
118 | } | |
119 | ||
120 | static void intel_enable_dvo(struct intel_encoder *encoder) | |
121 | { | |
122 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | |
123 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(&encoder->base); | |
124 | u32 dvo_reg = intel_dvo->dev.dvo_reg; | |
125 | u32 temp = I915_READ(dvo_reg); | |
126 | ||
127 | I915_WRITE(dvo_reg, temp | DVO_ENABLE); | |
128 | I915_READ(dvo_reg); | |
129 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); | |
130 | } | |
131 | ||
b2cabb0e | 132 | static void intel_dvo_dpms(struct drm_connector *connector, int mode) |
79e53945 | 133 | { |
b2cabb0e DV |
134 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
135 | struct drm_crtc *crtc; | |
136 | ||
137 | /* dvo supports only 2 dpms states. */ | |
138 | if (mode != DRM_MODE_DPMS_ON) | |
139 | mode = DRM_MODE_DPMS_OFF; | |
140 | ||
141 | if (mode == connector->dpms) | |
142 | return; | |
143 | ||
144 | connector->dpms = mode; | |
145 | ||
146 | /* Only need to change hw state when actually enabled */ | |
147 | crtc = intel_dvo->base.base.crtc; | |
148 | if (!crtc) { | |
149 | intel_dvo->base.connectors_active = false; | |
150 | return; | |
151 | } | |
79e53945 JB |
152 | |
153 | if (mode == DRM_MODE_DPMS_ON) { | |
b2cabb0e DV |
154 | intel_dvo->base.connectors_active = true; |
155 | ||
156 | intel_crtc_update_dpms(crtc); | |
157 | ||
fac3274c | 158 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); |
79e53945 | 159 | } else { |
fac3274c | 160 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, false); |
b2cabb0e DV |
161 | |
162 | intel_dvo->base.connectors_active = false; | |
163 | ||
164 | intel_crtc_update_dpms(crtc); | |
79e53945 JB |
165 | } |
166 | } | |
167 | ||
79e53945 JB |
168 | static int intel_dvo_mode_valid(struct drm_connector *connector, |
169 | struct drm_display_mode *mode) | |
170 | { | |
df0e9248 | 171 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
79e53945 JB |
172 | |
173 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | |
174 | return MODE_NO_DBLESCAN; | |
175 | ||
176 | /* XXX: Validate clock range */ | |
177 | ||
ea5b213a CW |
178 | if (intel_dvo->panel_fixed_mode) { |
179 | if (mode->hdisplay > intel_dvo->panel_fixed_mode->hdisplay) | |
79e53945 | 180 | return MODE_PANEL; |
ea5b213a | 181 | if (mode->vdisplay > intel_dvo->panel_fixed_mode->vdisplay) |
79e53945 JB |
182 | return MODE_PANEL; |
183 | } | |
184 | ||
ea5b213a | 185 | return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode); |
79e53945 JB |
186 | } |
187 | ||
188 | static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, | |
e811f5ae | 189 | const struct drm_display_mode *mode, |
79e53945 JB |
190 | struct drm_display_mode *adjusted_mode) |
191 | { | |
ea5b213a | 192 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
79e53945 JB |
193 | |
194 | /* If we have timings from the BIOS for the panel, put them in | |
195 | * to the adjusted mode. The CRTC will be set up for this mode, | |
196 | * with the panel scaling set up to source from the H/VDisplay | |
197 | * of the original mode. | |
198 | */ | |
ea5b213a CW |
199 | if (intel_dvo->panel_fixed_mode != NULL) { |
200 | #define C(x) adjusted_mode->x = intel_dvo->panel_fixed_mode->x | |
79e53945 JB |
201 | C(hdisplay); |
202 | C(hsync_start); | |
203 | C(hsync_end); | |
204 | C(htotal); | |
205 | C(vdisplay); | |
206 | C(vsync_start); | |
207 | C(vsync_end); | |
208 | C(vtotal); | |
209 | C(clock); | |
79e53945 JB |
210 | #undef C |
211 | } | |
212 | ||
ea5b213a CW |
213 | if (intel_dvo->dev.dev_ops->mode_fixup) |
214 | return intel_dvo->dev.dev_ops->mode_fixup(&intel_dvo->dev, mode, adjusted_mode); | |
79e53945 JB |
215 | |
216 | return true; | |
217 | } | |
218 | ||
219 | static void intel_dvo_mode_set(struct drm_encoder *encoder, | |
220 | struct drm_display_mode *mode, | |
221 | struct drm_display_mode *adjusted_mode) | |
222 | { | |
223 | struct drm_device *dev = encoder->dev; | |
224 | struct drm_i915_private *dev_priv = dev->dev_private; | |
225 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); | |
ea5b213a | 226 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
79e53945 JB |
227 | int pipe = intel_crtc->pipe; |
228 | u32 dvo_val; | |
ea5b213a | 229 | u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg; |
9db4a9c7 | 230 | int dpll_reg = DPLL(pipe); |
79e53945 JB |
231 | |
232 | switch (dvo_reg) { | |
233 | case DVOA: | |
234 | default: | |
235 | dvo_srcdim_reg = DVOA_SRCDIM; | |
236 | break; | |
237 | case DVOB: | |
238 | dvo_srcdim_reg = DVOB_SRCDIM; | |
239 | break; | |
240 | case DVOC: | |
241 | dvo_srcdim_reg = DVOC_SRCDIM; | |
242 | break; | |
243 | } | |
244 | ||
ea5b213a | 245 | intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, mode, adjusted_mode); |
79e53945 JB |
246 | |
247 | /* Save the data order, since I don't know what it should be set to. */ | |
248 | dvo_val = I915_READ(dvo_reg) & | |
249 | (DVO_PRESERVE_MASK | DVO_DATA_ORDER_GBRG); | |
250 | dvo_val |= DVO_DATA_ORDER_FP | DVO_BORDER_ENABLE | | |
251 | DVO_BLANK_ACTIVE_HIGH; | |
252 | ||
253 | if (pipe == 1) | |
254 | dvo_val |= DVO_PIPE_B_SELECT; | |
255 | dvo_val |= DVO_PIPE_STALL; | |
256 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | |
257 | dvo_val |= DVO_HSYNC_ACTIVE_HIGH; | |
258 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | |
259 | dvo_val |= DVO_VSYNC_ACTIVE_HIGH; | |
260 | ||
261 | I915_WRITE(dpll_reg, I915_READ(dpll_reg) | DPLL_DVO_HIGH_SPEED); | |
262 | ||
263 | /*I915_WRITE(DVOB_SRCDIM, | |
264 | (adjusted_mode->hdisplay << DVO_SRCDIM_HORIZONTAL_SHIFT) | | |
265 | (adjusted_mode->VDisplay << DVO_SRCDIM_VERTICAL_SHIFT));*/ | |
266 | I915_WRITE(dvo_srcdim_reg, | |
267 | (adjusted_mode->hdisplay << DVO_SRCDIM_HORIZONTAL_SHIFT) | | |
268 | (adjusted_mode->vdisplay << DVO_SRCDIM_VERTICAL_SHIFT)); | |
269 | /*I915_WRITE(DVOB, dvo_val);*/ | |
270 | I915_WRITE(dvo_reg, dvo_val); | |
271 | } | |
272 | ||
273 | /** | |
274 | * Detect the output connection on our DVO device. | |
275 | * | |
276 | * Unimplemented. | |
277 | */ | |
7b334fcb | 278 | static enum drm_connector_status |
930a9e28 | 279 | intel_dvo_detect(struct drm_connector *connector, bool force) |
79e53945 | 280 | { |
df0e9248 | 281 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
ea5b213a | 282 | return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev); |
79e53945 JB |
283 | } |
284 | ||
285 | static int intel_dvo_get_modes(struct drm_connector *connector) | |
286 | { | |
df0e9248 | 287 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
f899fc64 | 288 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
79e53945 JB |
289 | |
290 | /* We should probably have an i2c driver get_modes function for those | |
291 | * devices which will have a fixed set of modes determined by the chip | |
292 | * (TV-out, for example), but for now with just TMDS and LVDS, | |
293 | * that's not the case. | |
294 | */ | |
f899fc64 | 295 | intel_ddc_get_modes(connector, |
3bd7d909 | 296 | intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPC)); |
79e53945 JB |
297 | if (!list_empty(&connector->probed_modes)) |
298 | return 1; | |
299 | ||
ea5b213a | 300 | if (intel_dvo->panel_fixed_mode != NULL) { |
79e53945 | 301 | struct drm_display_mode *mode; |
ea5b213a | 302 | mode = drm_mode_duplicate(connector->dev, intel_dvo->panel_fixed_mode); |
79e53945 JB |
303 | if (mode) { |
304 | drm_mode_probed_add(connector, mode); | |
305 | return 1; | |
306 | } | |
307 | } | |
ea5b213a | 308 | |
79e53945 JB |
309 | return 0; |
310 | } | |
311 | ||
ea5b213a | 312 | static void intel_dvo_destroy(struct drm_connector *connector) |
79e53945 | 313 | { |
79e53945 JB |
314 | drm_sysfs_connector_remove(connector); |
315 | drm_connector_cleanup(connector); | |
599be16c | 316 | kfree(connector); |
79e53945 | 317 | } |
79e53945 JB |
318 | |
319 | static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { | |
79e53945 | 320 | .mode_fixup = intel_dvo_mode_fixup, |
79e53945 | 321 | .mode_set = intel_dvo_mode_set, |
19c63fa8 | 322 | .disable = intel_encoder_disable, |
79e53945 JB |
323 | }; |
324 | ||
325 | static const struct drm_connector_funcs intel_dvo_connector_funcs = { | |
b2cabb0e | 326 | .dpms = intel_dvo_dpms, |
79e53945 JB |
327 | .detect = intel_dvo_detect, |
328 | .destroy = intel_dvo_destroy, | |
329 | .fill_modes = drm_helper_probe_single_connector_modes, | |
330 | }; | |
331 | ||
332 | static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = { | |
333 | .mode_valid = intel_dvo_mode_valid, | |
334 | .get_modes = intel_dvo_get_modes, | |
df0e9248 | 335 | .best_encoder = intel_best_encoder, |
79e53945 JB |
336 | }; |
337 | ||
b358d0a6 | 338 | static void intel_dvo_enc_destroy(struct drm_encoder *encoder) |
79e53945 | 339 | { |
ea5b213a CW |
340 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
341 | ||
342 | if (intel_dvo->dev.dev_ops->destroy) | |
343 | intel_dvo->dev.dev_ops->destroy(&intel_dvo->dev); | |
344 | ||
345 | kfree(intel_dvo->panel_fixed_mode); | |
346 | ||
347 | intel_encoder_destroy(encoder); | |
79e53945 JB |
348 | } |
349 | ||
350 | static const struct drm_encoder_funcs intel_dvo_enc_funcs = { | |
351 | .destroy = intel_dvo_enc_destroy, | |
352 | }; | |
353 | ||
79e53945 JB |
354 | /** |
355 | * Attempts to get a fixed panel timing for LVDS (currently only the i830). | |
356 | * | |
357 | * Other chips with DVO LVDS will need to extend this to deal with the LVDS | |
358 | * chip being on DVOB/C and having multiple pipes. | |
359 | */ | |
360 | static struct drm_display_mode * | |
ea5b213a | 361 | intel_dvo_get_current_mode(struct drm_connector *connector) |
79e53945 JB |
362 | { |
363 | struct drm_device *dev = connector->dev; | |
364 | struct drm_i915_private *dev_priv = dev->dev_private; | |
df0e9248 | 365 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
ea5b213a | 366 | uint32_t dvo_val = I915_READ(intel_dvo->dev.dvo_reg); |
79e53945 JB |
367 | struct drm_display_mode *mode = NULL; |
368 | ||
369 | /* If the DVO port is active, that'll be the LVDS, so we can pull out | |
370 | * its timings to get how the BIOS set up the panel. | |
371 | */ | |
372 | if (dvo_val & DVO_ENABLE) { | |
373 | struct drm_crtc *crtc; | |
374 | int pipe = (dvo_val & DVO_PIPE_B_SELECT) ? 1 : 0; | |
375 | ||
f875c15a | 376 | crtc = intel_get_crtc_for_pipe(dev, pipe); |
79e53945 JB |
377 | if (crtc) { |
378 | mode = intel_crtc_mode_get(dev, crtc); | |
79e53945 JB |
379 | if (mode) { |
380 | mode->type |= DRM_MODE_TYPE_PREFERRED; | |
381 | if (dvo_val & DVO_HSYNC_ACTIVE_HIGH) | |
382 | mode->flags |= DRM_MODE_FLAG_PHSYNC; | |
383 | if (dvo_val & DVO_VSYNC_ACTIVE_HIGH) | |
384 | mode->flags |= DRM_MODE_FLAG_PVSYNC; | |
385 | } | |
386 | } | |
387 | } | |
ea5b213a | 388 | |
79e53945 JB |
389 | return mode; |
390 | } | |
391 | ||
392 | void intel_dvo_init(struct drm_device *dev) | |
393 | { | |
f899fc64 | 394 | struct drm_i915_private *dev_priv = dev->dev_private; |
21d40d37 | 395 | struct intel_encoder *intel_encoder; |
ea5b213a | 396 | struct intel_dvo *intel_dvo; |
599be16c | 397 | struct intel_connector *intel_connector; |
79e53945 | 398 | int i; |
79e53945 | 399 | int encoder_type = DRM_MODE_ENCODER_NONE; |
ea5b213a CW |
400 | |
401 | intel_dvo = kzalloc(sizeof(struct intel_dvo), GFP_KERNEL); | |
402 | if (!intel_dvo) | |
79e53945 JB |
403 | return; |
404 | ||
599be16c ZW |
405 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
406 | if (!intel_connector) { | |
ea5b213a | 407 | kfree(intel_dvo); |
599be16c ZW |
408 | return; |
409 | } | |
410 | ||
ea5b213a | 411 | intel_encoder = &intel_dvo->base; |
373a3cf7 CW |
412 | drm_encoder_init(dev, &intel_encoder->base, |
413 | &intel_dvo_enc_funcs, encoder_type); | |
ea5b213a | 414 | |
19c63fa8 DV |
415 | intel_encoder->disable = intel_disable_dvo; |
416 | intel_encoder->enable = intel_enable_dvo; | |
417 | ||
79e53945 JB |
418 | /* Now, try to find a controller */ |
419 | for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { | |
599be16c | 420 | struct drm_connector *connector = &intel_connector->base; |
ea5b213a | 421 | const struct intel_dvo_device *dvo = &intel_dvo_devices[i]; |
f899fc64 | 422 | struct i2c_adapter *i2c; |
79e53945 JB |
423 | int gpio; |
424 | ||
79e53945 JB |
425 | /* Allow the I2C driver info to specify the GPIO to be used in |
426 | * special cases, but otherwise default to what's defined | |
427 | * in the spec. | |
428 | */ | |
3bd7d909 | 429 | if (intel_gmbus_is_port_valid(dvo->gpio)) |
79e53945 JB |
430 | gpio = dvo->gpio; |
431 | else if (dvo->type == INTEL_DVO_CHIP_LVDS) | |
f573c660 | 432 | gpio = GMBUS_PORT_SSC; |
79e53945 | 433 | else |
a6b17b43 | 434 | gpio = GMBUS_PORT_DPB; |
79e53945 JB |
435 | |
436 | /* Set up the I2C bus necessary for the chip we're probing. | |
437 | * It appears that everything is on GPIOE except for panels | |
438 | * on i830 laptops, which are on GPIOB (DVOA). | |
439 | */ | |
3bd7d909 | 440 | i2c = intel_gmbus_get_adapter(dev_priv, gpio); |
79e53945 | 441 | |
ea5b213a | 442 | intel_dvo->dev = *dvo; |
f573c660 | 443 | if (!dvo->dev_ops->init(&intel_dvo->dev, i2c)) |
79e53945 JB |
444 | continue; |
445 | ||
21d40d37 EA |
446 | intel_encoder->type = INTEL_OUTPUT_DVO; |
447 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); | |
79e53945 JB |
448 | switch (dvo->type) { |
449 | case INTEL_DVO_CHIP_TMDS: | |
66a9278e | 450 | intel_encoder->cloneable = true; |
79e53945 JB |
451 | drm_connector_init(dev, connector, |
452 | &intel_dvo_connector_funcs, | |
453 | DRM_MODE_CONNECTOR_DVII); | |
454 | encoder_type = DRM_MODE_ENCODER_TMDS; | |
455 | break; | |
456 | case INTEL_DVO_CHIP_LVDS: | |
66a9278e | 457 | intel_encoder->cloneable = false; |
79e53945 JB |
458 | drm_connector_init(dev, connector, |
459 | &intel_dvo_connector_funcs, | |
460 | DRM_MODE_CONNECTOR_LVDS); | |
461 | encoder_type = DRM_MODE_ENCODER_LVDS; | |
462 | break; | |
463 | } | |
464 | ||
465 | drm_connector_helper_add(connector, | |
466 | &intel_dvo_connector_helper_funcs); | |
467 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | |
468 | connector->interlace_allowed = false; | |
469 | connector->doublescan_allowed = false; | |
470 | ||
4ef69c7a | 471 | drm_encoder_helper_add(&intel_encoder->base, |
79e53945 JB |
472 | &intel_dvo_helper_funcs); |
473 | ||
df0e9248 | 474 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
79e53945 JB |
475 | if (dvo->type == INTEL_DVO_CHIP_LVDS) { |
476 | /* For our LVDS chipsets, we should hopefully be able | |
477 | * to dig the fixed panel mode out of the BIOS data. | |
478 | * However, it's in a different format from the BIOS | |
479 | * data on chipsets with integrated LVDS (stored in AIM | |
480 | * headers, likely), so for now, just get the current | |
481 | * mode being output through DVO. | |
482 | */ | |
ea5b213a | 483 | intel_dvo->panel_fixed_mode = |
79e53945 | 484 | intel_dvo_get_current_mode(connector); |
ea5b213a | 485 | intel_dvo->panel_wants_dither = true; |
79e53945 JB |
486 | } |
487 | ||
488 | drm_sysfs_connector_add(connector); | |
489 | return; | |
490 | } | |
491 | ||
373a3cf7 | 492 | drm_encoder_cleanup(&intel_encoder->base); |
ea5b213a | 493 | kfree(intel_dvo); |
599be16c | 494 | kfree(intel_connector); |
79e53945 | 495 | } |