2 * Copyright © 2006-2007 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 * Eric Anholt <eric@anholt.net>
27 #include <linux/dmi.h>
28 #include <linux/i2c.h>
29 #include <linux/slab.h>
33 #include "drm_crtc_helper.h"
35 #include "intel_drv.h"
39 /* Here's the desired hotplug mode */
40 #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \
41 ADPA_CRT_HOTPLUG_WARMUP_10MS | \
42 ADPA_CRT_HOTPLUG_SAMPLE_4S | \
43 ADPA_CRT_HOTPLUG_VOLTAGE_50 | \
44 ADPA_CRT_HOTPLUG_VOLREF_325MV | \
45 ADPA_CRT_HOTPLUG_ENABLE)
48 struct intel_encoder base
;
49 bool force_hotplug_required
;
52 static struct intel_crt
*intel_attached_crt(struct drm_connector
*connector
)
54 return container_of(intel_attached_encoder(connector
),
55 struct intel_crt
, base
);
58 static void pch_crt_dpms(struct drm_encoder
*encoder
, int mode
)
60 struct drm_device
*dev
= encoder
->dev
;
61 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
64 temp
= I915_READ(PCH_ADPA
);
65 temp
&= ~ADPA_DAC_ENABLE
;
68 case DRM_MODE_DPMS_ON
:
69 temp
|= ADPA_DAC_ENABLE
;
71 case DRM_MODE_DPMS_STANDBY
:
72 case DRM_MODE_DPMS_SUSPEND
:
73 case DRM_MODE_DPMS_OFF
:
74 /* Just leave port enable cleared */
78 I915_WRITE(PCH_ADPA
, temp
);
81 static void gmch_crt_dpms(struct drm_encoder
*encoder
, int mode
)
83 struct drm_device
*dev
= encoder
->dev
;
84 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
87 temp
= I915_READ(ADPA
);
88 temp
&= ~(ADPA_HSYNC_CNTL_DISABLE
| ADPA_VSYNC_CNTL_DISABLE
);
89 temp
&= ~ADPA_DAC_ENABLE
;
91 if (IS_VALLEYVIEW(dev
) && mode
!= DRM_MODE_DPMS_ON
)
92 mode
= DRM_MODE_DPMS_OFF
;
95 case DRM_MODE_DPMS_ON
:
96 temp
|= ADPA_DAC_ENABLE
;
98 case DRM_MODE_DPMS_STANDBY
:
99 temp
|= ADPA_DAC_ENABLE
| ADPA_HSYNC_CNTL_DISABLE
;
101 case DRM_MODE_DPMS_SUSPEND
:
102 temp
|= ADPA_DAC_ENABLE
| ADPA_VSYNC_CNTL_DISABLE
;
104 case DRM_MODE_DPMS_OFF
:
105 temp
|= ADPA_HSYNC_CNTL_DISABLE
| ADPA_VSYNC_CNTL_DISABLE
;
109 I915_WRITE(ADPA
, temp
);
112 static int intel_crt_mode_valid(struct drm_connector
*connector
,
113 struct drm_display_mode
*mode
)
115 struct drm_device
*dev
= connector
->dev
;
118 if (mode
->flags
& DRM_MODE_FLAG_DBLSCAN
)
119 return MODE_NO_DBLESCAN
;
121 if (mode
->clock
< 25000)
122 return MODE_CLOCK_LOW
;
128 if (mode
->clock
> max_clock
)
129 return MODE_CLOCK_HIGH
;
134 static bool intel_crt_mode_fixup(struct drm_encoder
*encoder
,
135 const struct drm_display_mode
*mode
,
136 struct drm_display_mode
*adjusted_mode
)
141 static void intel_crt_mode_set(struct drm_encoder
*encoder
,
142 struct drm_display_mode
*mode
,
143 struct drm_display_mode
*adjusted_mode
)
146 struct drm_device
*dev
= encoder
->dev
;
147 struct drm_crtc
*crtc
= encoder
->crtc
;
148 struct intel_crtc
*intel_crtc
= to_intel_crtc(crtc
);
149 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
154 dpll_md_reg
= DPLL_MD(intel_crtc
->pipe
);
156 if (HAS_PCH_SPLIT(dev
))
162 * Disable separate mode multiplier used when cloning SDVO to CRT
163 * XXX this needs to be adjusted when we really are cloning
165 if (INTEL_INFO(dev
)->gen
>= 4 && !HAS_PCH_SPLIT(dev
)) {
166 dpll_md
= I915_READ(dpll_md_reg
);
167 I915_WRITE(dpll_md_reg
,
168 dpll_md
& ~DPLL_MD_UDI_MULTIPLIER_MASK
);
171 adpa
= ADPA_HOTPLUG_BITS
;
172 if (adjusted_mode
->flags
& DRM_MODE_FLAG_PHSYNC
)
173 adpa
|= ADPA_HSYNC_ACTIVE_HIGH
;
174 if (adjusted_mode
->flags
& DRM_MODE_FLAG_PVSYNC
)
175 adpa
|= ADPA_VSYNC_ACTIVE_HIGH
;
177 /* For CPT allow 3 pipe config, for others just use A or B */
178 if (HAS_PCH_CPT(dev
))
179 adpa
|= PORT_TRANS_SEL_CPT(intel_crtc
->pipe
);
180 else if (intel_crtc
->pipe
== 0)
181 adpa
|= ADPA_PIPE_A_SELECT
;
183 adpa
|= ADPA_PIPE_B_SELECT
;
185 if (!HAS_PCH_SPLIT(dev
))
186 I915_WRITE(BCLRPAT(intel_crtc
->pipe
), 0);
188 I915_WRITE(adpa_reg
, adpa
);
191 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector
*connector
)
193 struct drm_device
*dev
= connector
->dev
;
194 struct intel_crt
*crt
= intel_attached_crt(connector
);
195 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
199 /* The first time through, trigger an explicit detection cycle */
200 if (crt
->force_hotplug_required
) {
201 bool turn_off_dac
= HAS_PCH_SPLIT(dev
);
204 crt
->force_hotplug_required
= 0;
206 save_adpa
= adpa
= I915_READ(PCH_ADPA
);
207 DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa
);
209 adpa
|= ADPA_CRT_HOTPLUG_FORCE_TRIGGER
;
211 adpa
&= ~ADPA_DAC_ENABLE
;
213 I915_WRITE(PCH_ADPA
, adpa
);
215 if (wait_for((I915_READ(PCH_ADPA
) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER
) == 0,
217 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
220 I915_WRITE(PCH_ADPA
, save_adpa
);
221 POSTING_READ(PCH_ADPA
);
225 /* Check the status to see if both blue and green are on now */
226 adpa
= I915_READ(PCH_ADPA
);
227 if ((adpa
& ADPA_CRT_HOTPLUG_MONITOR_MASK
) != 0)
231 DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa
, ret
);
236 static bool valleyview_crt_detect_hotplug(struct drm_connector
*connector
)
238 struct drm_device
*dev
= connector
->dev
;
239 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
244 save_adpa
= adpa
= I915_READ(ADPA
);
245 DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa
);
247 adpa
|= ADPA_CRT_HOTPLUG_FORCE_TRIGGER
;
249 I915_WRITE(ADPA
, adpa
);
251 if (wait_for((I915_READ(ADPA
) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER
) == 0,
253 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
254 I915_WRITE(ADPA
, save_adpa
);
257 /* Check the status to see if both blue and green are on now */
258 adpa
= I915_READ(ADPA
);
259 if ((adpa
& ADPA_CRT_HOTPLUG_MONITOR_MASK
) != 0)
264 DRM_DEBUG_KMS("valleyview hotplug adpa=0x%x, result %d\n", adpa
, ret
);
266 /* FIXME: debug force function and remove */
273 * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
275 * Not for i915G/i915GM
277 * \return true if CRT is connected.
278 * \return false if CRT is disconnected.
280 static bool intel_crt_detect_hotplug(struct drm_connector
*connector
)
282 struct drm_device
*dev
= connector
->dev
;
283 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
284 u32 hotplug_en
, orig
, stat
;
288 if (HAS_PCH_SPLIT(dev
))
289 return intel_ironlake_crt_detect_hotplug(connector
);
291 if (IS_VALLEYVIEW(dev
))
292 return valleyview_crt_detect_hotplug(connector
);
295 * On 4 series desktop, CRT detect sequence need to be done twice
296 * to get a reliable result.
299 if (IS_G4X(dev
) && !IS_GM45(dev
))
303 hotplug_en
= orig
= I915_READ(PORT_HOTPLUG_EN
);
304 hotplug_en
|= CRT_HOTPLUG_FORCE_DETECT
;
306 for (i
= 0; i
< tries
; i
++) {
307 /* turn on the FORCE_DETECT */
308 I915_WRITE(PORT_HOTPLUG_EN
, hotplug_en
);
309 /* wait for FORCE_DETECT to go off */
310 if (wait_for((I915_READ(PORT_HOTPLUG_EN
) &
311 CRT_HOTPLUG_FORCE_DETECT
) == 0,
313 DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off");
316 stat
= I915_READ(PORT_HOTPLUG_STAT
);
317 if ((stat
& CRT_HOTPLUG_MONITOR_MASK
) != CRT_HOTPLUG_MONITOR_NONE
)
320 /* clear the interrupt we just generated, if any */
321 I915_WRITE(PORT_HOTPLUG_STAT
, CRT_HOTPLUG_INT_STATUS
);
323 /* and put the bits back */
324 I915_WRITE(PORT_HOTPLUG_EN
, orig
);
329 static struct edid
*intel_crt_get_edid(struct drm_connector
*connector
,
330 struct i2c_adapter
*i2c
)
334 edid
= drm_get_edid(connector
, i2c
);
336 if (!edid
&& !intel_gmbus_is_forced_bit(i2c
)) {
337 DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n");
338 intel_gmbus_force_bit(i2c
, true);
339 edid
= drm_get_edid(connector
, i2c
);
340 intel_gmbus_force_bit(i2c
, false);
346 /* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */
347 static int intel_crt_ddc_get_modes(struct drm_connector
*connector
,
348 struct i2c_adapter
*adapter
)
352 edid
= intel_crt_get_edid(connector
, adapter
);
356 return intel_connector_update_modes(connector
, edid
);
359 static bool intel_crt_detect_ddc(struct drm_connector
*connector
)
361 struct intel_crt
*crt
= intel_attached_crt(connector
);
362 struct drm_i915_private
*dev_priv
= crt
->base
.base
.dev
->dev_private
;
364 struct i2c_adapter
*i2c
;
366 BUG_ON(crt
->base
.type
!= INTEL_OUTPUT_ANALOG
);
368 i2c
= intel_gmbus_get_adapter(dev_priv
, dev_priv
->crt_ddc_pin
);
369 edid
= intel_crt_get_edid(connector
, i2c
);
372 bool is_digital
= edid
->input
& DRM_EDID_INPUT_DIGITAL
;
375 * This may be a DVI-I connector with a shared DDC
376 * link between analog and digital outputs, so we
377 * have to check the EDID input spec of the attached device.
380 DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
384 DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
386 DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n");
394 static enum drm_connector_status
395 intel_crt_load_detect(struct intel_crt
*crt
)
397 struct drm_device
*dev
= crt
->base
.base
.dev
;
398 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
399 uint32_t pipe
= to_intel_crtc(crt
->base
.base
.crtc
)->pipe
;
400 uint32_t save_bclrpat
;
401 uint32_t save_vtotal
;
402 uint32_t vtotal
, vactive
;
404 uint32_t vblank
, vblank_start
, vblank_end
;
406 uint32_t bclrpat_reg
;
410 uint32_t pipeconf_reg
;
411 uint32_t pipe_dsl_reg
;
413 enum drm_connector_status status
;
415 DRM_DEBUG_KMS("starting load-detect on CRT\n");
417 bclrpat_reg
= BCLRPAT(pipe
);
418 vtotal_reg
= VTOTAL(pipe
);
419 vblank_reg
= VBLANK(pipe
);
420 vsync_reg
= VSYNC(pipe
);
421 pipeconf_reg
= PIPECONF(pipe
);
422 pipe_dsl_reg
= PIPEDSL(pipe
);
424 save_bclrpat
= I915_READ(bclrpat_reg
);
425 save_vtotal
= I915_READ(vtotal_reg
);
426 vblank
= I915_READ(vblank_reg
);
428 vtotal
= ((save_vtotal
>> 16) & 0xfff) + 1;
429 vactive
= (save_vtotal
& 0x7ff) + 1;
431 vblank_start
= (vblank
& 0xfff) + 1;
432 vblank_end
= ((vblank
>> 16) & 0xfff) + 1;
434 /* Set the border color to purple. */
435 I915_WRITE(bclrpat_reg
, 0x500050);
438 uint32_t pipeconf
= I915_READ(pipeconf_reg
);
439 I915_WRITE(pipeconf_reg
, pipeconf
| PIPECONF_FORCE_BORDER
);
440 POSTING_READ(pipeconf_reg
);
441 /* Wait for next Vblank to substitue
442 * border color for Color info */
443 intel_wait_for_vblank(dev
, pipe
);
444 st00
= I915_READ8(VGA_MSR_WRITE
);
445 status
= ((st00
& (1 << 4)) != 0) ?
446 connector_status_connected
:
447 connector_status_disconnected
;
449 I915_WRITE(pipeconf_reg
, pipeconf
);
451 bool restore_vblank
= false;
455 * If there isn't any border, add some.
456 * Yes, this will flicker
458 if (vblank_start
<= vactive
&& vblank_end
>= vtotal
) {
459 uint32_t vsync
= I915_READ(vsync_reg
);
460 uint32_t vsync_start
= (vsync
& 0xffff) + 1;
462 vblank_start
= vsync_start
;
463 I915_WRITE(vblank_reg
,
465 ((vblank_end
- 1) << 16));
466 restore_vblank
= true;
468 /* sample in the vertical border, selecting the larger one */
469 if (vblank_start
- vactive
>= vtotal
- vblank_end
)
470 vsample
= (vblank_start
+ vactive
) >> 1;
472 vsample
= (vtotal
+ vblank_end
) >> 1;
475 * Wait for the border to be displayed
477 while (I915_READ(pipe_dsl_reg
) >= vactive
)
479 while ((dsl
= I915_READ(pipe_dsl_reg
)) <= vsample
)
482 * Watch ST00 for an entire scanline
488 /* Read the ST00 VGA status register */
489 st00
= I915_READ8(VGA_MSR_WRITE
);
492 } while ((I915_READ(pipe_dsl_reg
) == dsl
));
494 /* restore vblank if necessary */
496 I915_WRITE(vblank_reg
, vblank
);
498 * If more than 3/4 of the scanline detected a monitor,
499 * then it is assumed to be present. This works even on i830,
500 * where there isn't any way to force the border color across
503 status
= detect
* 4 > count
* 3 ?
504 connector_status_connected
:
505 connector_status_disconnected
;
508 /* Restore previous settings */
509 I915_WRITE(bclrpat_reg
, save_bclrpat
);
514 static enum drm_connector_status
515 intel_crt_detect(struct drm_connector
*connector
, bool force
)
517 struct drm_device
*dev
= connector
->dev
;
518 struct intel_crt
*crt
= intel_attached_crt(connector
);
519 enum drm_connector_status status
;
520 struct intel_load_detect_pipe tmp
;
522 if (I915_HAS_HOTPLUG(dev
)) {
523 /* We can not rely on the HPD pin always being correctly wired
524 * up, for example many KVM do not pass it through, and so
525 * only trust an assertion that the monitor is connected.
527 if (intel_crt_detect_hotplug(connector
)) {
528 DRM_DEBUG_KMS("CRT detected via hotplug\n");
529 return connector_status_connected
;
531 DRM_DEBUG_KMS("CRT not detected via hotplug\n");
534 if (intel_crt_detect_ddc(connector
))
535 return connector_status_connected
;
537 /* Load detection is broken on HPD capable machines. Whoever wants a
538 * broken monitor (without edid) to work behind a broken kvm (that fails
539 * to have the right resistors for HP detection) needs to fix this up.
540 * For now just bail out. */
541 if (I915_HAS_HOTPLUG(dev
))
542 return connector_status_disconnected
;
545 return connector
->status
;
547 /* for pre-945g platforms use load detect */
548 if (intel_get_load_detect_pipe(&crt
->base
, connector
, NULL
,
550 if (intel_crt_detect_ddc(connector
))
551 status
= connector_status_connected
;
553 status
= intel_crt_load_detect(crt
);
554 intel_release_load_detect_pipe(&crt
->base
, connector
,
557 status
= connector_status_unknown
;
562 static void intel_crt_destroy(struct drm_connector
*connector
)
564 drm_sysfs_connector_remove(connector
);
565 drm_connector_cleanup(connector
);
569 static int intel_crt_get_modes(struct drm_connector
*connector
)
571 struct drm_device
*dev
= connector
->dev
;
572 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
574 struct i2c_adapter
*i2c
;
576 i2c
= intel_gmbus_get_adapter(dev_priv
, dev_priv
->crt_ddc_pin
);
577 ret
= intel_crt_ddc_get_modes(connector
, i2c
);
578 if (ret
|| !IS_G4X(dev
))
581 /* Try to probe digital port for output in DVI-I -> VGA mode. */
582 i2c
= intel_gmbus_get_adapter(dev_priv
, GMBUS_PORT_DPB
);
583 return intel_crt_ddc_get_modes(connector
, i2c
);
586 static int intel_crt_set_property(struct drm_connector
*connector
,
587 struct drm_property
*property
,
593 static void intel_crt_reset(struct drm_connector
*connector
)
595 struct drm_device
*dev
= connector
->dev
;
596 struct intel_crt
*crt
= intel_attached_crt(connector
);
598 if (HAS_PCH_SPLIT(dev
))
599 crt
->force_hotplug_required
= 1;
603 * Routines for controlling stuff on the analog port
606 static const struct drm_encoder_helper_funcs pch_encoder_funcs
= {
607 .mode_fixup
= intel_crt_mode_fixup
,
608 .prepare
= intel_encoder_prepare
,
609 .commit
= intel_encoder_commit
,
610 .mode_set
= intel_crt_mode_set
,
611 .dpms
= pch_crt_dpms
,
614 static const struct drm_encoder_helper_funcs gmch_encoder_funcs
= {
615 .mode_fixup
= intel_crt_mode_fixup
,
616 .prepare
= intel_encoder_prepare
,
617 .commit
= intel_encoder_commit
,
618 .mode_set
= intel_crt_mode_set
,
619 .dpms
= gmch_crt_dpms
,
622 static const struct drm_connector_funcs intel_crt_connector_funcs
= {
623 .reset
= intel_crt_reset
,
624 .dpms
= drm_helper_connector_dpms
,
625 .detect
= intel_crt_detect
,
626 .fill_modes
= drm_helper_probe_single_connector_modes
,
627 .destroy
= intel_crt_destroy
,
628 .set_property
= intel_crt_set_property
,
631 static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs
= {
632 .mode_valid
= intel_crt_mode_valid
,
633 .get_modes
= intel_crt_get_modes
,
634 .best_encoder
= intel_best_encoder
,
637 static const struct drm_encoder_funcs intel_crt_enc_funcs
= {
638 .destroy
= intel_encoder_destroy
,
641 static int __init
intel_no_crt_dmi_callback(const struct dmi_system_id
*id
)
643 DRM_INFO("Skipping CRT initialization for %s\n", id
->ident
);
647 static const struct dmi_system_id intel_no_crt
[] = {
649 .callback
= intel_no_crt_dmi_callback
,
652 DMI_MATCH(DMI_SYS_VENDOR
, "ACER"),
653 DMI_MATCH(DMI_PRODUCT_NAME
, "ZGB"),
659 void intel_crt_init(struct drm_device
*dev
)
661 struct drm_connector
*connector
;
662 struct intel_crt
*crt
;
663 struct intel_connector
*intel_connector
;
664 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
665 const struct drm_encoder_helper_funcs
*encoder_helper_funcs
;
667 /* Skip machines without VGA that falsely report hotplug events */
668 if (dmi_check_system(intel_no_crt
))
671 crt
= kzalloc(sizeof(struct intel_crt
), GFP_KERNEL
);
675 intel_connector
= kzalloc(sizeof(struct intel_connector
), GFP_KERNEL
);
676 if (!intel_connector
) {
681 connector
= &intel_connector
->base
;
682 drm_connector_init(dev
, &intel_connector
->base
,
683 &intel_crt_connector_funcs
, DRM_MODE_CONNECTOR_VGA
);
685 drm_encoder_init(dev
, &crt
->base
.base
, &intel_crt_enc_funcs
,
686 DRM_MODE_ENCODER_DAC
);
688 intel_connector_attach_encoder(intel_connector
, &crt
->base
);
690 crt
->base
.type
= INTEL_OUTPUT_ANALOG
;
691 crt
->base
.clone_mask
= (1 << INTEL_SDVO_NON_TV_CLONE_BIT
|
692 1 << INTEL_ANALOG_CLONE_BIT
|
693 1 << INTEL_SDVO_LVDS_CLONE_BIT
);
695 crt
->base
.crtc_mask
= (1 << 0);
697 crt
->base
.crtc_mask
= (1 << 0) | (1 << 1);
700 connector
->interlace_allowed
= 0;
702 connector
->interlace_allowed
= 1;
703 connector
->doublescan_allowed
= 0;
705 if (HAS_PCH_SPLIT(dev
))
706 encoder_helper_funcs
= &pch_encoder_funcs
;
708 encoder_helper_funcs
= &gmch_encoder_funcs
;
710 drm_encoder_helper_add(&crt
->base
.base
, encoder_helper_funcs
);
711 drm_connector_helper_add(connector
, &intel_crt_connector_helper_funcs
);
713 drm_sysfs_connector_add(connector
);
715 if (I915_HAS_HOTPLUG(dev
))
716 connector
->polled
= DRM_CONNECTOR_POLL_HPD
;
718 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
721 * Configure the automatic hotplug detection stuff
723 crt
->force_hotplug_required
= 0;
724 if (HAS_PCH_SPLIT(dev
)) {
727 adpa
= I915_READ(PCH_ADPA
);
728 adpa
&= ~ADPA_CRT_HOTPLUG_MASK
;
729 adpa
|= ADPA_HOTPLUG_BITS
;
730 I915_WRITE(PCH_ADPA
, adpa
);
731 POSTING_READ(PCH_ADPA
);
733 DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa
);
734 crt
->force_hotplug_required
= 1;
737 dev_priv
->hotplug_supported_mask
|= CRT_HOTPLUG_INT_STATUS
;