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>
31 #include <drm/drm_crtc.h>
32 #include <drm/drm_crtc_helper.h>
33 #include <drm/drm_edid.h>
34 #include "intel_drv.h"
35 #include <drm/i915_drm.h>
38 /* Here's the desired hotplug mode */
39 #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \
40 ADPA_CRT_HOTPLUG_WARMUP_10MS | \
41 ADPA_CRT_HOTPLUG_SAMPLE_4S | \
42 ADPA_CRT_HOTPLUG_VOLTAGE_50 | \
43 ADPA_CRT_HOTPLUG_VOLREF_325MV | \
44 ADPA_CRT_HOTPLUG_ENABLE)
47 struct intel_encoder base
;
48 bool force_hotplug_required
;
51 static struct intel_crt
*intel_attached_crt(struct drm_connector
*connector
)
53 return container_of(intel_attached_encoder(connector
),
54 struct intel_crt
, base
);
57 static void pch_crt_dpms(struct drm_encoder
*encoder
, int mode
)
59 struct drm_device
*dev
= encoder
->dev
;
60 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
63 temp
= I915_READ(PCH_ADPA
);
64 temp
&= ~ADPA_DAC_ENABLE
;
67 case DRM_MODE_DPMS_ON
:
68 temp
|= ADPA_DAC_ENABLE
;
70 case DRM_MODE_DPMS_STANDBY
:
71 case DRM_MODE_DPMS_SUSPEND
:
72 case DRM_MODE_DPMS_OFF
:
73 /* Just leave port enable cleared */
77 I915_WRITE(PCH_ADPA
, temp
);
80 static void gmch_crt_dpms(struct drm_encoder
*encoder
, int mode
)
82 struct drm_device
*dev
= encoder
->dev
;
83 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
86 temp
= I915_READ(ADPA
);
87 temp
&= ~(ADPA_HSYNC_CNTL_DISABLE
| ADPA_VSYNC_CNTL_DISABLE
);
88 temp
&= ~ADPA_DAC_ENABLE
;
90 if (IS_VALLEYVIEW(dev
) && mode
!= DRM_MODE_DPMS_ON
)
91 mode
= DRM_MODE_DPMS_OFF
;
94 case DRM_MODE_DPMS_ON
:
95 temp
|= ADPA_DAC_ENABLE
;
97 case DRM_MODE_DPMS_STANDBY
:
98 temp
|= ADPA_DAC_ENABLE
| ADPA_HSYNC_CNTL_DISABLE
;
100 case DRM_MODE_DPMS_SUSPEND
:
101 temp
|= ADPA_DAC_ENABLE
| ADPA_VSYNC_CNTL_DISABLE
;
103 case DRM_MODE_DPMS_OFF
:
104 temp
|= ADPA_HSYNC_CNTL_DISABLE
| ADPA_VSYNC_CNTL_DISABLE
;
108 I915_WRITE(ADPA
, temp
);
111 static int intel_crt_mode_valid(struct drm_connector
*connector
,
112 struct drm_display_mode
*mode
)
114 struct drm_device
*dev
= connector
->dev
;
117 if (mode
->flags
& DRM_MODE_FLAG_DBLSCAN
)
118 return MODE_NO_DBLESCAN
;
120 if (mode
->clock
< 25000)
121 return MODE_CLOCK_LOW
;
127 if (mode
->clock
> max_clock
)
128 return MODE_CLOCK_HIGH
;
133 static bool intel_crt_mode_fixup(struct drm_encoder
*encoder
,
134 const struct drm_display_mode
*mode
,
135 struct drm_display_mode
*adjusted_mode
)
140 static void intel_crt_mode_set(struct drm_encoder
*encoder
,
141 struct drm_display_mode
*mode
,
142 struct drm_display_mode
*adjusted_mode
)
145 struct drm_device
*dev
= encoder
->dev
;
146 struct drm_crtc
*crtc
= encoder
->crtc
;
147 struct intel_crtc
*intel_crtc
= to_intel_crtc(crtc
);
148 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
153 dpll_md_reg
= DPLL_MD(intel_crtc
->pipe
);
155 if (HAS_PCH_SPLIT(dev
))
161 * Disable separate mode multiplier used when cloning SDVO to CRT
162 * XXX this needs to be adjusted when we really are cloning
164 if (INTEL_INFO(dev
)->gen
>= 4 && !HAS_PCH_SPLIT(dev
)) {
165 dpll_md
= I915_READ(dpll_md_reg
);
166 I915_WRITE(dpll_md_reg
,
167 dpll_md
& ~DPLL_MD_UDI_MULTIPLIER_MASK
);
170 adpa
= ADPA_HOTPLUG_BITS
;
171 if (adjusted_mode
->flags
& DRM_MODE_FLAG_PHSYNC
)
172 adpa
|= ADPA_HSYNC_ACTIVE_HIGH
;
173 if (adjusted_mode
->flags
& DRM_MODE_FLAG_PVSYNC
)
174 adpa
|= ADPA_VSYNC_ACTIVE_HIGH
;
176 /* For CPT allow 3 pipe config, for others just use A or B */
177 if (HAS_PCH_CPT(dev
))
178 adpa
|= PORT_TRANS_SEL_CPT(intel_crtc
->pipe
);
179 else if (intel_crtc
->pipe
== 0)
180 adpa
|= ADPA_PIPE_A_SELECT
;
182 adpa
|= ADPA_PIPE_B_SELECT
;
184 if (!HAS_PCH_SPLIT(dev
))
185 I915_WRITE(BCLRPAT(intel_crtc
->pipe
), 0);
187 I915_WRITE(adpa_reg
, adpa
);
190 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector
*connector
)
192 struct drm_device
*dev
= connector
->dev
;
193 struct intel_crt
*crt
= intel_attached_crt(connector
);
194 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
198 /* The first time through, trigger an explicit detection cycle */
199 if (crt
->force_hotplug_required
) {
200 bool turn_off_dac
= HAS_PCH_SPLIT(dev
);
203 crt
->force_hotplug_required
= 0;
205 save_adpa
= adpa
= I915_READ(PCH_ADPA
);
206 DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa
);
208 adpa
|= ADPA_CRT_HOTPLUG_FORCE_TRIGGER
;
210 adpa
&= ~ADPA_DAC_ENABLE
;
212 I915_WRITE(PCH_ADPA
, adpa
);
214 if (wait_for((I915_READ(PCH_ADPA
) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER
) == 0,
216 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
219 I915_WRITE(PCH_ADPA
, save_adpa
);
220 POSTING_READ(PCH_ADPA
);
224 /* Check the status to see if both blue and green are on now */
225 adpa
= I915_READ(PCH_ADPA
);
226 if ((adpa
& ADPA_CRT_HOTPLUG_MONITOR_MASK
) != 0)
230 DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa
, ret
);
235 static bool valleyview_crt_detect_hotplug(struct drm_connector
*connector
)
237 struct drm_device
*dev
= connector
->dev
;
238 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
243 save_adpa
= adpa
= I915_READ(ADPA
);
244 DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa
);
246 adpa
|= ADPA_CRT_HOTPLUG_FORCE_TRIGGER
;
248 I915_WRITE(ADPA
, adpa
);
250 if (wait_for((I915_READ(ADPA
) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER
) == 0,
252 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
253 I915_WRITE(ADPA
, save_adpa
);
256 /* Check the status to see if both blue and green are on now */
257 adpa
= I915_READ(ADPA
);
258 if ((adpa
& ADPA_CRT_HOTPLUG_MONITOR_MASK
) != 0)
263 DRM_DEBUG_KMS("valleyview hotplug adpa=0x%x, result %d\n", adpa
, ret
);
265 /* FIXME: debug force function and remove */
272 * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
274 * Not for i915G/i915GM
276 * \return true if CRT is connected.
277 * \return false if CRT is disconnected.
279 static bool intel_crt_detect_hotplug(struct drm_connector
*connector
)
281 struct drm_device
*dev
= connector
->dev
;
282 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
283 u32 hotplug_en
, orig
, stat
;
287 if (HAS_PCH_SPLIT(dev
))
288 return intel_ironlake_crt_detect_hotplug(connector
);
290 if (IS_VALLEYVIEW(dev
))
291 return valleyview_crt_detect_hotplug(connector
);
294 * On 4 series desktop, CRT detect sequence need to be done twice
295 * to get a reliable result.
298 if (IS_G4X(dev
) && !IS_GM45(dev
))
302 hotplug_en
= orig
= I915_READ(PORT_HOTPLUG_EN
);
303 hotplug_en
|= CRT_HOTPLUG_FORCE_DETECT
;
305 for (i
= 0; i
< tries
; i
++) {
306 /* turn on the FORCE_DETECT */
307 I915_WRITE(PORT_HOTPLUG_EN
, hotplug_en
);
308 /* wait for FORCE_DETECT to go off */
309 if (wait_for((I915_READ(PORT_HOTPLUG_EN
) &
310 CRT_HOTPLUG_FORCE_DETECT
) == 0,
312 DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off");
315 stat
= I915_READ(PORT_HOTPLUG_STAT
);
316 if ((stat
& CRT_HOTPLUG_MONITOR_MASK
) != CRT_HOTPLUG_MONITOR_NONE
)
319 /* clear the interrupt we just generated, if any */
320 I915_WRITE(PORT_HOTPLUG_STAT
, CRT_HOTPLUG_INT_STATUS
);
322 /* and put the bits back */
323 I915_WRITE(PORT_HOTPLUG_EN
, orig
);
328 static struct edid
*intel_crt_get_edid(struct drm_connector
*connector
,
329 struct i2c_adapter
*i2c
)
333 edid
= drm_get_edid(connector
, i2c
);
335 if (!edid
&& !intel_gmbus_is_forced_bit(i2c
)) {
336 DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n");
337 intel_gmbus_force_bit(i2c
, true);
338 edid
= drm_get_edid(connector
, i2c
);
339 intel_gmbus_force_bit(i2c
, false);
345 /* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */
346 static int intel_crt_ddc_get_modes(struct drm_connector
*connector
,
347 struct i2c_adapter
*adapter
)
351 edid
= intel_crt_get_edid(connector
, adapter
);
355 return intel_connector_update_modes(connector
, edid
);
358 static bool intel_crt_detect_ddc(struct drm_connector
*connector
)
360 struct intel_crt
*crt
= intel_attached_crt(connector
);
361 struct drm_i915_private
*dev_priv
= crt
->base
.base
.dev
->dev_private
;
363 struct i2c_adapter
*i2c
;
365 BUG_ON(crt
->base
.type
!= INTEL_OUTPUT_ANALOG
);
367 i2c
= intel_gmbus_get_adapter(dev_priv
, dev_priv
->crt_ddc_pin
);
368 edid
= intel_crt_get_edid(connector
, i2c
);
371 bool is_digital
= edid
->input
& DRM_EDID_INPUT_DIGITAL
;
374 * This may be a DVI-I connector with a shared DDC
375 * link between analog and digital outputs, so we
376 * have to check the EDID input spec of the attached device.
379 DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
383 DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
385 DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n");
393 static enum drm_connector_status
394 intel_crt_load_detect(struct intel_crt
*crt
)
396 struct drm_device
*dev
= crt
->base
.base
.dev
;
397 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
398 uint32_t pipe
= to_intel_crtc(crt
->base
.base
.crtc
)->pipe
;
399 uint32_t save_bclrpat
;
400 uint32_t save_vtotal
;
401 uint32_t vtotal
, vactive
;
403 uint32_t vblank
, vblank_start
, vblank_end
;
405 uint32_t bclrpat_reg
;
409 uint32_t pipeconf_reg
;
410 uint32_t pipe_dsl_reg
;
412 enum drm_connector_status status
;
414 DRM_DEBUG_KMS("starting load-detect on CRT\n");
416 bclrpat_reg
= BCLRPAT(pipe
);
417 vtotal_reg
= VTOTAL(pipe
);
418 vblank_reg
= VBLANK(pipe
);
419 vsync_reg
= VSYNC(pipe
);
420 pipeconf_reg
= PIPECONF(pipe
);
421 pipe_dsl_reg
= PIPEDSL(pipe
);
423 save_bclrpat
= I915_READ(bclrpat_reg
);
424 save_vtotal
= I915_READ(vtotal_reg
);
425 vblank
= I915_READ(vblank_reg
);
427 vtotal
= ((save_vtotal
>> 16) & 0xfff) + 1;
428 vactive
= (save_vtotal
& 0x7ff) + 1;
430 vblank_start
= (vblank
& 0xfff) + 1;
431 vblank_end
= ((vblank
>> 16) & 0xfff) + 1;
433 /* Set the border color to purple. */
434 I915_WRITE(bclrpat_reg
, 0x500050);
437 uint32_t pipeconf
= I915_READ(pipeconf_reg
);
438 I915_WRITE(pipeconf_reg
, pipeconf
| PIPECONF_FORCE_BORDER
);
439 POSTING_READ(pipeconf_reg
);
440 /* Wait for next Vblank to substitue
441 * border color for Color info */
442 intel_wait_for_vblank(dev
, pipe
);
443 st00
= I915_READ8(VGA_MSR_WRITE
);
444 status
= ((st00
& (1 << 4)) != 0) ?
445 connector_status_connected
:
446 connector_status_disconnected
;
448 I915_WRITE(pipeconf_reg
, pipeconf
);
450 bool restore_vblank
= false;
454 * If there isn't any border, add some.
455 * Yes, this will flicker
457 if (vblank_start
<= vactive
&& vblank_end
>= vtotal
) {
458 uint32_t vsync
= I915_READ(vsync_reg
);
459 uint32_t vsync_start
= (vsync
& 0xffff) + 1;
461 vblank_start
= vsync_start
;
462 I915_WRITE(vblank_reg
,
464 ((vblank_end
- 1) << 16));
465 restore_vblank
= true;
467 /* sample in the vertical border, selecting the larger one */
468 if (vblank_start
- vactive
>= vtotal
- vblank_end
)
469 vsample
= (vblank_start
+ vactive
) >> 1;
471 vsample
= (vtotal
+ vblank_end
) >> 1;
474 * Wait for the border to be displayed
476 while (I915_READ(pipe_dsl_reg
) >= vactive
)
478 while ((dsl
= I915_READ(pipe_dsl_reg
)) <= vsample
)
481 * Watch ST00 for an entire scanline
487 /* Read the ST00 VGA status register */
488 st00
= I915_READ8(VGA_MSR_WRITE
);
491 } while ((I915_READ(pipe_dsl_reg
) == dsl
));
493 /* restore vblank if necessary */
495 I915_WRITE(vblank_reg
, vblank
);
497 * If more than 3/4 of the scanline detected a monitor,
498 * then it is assumed to be present. This works even on i830,
499 * where there isn't any way to force the border color across
502 status
= detect
* 4 > count
* 3 ?
503 connector_status_connected
:
504 connector_status_disconnected
;
507 /* Restore previous settings */
508 I915_WRITE(bclrpat_reg
, save_bclrpat
);
513 static enum drm_connector_status
514 intel_crt_detect(struct drm_connector
*connector
, bool force
)
516 struct drm_device
*dev
= connector
->dev
;
517 struct intel_crt
*crt
= intel_attached_crt(connector
);
518 enum drm_connector_status status
;
519 struct intel_load_detect_pipe tmp
;
521 if (I915_HAS_HOTPLUG(dev
)) {
522 /* We can not rely on the HPD pin always being correctly wired
523 * up, for example many KVM do not pass it through, and so
524 * only trust an assertion that the monitor is connected.
526 if (intel_crt_detect_hotplug(connector
)) {
527 DRM_DEBUG_KMS("CRT detected via hotplug\n");
528 return connector_status_connected
;
530 DRM_DEBUG_KMS("CRT not detected via hotplug\n");
533 if (intel_crt_detect_ddc(connector
))
534 return connector_status_connected
;
536 /* Load detection is broken on HPD capable machines. Whoever wants a
537 * broken monitor (without edid) to work behind a broken kvm (that fails
538 * to have the right resistors for HP detection) needs to fix this up.
539 * For now just bail out. */
540 if (I915_HAS_HOTPLUG(dev
))
541 return connector_status_disconnected
;
544 return connector
->status
;
546 /* for pre-945g platforms use load detect */
547 if (intel_get_load_detect_pipe(&crt
->base
, connector
, NULL
,
549 if (intel_crt_detect_ddc(connector
))
550 status
= connector_status_connected
;
552 status
= intel_crt_load_detect(crt
);
553 intel_release_load_detect_pipe(&crt
->base
, connector
,
556 status
= connector_status_unknown
;
561 static void intel_crt_destroy(struct drm_connector
*connector
)
563 drm_sysfs_connector_remove(connector
);
564 drm_connector_cleanup(connector
);
568 static int intel_crt_get_modes(struct drm_connector
*connector
)
570 struct drm_device
*dev
= connector
->dev
;
571 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
573 struct i2c_adapter
*i2c
;
575 i2c
= intel_gmbus_get_adapter(dev_priv
, dev_priv
->crt_ddc_pin
);
576 ret
= intel_crt_ddc_get_modes(connector
, i2c
);
577 if (ret
|| !IS_G4X(dev
))
580 /* Try to probe digital port for output in DVI-I -> VGA mode. */
581 i2c
= intel_gmbus_get_adapter(dev_priv
, GMBUS_PORT_DPB
);
582 return intel_crt_ddc_get_modes(connector
, i2c
);
585 static int intel_crt_set_property(struct drm_connector
*connector
,
586 struct drm_property
*property
,
592 static void intel_crt_reset(struct drm_connector
*connector
)
594 struct drm_device
*dev
= connector
->dev
;
595 struct intel_crt
*crt
= intel_attached_crt(connector
);
597 if (HAS_PCH_SPLIT(dev
))
598 crt
->force_hotplug_required
= 1;
602 * Routines for controlling stuff on the analog port
605 static const struct drm_encoder_helper_funcs pch_encoder_funcs
= {
606 .mode_fixup
= intel_crt_mode_fixup
,
607 .prepare
= intel_encoder_prepare
,
608 .commit
= intel_encoder_commit
,
609 .mode_set
= intel_crt_mode_set
,
610 .dpms
= pch_crt_dpms
,
613 static const struct drm_encoder_helper_funcs gmch_encoder_funcs
= {
614 .mode_fixup
= intel_crt_mode_fixup
,
615 .prepare
= intel_encoder_prepare
,
616 .commit
= intel_encoder_commit
,
617 .mode_set
= intel_crt_mode_set
,
618 .dpms
= gmch_crt_dpms
,
621 static const struct drm_connector_funcs intel_crt_connector_funcs
= {
622 .reset
= intel_crt_reset
,
623 .dpms
= drm_helper_connector_dpms
,
624 .detect
= intel_crt_detect
,
625 .fill_modes
= drm_helper_probe_single_connector_modes
,
626 .destroy
= intel_crt_destroy
,
627 .set_property
= intel_crt_set_property
,
630 static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs
= {
631 .mode_valid
= intel_crt_mode_valid
,
632 .get_modes
= intel_crt_get_modes
,
633 .best_encoder
= intel_best_encoder
,
636 static const struct drm_encoder_funcs intel_crt_enc_funcs
= {
637 .destroy
= intel_encoder_destroy
,
640 static int __init
intel_no_crt_dmi_callback(const struct dmi_system_id
*id
)
642 DRM_INFO("Skipping CRT initialization for %s\n", id
->ident
);
646 static const struct dmi_system_id intel_no_crt
[] = {
648 .callback
= intel_no_crt_dmi_callback
,
651 DMI_MATCH(DMI_SYS_VENDOR
, "ACER"),
652 DMI_MATCH(DMI_PRODUCT_NAME
, "ZGB"),
658 void intel_crt_init(struct drm_device
*dev
)
660 struct drm_connector
*connector
;
661 struct intel_crt
*crt
;
662 struct intel_connector
*intel_connector
;
663 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
664 const struct drm_encoder_helper_funcs
*encoder_helper_funcs
;
666 /* Skip machines without VGA that falsely report hotplug events */
667 if (dmi_check_system(intel_no_crt
))
670 crt
= kzalloc(sizeof(struct intel_crt
), GFP_KERNEL
);
674 intel_connector
= kzalloc(sizeof(struct intel_connector
), GFP_KERNEL
);
675 if (!intel_connector
) {
680 connector
= &intel_connector
->base
;
681 drm_connector_init(dev
, &intel_connector
->base
,
682 &intel_crt_connector_funcs
, DRM_MODE_CONNECTOR_VGA
);
684 drm_encoder_init(dev
, &crt
->base
.base
, &intel_crt_enc_funcs
,
685 DRM_MODE_ENCODER_DAC
);
687 intel_connector_attach_encoder(intel_connector
, &crt
->base
);
689 crt
->base
.type
= INTEL_OUTPUT_ANALOG
;
690 crt
->base
.clone_mask
= (1 << INTEL_SDVO_NON_TV_CLONE_BIT
|
691 1 << INTEL_ANALOG_CLONE_BIT
|
692 1 << INTEL_SDVO_LVDS_CLONE_BIT
);
694 crt
->base
.crtc_mask
= (1 << 0);
696 crt
->base
.crtc_mask
= (1 << 0) | (1 << 1);
699 connector
->interlace_allowed
= 0;
701 connector
->interlace_allowed
= 1;
702 connector
->doublescan_allowed
= 0;
704 if (HAS_PCH_SPLIT(dev
))
705 encoder_helper_funcs
= &pch_encoder_funcs
;
707 encoder_helper_funcs
= &gmch_encoder_funcs
;
709 drm_encoder_helper_add(&crt
->base
.base
, encoder_helper_funcs
);
710 drm_connector_helper_add(connector
, &intel_crt_connector_helper_funcs
);
712 drm_sysfs_connector_add(connector
);
714 if (I915_HAS_HOTPLUG(dev
))
715 connector
->polled
= DRM_CONNECTOR_POLL_HPD
;
717 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
720 * Configure the automatic hotplug detection stuff
722 crt
->force_hotplug_required
= 0;
723 if (HAS_PCH_SPLIT(dev
)) {
726 adpa
= I915_READ(PCH_ADPA
);
727 adpa
&= ~ADPA_CRT_HOTPLUG_MASK
;
728 adpa
|= ADPA_HOTPLUG_BITS
;
729 I915_WRITE(PCH_ADPA
, adpa
);
730 POSTING_READ(PCH_ADPA
);
732 DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa
);
733 crt
->force_hotplug_required
= 1;
736 dev_priv
->hotplug_supported_mask
|= CRT_HOTPLUG_INT_STATUS
;