Rev 3746 | Rev 4280 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3746 | Rev 4104 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | struct intel_connector *connector; |
49 | struct intel_connector *connector; |
50 | bool force_hotplug_required; |
50 | bool force_hotplug_required; |
51 | u32 adpa_reg; |
51 | u32 adpa_reg; |
52 | }; |
52 | }; |
Line 53... | Line 53... | ||
53 | 53 | ||
54 | static struct intel_crt *intel_attached_crt(struct drm_connector *connector) |
54 | static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder) |
55 | { |
55 | { |
56 | return container_of(intel_attached_encoder(connector), |
- | |
57 | struct intel_crt, base); |
56 | return container_of(encoder, struct intel_crt, base); |
Line 58... | Line 57... | ||
58 | } |
57 | } |
59 | 58 | ||
60 | static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder) |
59 | static struct intel_crt *intel_attached_crt(struct drm_connector *connector) |
61 | { |
60 | { |
Line 62... | Line 61... | ||
62 | return container_of(encoder, struct intel_crt, base); |
61 | return intel_encoder_to_crt(intel_attached_encoder(connector)); |
63 | } |
62 | } |
64 | 63 | ||
Line 81... | Line 80... | ||
81 | *pipe = PORT_TO_PIPE(tmp); |
80 | *pipe = PORT_TO_PIPE(tmp); |
Line 82... | Line 81... | ||
82 | 81 | ||
83 | return true; |
82 | return true; |
Line -... | Line 83... | ||
- | 83 | } |
|
- | 84 | ||
- | 85 | static void intel_crt_get_config(struct intel_encoder *encoder, |
|
- | 86 | struct intel_crtc_config *pipe_config) |
|
- | 87 | { |
|
- | 88 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
|
- | 89 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
|
- | 90 | u32 tmp, flags = 0; |
|
- | 91 | ||
- | 92 | tmp = I915_READ(crt->adpa_reg); |
|
- | 93 | ||
- | 94 | if (tmp & ADPA_HSYNC_ACTIVE_HIGH) |
|
- | 95 | flags |= DRM_MODE_FLAG_PHSYNC; |
|
- | 96 | else |
|
- | 97 | flags |= DRM_MODE_FLAG_NHSYNC; |
|
- | 98 | ||
- | 99 | if (tmp & ADPA_VSYNC_ACTIVE_HIGH) |
|
- | 100 | flags |= DRM_MODE_FLAG_PVSYNC; |
|
- | 101 | else |
|
- | 102 | flags |= DRM_MODE_FLAG_NVSYNC; |
|
- | 103 | ||
- | 104 | pipe_config->adjusted_mode.flags |= flags; |
|
84 | } |
105 | } |
85 | 106 | ||
86 | /* Note: The caller is required to filter out dpms modes not supported by the |
107 | /* Note: The caller is required to filter out dpms modes not supported by the |
87 | * platform. */ |
108 | * platform. */ |
88 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) |
109 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) |
Line 124... | Line 145... | ||
124 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
145 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
Line 125... | Line 146... | ||
125 | 146 | ||
126 | intel_crt_set_dpms(encoder, crt->connector->base.dpms); |
147 | intel_crt_set_dpms(encoder, crt->connector->base.dpms); |
Line 127... | Line -... | ||
127 | } |
- | |
- | 148 | } |
|
128 | 149 | ||
129 | 150 | /* Special dpms function to support cloning between dvo/sdvo/crt. */ |
|
130 | static void intel_crt_dpms(struct drm_connector *connector, int mode) |
151 | static void intel_crt_dpms(struct drm_connector *connector, int mode) |
131 | { |
152 | { |
132 | struct drm_device *dev = connector->dev; |
153 | struct drm_device *dev = connector->dev; |
Line 155... | Line 176... | ||
155 | if (mode == DRM_MODE_DPMS_OFF) |
176 | if (mode == DRM_MODE_DPMS_OFF) |
156 | encoder->connectors_active = false; |
177 | encoder->connectors_active = false; |
157 | else |
178 | else |
158 | encoder->connectors_active = true; |
179 | encoder->connectors_active = true; |
Line -... | Line 180... | ||
- | 180 | ||
- | 181 | /* We call connector dpms manually below in case pipe dpms doesn't |
|
159 | 182 | * change due to cloning. */ |
|
160 | if (mode < old_dpms) { |
183 | if (mode < old_dpms) { |
161 | /* From off to on, enable the pipe first. */ |
184 | /* From off to on, enable the pipe first. */ |
Line 162... | Line 185... | ||
162 | intel_crtc_update_dpms(crtc); |
185 | intel_crtc_update_dpms(crtc); |
Line 204... | Line 227... | ||
204 | struct drm_device *dev = encoder->base.dev; |
227 | struct drm_device *dev = encoder->base.dev; |
Line 205... | Line 228... | ||
205 | 228 | ||
206 | if (HAS_PCH_SPLIT(dev)) |
229 | if (HAS_PCH_SPLIT(dev)) |
Line -... | Line 230... | ||
- | 230 | pipe_config->has_pch_encoder = true; |
|
- | 231 | ||
- | 232 | /* LPT FDI RX only supports 8bpc. */ |
|
- | 233 | if (HAS_PCH_LPT(dev)) |
|
207 | pipe_config->has_pch_encoder = true; |
234 | pipe_config->pipe_bpp = 24; |
208 | 235 | ||
Line 209... | Line 236... | ||
209 | return true; |
236 | return true; |
210 | } |
- | |
211 | - | ||
212 | static void intel_crt_mode_set(struct drm_encoder *encoder, |
237 | } |
Line 213... | Line 238... | ||
213 | struct drm_display_mode *mode, |
238 | |
214 | struct drm_display_mode *adjusted_mode) |
- | |
215 | { |
- | |
216 | 239 | static void intel_crt_mode_set(struct intel_encoder *encoder) |
|
217 | struct drm_device *dev = encoder->dev; |
240 | { |
218 | struct drm_crtc *crtc = encoder->crtc; |
241 | |
- | 242 | struct drm_device *dev = encoder->base.dev; |
|
219 | struct intel_crt *crt = |
243 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
Line 220... | Line 244... | ||
220 | intel_encoder_to_crt(to_intel_encoder(encoder)); |
244 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
221 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
245 | struct drm_i915_private *dev_priv = dev->dev_private; |
222 | struct drm_i915_private *dev_priv = dev->dev_private; |
246 | struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode; |
Line 234... | Line 258... | ||
234 | 258 | ||
235 | /* For CPT allow 3 pipe config, for others just use A or B */ |
259 | /* For CPT allow 3 pipe config, for others just use A or B */ |
236 | if (HAS_PCH_LPT(dev)) |
260 | if (HAS_PCH_LPT(dev)) |
237 | ; /* Those bits don't exist here */ |
261 | ; /* Those bits don't exist here */ |
238 | else if (HAS_PCH_CPT(dev)) |
262 | else if (HAS_PCH_CPT(dev)) |
239 | adpa |= PORT_TRANS_SEL_CPT(intel_crtc->pipe); |
263 | adpa |= PORT_TRANS_SEL_CPT(crtc->pipe); |
240 | else if (intel_crtc->pipe == 0) |
264 | else if (crtc->pipe == 0) |
241 | adpa |= ADPA_PIPE_A_SELECT; |
265 | adpa |= ADPA_PIPE_A_SELECT; |
242 | else |
266 | else |
Line 243... | Line 267... | ||
243 | adpa |= ADPA_PIPE_B_SELECT; |
267 | adpa |= ADPA_PIPE_B_SELECT; |
244 | 268 | ||
Line 245... | Line 269... | ||
245 | if (!HAS_PCH_SPLIT(dev)) |
269 | if (!HAS_PCH_SPLIT(dev)) |
246 | I915_WRITE(BCLRPAT(intel_crtc->pipe), 0); |
270 | I915_WRITE(BCLRPAT(crtc->pipe), 0); |
Line 247... | Line 271... | ||
247 | 271 | ||
Line 428... | Line 452... | ||
428 | struct edid *edid; |
452 | struct edid *edid; |
429 | struct i2c_adapter *i2c; |
453 | struct i2c_adapter *i2c; |
Line 430... | Line 454... | ||
430 | 454 | ||
Line 431... | Line 455... | ||
431 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); |
455 | BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG); |
432 | 456 | ||
Line 433... | Line 457... | ||
433 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
457 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin); |
434 | edid = intel_crt_get_edid(connector, i2c); |
458 | edid = intel_crt_get_edid(connector, i2c); |
Line 582... | Line 606... | ||
582 | struct drm_device *dev = connector->dev; |
606 | struct drm_device *dev = connector->dev; |
583 | struct intel_crt *crt = intel_attached_crt(connector); |
607 | struct intel_crt *crt = intel_attached_crt(connector); |
584 | enum drm_connector_status status; |
608 | enum drm_connector_status status; |
585 | struct intel_load_detect_pipe tmp; |
609 | struct intel_load_detect_pipe tmp; |
Line -... | Line 610... | ||
- | 610 | ||
- | 611 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", |
|
- | 612 | connector->base.id, drm_get_connector_name(connector), |
|
- | 613 | force); |
|
586 | 614 | ||
587 | if (I915_HAS_HOTPLUG(dev)) { |
615 | if (I915_HAS_HOTPLUG(dev)) { |
588 | /* We can not rely on the HPD pin always being correctly wired |
616 | /* We can not rely on the HPD pin always being correctly wired |
589 | * up, for example many KVM do not pass it through, and so |
617 | * up, for example many KVM do not pass it through, and so |
590 | * only trust an assertion that the monitor is connected. |
618 | * only trust an assertion that the monitor is connected. |
Line 634... | Line 662... | ||
634 | struct drm_device *dev = connector->dev; |
662 | struct drm_device *dev = connector->dev; |
635 | struct drm_i915_private *dev_priv = dev->dev_private; |
663 | struct drm_i915_private *dev_priv = dev->dev_private; |
636 | int ret; |
664 | int ret; |
637 | struct i2c_adapter *i2c; |
665 | struct i2c_adapter *i2c; |
Line 638... | Line 666... | ||
638 | 666 | ||
639 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin); |
667 | i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin); |
640 | ret = intel_crt_ddc_get_modes(connector, i2c); |
668 | ret = intel_crt_ddc_get_modes(connector, i2c); |
641 | if (ret || !IS_G4X(dev)) |
669 | if (ret || !IS_G4X(dev)) |
Line 642... | Line 670... | ||
642 | return ret; |
670 | return ret; |
Line 657... | Line 685... | ||
657 | { |
685 | { |
658 | struct drm_device *dev = connector->dev; |
686 | struct drm_device *dev = connector->dev; |
659 | struct drm_i915_private *dev_priv = dev->dev_private; |
687 | struct drm_i915_private *dev_priv = dev->dev_private; |
660 | struct intel_crt *crt = intel_attached_crt(connector); |
688 | struct intel_crt *crt = intel_attached_crt(connector); |
Line 661... | Line 689... | ||
661 | 689 | ||
662 | if (HAS_PCH_SPLIT(dev)) { |
690 | if (INTEL_INFO(dev)->gen >= 5) { |
Line 663... | Line 691... | ||
663 | u32 adpa; |
691 | u32 adpa; |
664 | 692 | ||
665 | adpa = I915_READ(crt->adpa_reg); |
693 | adpa = I915_READ(crt->adpa_reg); |
Line 676... | Line 704... | ||
676 | 704 | ||
677 | /* |
705 | /* |
678 | * Routines for controlling stuff on the analog port |
706 | * Routines for controlling stuff on the analog port |
Line 679... | Line -... | ||
679 | */ |
- | |
680 | - | ||
681 | static const struct drm_encoder_helper_funcs crt_encoder_funcs = { |
- | |
682 | .mode_set = intel_crt_mode_set, |
- | |
683 | }; |
707 | */ |
684 | 708 | ||
685 | static const struct drm_connector_funcs intel_crt_connector_funcs = { |
709 | static const struct drm_connector_funcs intel_crt_connector_funcs = { |
686 | .reset = intel_crt_reset, |
710 | .reset = intel_crt_reset, |
687 | .dpms = intel_crt_dpms, |
711 | .dpms = intel_crt_dpms, |
Line 747... | Line 771... | ||
747 | crt->adpa_reg = VLV_ADPA; |
771 | crt->adpa_reg = VLV_ADPA; |
748 | else |
772 | else |
749 | crt->adpa_reg = ADPA; |
773 | crt->adpa_reg = ADPA; |
Line 750... | Line 774... | ||
750 | 774 | ||
- | 775 | crt->base.compute_config = intel_crt_compute_config; |
|
751 | crt->base.compute_config = intel_crt_compute_config; |
776 | crt->base.mode_set = intel_crt_mode_set; |
752 | crt->base.disable = intel_disable_crt; |
777 | crt->base.disable = intel_disable_crt; |
- | 778 | crt->base.enable = intel_enable_crt; |
|
753 | crt->base.enable = intel_enable_crt; |
779 | crt->base.get_config = intel_crt_get_config; |
754 | if (I915_HAS_HOTPLUG(dev)) |
780 | if (I915_HAS_HOTPLUG(dev)) |
755 | crt->base.hpd_pin = HPD_CRT; |
781 | crt->base.hpd_pin = HPD_CRT; |
756 | if (HAS_DDI(dev)) |
782 | if (HAS_DDI(dev)) |
757 | crt->base.get_hw_state = intel_ddi_get_hw_state; |
783 | crt->base.get_hw_state = intel_ddi_get_hw_state; |
758 | else |
784 | else |
759 | crt->base.get_hw_state = intel_crt_get_hw_state; |
785 | crt->base.get_hw_state = intel_crt_get_hw_state; |
Line 760... | Line -... | ||
760 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
- | |
761 | 786 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
|
Line 762... | Line 787... | ||
762 | drm_encoder_helper_add(&crt->base.base, &crt_encoder_funcs); |
787 | |
Line 763... | Line 788... | ||
763 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
788 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |