Rev 4560 | Rev 5097 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4560 | Rev 5060 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | struct intel_lvds_encoder { |
49 | struct intel_lvds_encoder { |
50 | struct intel_encoder base; |
50 | struct intel_encoder base; |
Line 51... | Line 51... | ||
51 | 51 | ||
52 | bool is_dual_link; |
52 | bool is_dual_link; |
- | 53 | u32 reg; |
|
Line 53... | Line 54... | ||
53 | u32 reg; |
54 | u32 a3_power; |
54 | 55 | ||
Line 55... | Line 56... | ||
55 | struct intel_lvds_connector *attached_connector; |
56 | struct intel_lvds_connector *attached_connector; |
Line 69... | Line 70... | ||
69 | enum pipe *pipe) |
70 | enum pipe *pipe) |
70 | { |
71 | { |
71 | struct drm_device *dev = encoder->base.dev; |
72 | struct drm_device *dev = encoder->base.dev; |
72 | struct drm_i915_private *dev_priv = dev->dev_private; |
73 | struct drm_i915_private *dev_priv = dev->dev_private; |
73 | struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base); |
74 | struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base); |
- | 75 | enum intel_display_power_domain power_domain; |
|
74 | u32 tmp; |
76 | u32 tmp; |
Line -... | Line 77... | ||
- | 77 | ||
- | 78 | power_domain = intel_display_port_power_domain(encoder); |
|
- | 79 | if (!intel_display_power_enabled(dev_priv, power_domain)) |
|
- | 80 | return false; |
|
75 | 81 | ||
Line 76... | Line 82... | ||
76 | tmp = I915_READ(lvds_encoder->reg); |
82 | tmp = I915_READ(lvds_encoder->reg); |
77 | 83 | ||
Line 124... | Line 130... | ||
124 | ironlake_check_encoder_dotclock(pipe_config, dotclock); |
130 | ironlake_check_encoder_dotclock(pipe_config, dotclock); |
Line 125... | Line 131... | ||
125 | 131 | ||
126 | pipe_config->adjusted_mode.crtc_clock = dotclock; |
132 | pipe_config->adjusted_mode.crtc_clock = dotclock; |
Line 127... | Line -... | ||
127 | } |
- | |
128 | - | ||
129 | /* The LVDS pin pair needs to be on before the DPLLs are enabled. |
- | |
130 | * This is an exception to the general rule that mode_set doesn't turn |
- | |
131 | * things on. |
133 | } |
132 | */ |
134 | |
133 | static void intel_pre_enable_lvds(struct intel_encoder *encoder) |
135 | static void intel_pre_enable_lvds(struct intel_encoder *encoder) |
134 | { |
136 | { |
135 | struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base); |
137 | struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base); |
Line 174... | Line 176... | ||
174 | else |
176 | else |
175 | temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP); |
177 | temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP); |
Line 176... | Line 178... | ||
176 | 178 | ||
177 | /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP) |
179 | /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP) |
178 | * appropriately here, but we need to look more thoroughly into how |
180 | * appropriately here, but we need to look more thoroughly into how |
- | 181 | * panels behave in the two modes. For now, let's just maintain the |
|
179 | * panels behave in the two modes. |
182 | * value we got from the BIOS. |
- | 183 | */ |
|
- | 184 | temp &= ~LVDS_A3_POWER_MASK; |
|
Line 180... | Line 185... | ||
180 | */ |
185 | temp |= lvds_encoder->a3_power; |
181 | 186 | ||
182 | /* Set the dithering flag on LVDS as needed, note that there is no |
187 | /* Set the dithering flag on LVDS as needed, note that there is no |
183 | * special lvds dither control bit on pch-split platforms, dithering is |
188 | * special lvds dither control bit on pch-split platforms, dithering is |
Line 273... | Line 278... | ||
273 | 278 | ||
274 | static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, |
279 | static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, |
275 | struct intel_crtc_config *pipe_config) |
280 | struct intel_crtc_config *pipe_config) |
276 | { |
281 | { |
277 | struct drm_device *dev = intel_encoder->base.dev; |
- | |
278 | struct drm_i915_private *dev_priv = dev->dev_private; |
282 | struct drm_device *dev = intel_encoder->base.dev; |
279 | struct intel_lvds_encoder *lvds_encoder = |
283 | struct intel_lvds_encoder *lvds_encoder = |
280 | to_lvds_encoder(&intel_encoder->base); |
284 | to_lvds_encoder(&intel_encoder->base); |
281 | struct intel_connector *intel_connector = |
285 | struct intel_connector *intel_connector = |
282 | &lvds_encoder->attached_connector->base; |
286 | &lvds_encoder->attached_connector->base; |
Line 288... | Line 292... | ||
288 | if (INTEL_INFO(dev)->gen < 4 && intel_crtc->pipe == 0) { |
292 | if (INTEL_INFO(dev)->gen < 4 && intel_crtc->pipe == 0) { |
289 | DRM_ERROR("Can't support LVDS on pipe A\n"); |
293 | DRM_ERROR("Can't support LVDS on pipe A\n"); |
290 | return false; |
294 | return false; |
291 | } |
295 | } |
Line 292... | Line 296... | ||
292 | 296 | ||
293 | if ((I915_READ(lvds_encoder->reg) & LVDS_A3_POWER_MASK) == |
- | |
294 | LVDS_A3_POWER_UP) |
297 | if (lvds_encoder->a3_power == LVDS_A3_POWER_UP) |
295 | lvds_bpp = 8*3; |
298 | lvds_bpp = 8*3; |
296 | else |
299 | else |
Line 297... | Line 300... | ||
297 | lvds_bpp = 6*3; |
300 | lvds_bpp = 6*3; |
Line 329... | Line 332... | ||
329 | */ |
332 | */ |
Line 330... | Line 333... | ||
330 | 333 | ||
331 | return true; |
334 | return true; |
Line 332... | Line -... | ||
332 | } |
- | |
333 | - | ||
334 | static void intel_lvds_mode_set(struct intel_encoder *encoder) |
- | |
335 | { |
- | |
336 | /* |
- | |
337 | * We don't do anything here, the LVDS port is fully set up in the pre |
- | |
338 | * enable hook - the ordering constraints for enabling the lvds port vs. |
- | |
339 | * enabling the display pll are too strict. |
- | |
340 | */ |
- | |
341 | } |
335 | } |
342 | 336 | ||
343 | /** |
337 | /** |
344 | * Detect the LVDS connection. |
338 | * Detect the LVDS connection. |
345 | * |
339 | * |
Line 352... | Line 346... | ||
352 | { |
346 | { |
353 | struct drm_device *dev = connector->dev; |
347 | struct drm_device *dev = connector->dev; |
354 | enum drm_connector_status status; |
348 | enum drm_connector_status status; |
Line 355... | Line 349... | ||
355 | 349 | ||
356 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
350 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
Line 357... | Line 351... | ||
357 | connector->base.id, drm_get_connector_name(connector)); |
351 | connector->base.id, connector->name); |
358 | 352 | ||
359 | status = intel_panel_detect(dev); |
353 | status = intel_panel_detect(dev); |
Line 846... | Line 840... | ||
846 | struct drm_device *dev = lvds_encoder->base.base.dev; |
840 | struct drm_device *dev = lvds_encoder->base.base.dev; |
847 | unsigned int val; |
841 | unsigned int val; |
848 | struct drm_i915_private *dev_priv = dev->dev_private; |
842 | struct drm_i915_private *dev_priv = dev->dev_private; |
Line 849... | Line 843... | ||
849 | 843 | ||
850 | /* use the module option value if specified */ |
844 | /* use the module option value if specified */ |
851 | if (i915_lvds_channel_mode > 0) |
845 | if (i915.lvds_channel_mode > 0) |
Line 852... | Line 846... | ||
852 | return i915_lvds_channel_mode == 2; |
846 | return i915.lvds_channel_mode == 2; |
853 | 847 | ||
Line 854... | Line 848... | ||
854 | // if (dmi_check_system(intel_dual_link_lvds)) |
848 | // if (dmi_check_system(intel_dual_link_lvds)) |
Line 897... | Line 891... | ||
897 | struct intel_connector *intel_connector; |
891 | struct intel_connector *intel_connector; |
898 | struct drm_connector *connector; |
892 | struct drm_connector *connector; |
899 | struct drm_encoder *encoder; |
893 | struct drm_encoder *encoder; |
900 | struct drm_display_mode *scan; /* *modes, *bios_mode; */ |
894 | struct drm_display_mode *scan; /* *modes, *bios_mode; */ |
901 | struct drm_display_mode *fixed_mode = NULL; |
895 | struct drm_display_mode *fixed_mode = NULL; |
- | 896 | struct drm_display_mode *downclock_mode = NULL; |
|
902 | struct edid *edid; |
897 | struct edid *edid; |
903 | struct drm_crtc *crtc; |
898 | struct drm_crtc *crtc; |
904 | u32 lvds; |
899 | u32 lvds; |
905 | int pipe; |
900 | int pipe; |
906 | u8 pin; |
901 | u8 pin; |
Line 950... | Line 945... | ||
950 | DRM_MODE_ENCODER_LVDS); |
945 | DRM_MODE_ENCODER_LVDS); |
Line 951... | Line 946... | ||
951 | 946 | ||
952 | intel_encoder->enable = intel_enable_lvds; |
947 | intel_encoder->enable = intel_enable_lvds; |
953 | intel_encoder->pre_enable = intel_pre_enable_lvds; |
948 | intel_encoder->pre_enable = intel_pre_enable_lvds; |
954 | intel_encoder->compute_config = intel_lvds_compute_config; |
- | |
955 | intel_encoder->mode_set = intel_lvds_mode_set; |
949 | intel_encoder->compute_config = intel_lvds_compute_config; |
956 | intel_encoder->disable = intel_disable_lvds; |
950 | intel_encoder->disable = intel_disable_lvds; |
957 | intel_encoder->get_hw_state = intel_lvds_get_hw_state; |
951 | intel_encoder->get_hw_state = intel_lvds_get_hw_state; |
958 | intel_encoder->get_config = intel_lvds_get_config; |
952 | intel_encoder->get_config = intel_lvds_get_config; |
- | 953 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
|
Line 959... | Line 954... | ||
959 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
954 | intel_connector->unregister = intel_connector_unregister; |
960 | 955 | ||
Line 961... | Line 956... | ||
961 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
956 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
962 | intel_encoder->type = INTEL_OUTPUT_LVDS; |
957 | intel_encoder->type = INTEL_OUTPUT_LVDS; |
963 | 958 | ||
964 | intel_encoder->cloneable = false; |
959 | intel_encoder->cloneable = 0; |
965 | if (HAS_PCH_SPLIT(dev)) |
960 | if (HAS_PCH_SPLIT(dev)) |
966 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
961 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
Line 998... | Line 993... | ||
998 | 993 | ||
999 | /* |
994 | /* |
1000 | * Attempt to get the fixed panel mode from DDC. Assume that the |
995 | * Attempt to get the fixed panel mode from DDC. Assume that the |
1001 | * preferred mode is the right one. |
996 | * preferred mode is the right one. |
- | 997 | */ |
|
1002 | */ |
998 | mutex_lock(&dev->mode_config.mutex); |
1003 | edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin)); |
999 | edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin)); |
1004 | if (edid) { |
1000 | if (edid) { |
1005 | if (drm_add_edid_modes(connector, edid)) { |
1001 | if (drm_add_edid_modes(connector, edid)) { |
1006 | drm_mode_connector_update_edid_property(connector, |
1002 | drm_mode_connector_update_edid_property(connector, |
Line 1030... | Line 1026... | ||
1030 | DRM_DEBUG_KMS("using preferred mode from EDID: "); |
1026 | DRM_DEBUG_KMS("using preferred mode from EDID: "); |
1031 | drm_mode_debug_printmodeline(scan); |
1027 | drm_mode_debug_printmodeline(scan); |
Line 1032... | Line 1028... | ||
1032 | 1028 | ||
1033 | fixed_mode = drm_mode_duplicate(dev, scan); |
1029 | fixed_mode = drm_mode_duplicate(dev, scan); |
1034 | if (fixed_mode) { |
1030 | if (fixed_mode) { |
1035 | intel_connector->panel.downclock_mode = |
1031 | downclock_mode = |
1036 | intel_find_panel_downclock(dev, |
1032 | intel_find_panel_downclock(dev, |
1037 | fixed_mode, connector); |
1033 | fixed_mode, connector); |
1038 | if (intel_connector->panel.downclock_mode != |
1034 | if (downclock_mode != NULL && |
1039 | NULL && i915_lvds_downclock) { |
1035 | i915.lvds_downclock) { |
1040 | /* We found the downclock for LVDS. */ |
1036 | /* We found the downclock for LVDS. */ |
1041 | dev_priv->lvds_downclock_avail = true; |
1037 | dev_priv->lvds_downclock_avail = true; |
1042 | dev_priv->lvds_downclock = |
- | |
1043 | intel_connector->panel. |
1038 | dev_priv->lvds_downclock = |
1044 | downclock_mode->clock; |
1039 | downclock_mode->clock; |
1045 | DRM_DEBUG_KMS("LVDS downclock is found" |
1040 | DRM_DEBUG_KMS("LVDS downclock is found" |
1046 | " in EDID. Normal clock %dKhz, " |
1041 | " in EDID. Normal clock %dKhz, " |
1047 | "downclock %dKhz\n", |
1042 | "downclock %dKhz\n", |
Line 1092... | Line 1087... | ||
1092 | /* If we still don't have a mode after all that, give up. */ |
1087 | /* If we still don't have a mode after all that, give up. */ |
1093 | if (!fixed_mode) |
1088 | if (!fixed_mode) |
1094 | goto failed; |
1089 | goto failed; |
Line 1095... | Line 1090... | ||
1095 | 1090 | ||
- | 1091 | out: |
|
- | 1092 | mutex_unlock(&dev->mode_config.mutex); |
|
1096 | out: |
1093 | |
1097 | lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); |
1094 | lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); |
1098 | DRM_DEBUG_KMS("detected %s-link lvds configuration\n", |
1095 | DRM_DEBUG_KMS("detected %s-link lvds configuration\n", |
Line -... | Line 1096... | ||
- | 1096 | lvds_encoder->is_dual_link ? "dual" : "single"); |
|
- | 1097 | ||
- | 1098 | lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) & |
|
1099 | lvds_encoder->is_dual_link ? "dual" : "single"); |
1099 | LVDS_A3_POWER_MASK; |
1100 | 1100 | ||
1101 | /* |
1101 | /* |
1102 | * Unlock registers and just |
1102 | * Unlock registers and just |
1103 | * leave them unlocked |
1103 | * leave them unlocked |
Line 1107... | Line 1107... | ||
1107 | I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); |
1107 | I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); |
1108 | } else { |
1108 | } else { |
1109 | I915_WRITE(PP_CONTROL, |
1109 | I915_WRITE(PP_CONTROL, |
1110 | I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); |
1110 | I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); |
1111 | } |
1111 | } |
1112 | // dev_priv->lid_notifier.notifier_call = intel_lid_notify; |
- | |
1113 | // if (acpi_lid_notifier_register(&dev_priv->lid_notifier)) { |
- | |
1114 | // DRM_DEBUG_KMS("lid notifier registration failed\n"); |
- | |
1115 | // dev_priv->lid_notifier.notifier_call = NULL; |
- | |
1116 | // } |
- | |
1117 | drm_sysfs_connector_add(connector); |
1112 | drm_connector_register(connector); |
Line 1118... | Line 1113... | ||
1118 | 1113 | ||
1119 | intel_panel_init(&intel_connector->panel, fixed_mode); |
1114 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); |
Line 1120... | Line 1115... | ||
1120 | intel_panel_setup_backlight(connector); |
1115 | intel_panel_setup_backlight(connector); |
Line 1121... | Line 1116... | ||
1121 | 1116 | ||
- | 1117 | return; |
|
- | 1118 | ||
1122 | return; |
1119 | failed: |
1123 | 1120 | mutex_unlock(&dev->mode_config.mutex); |
|
1124 | failed: |
1121 | |
1125 | DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); |
- | |
1126 | drm_connector_cleanup(connector); |
- | |
1127 | drm_encoder_cleanup(encoder); |
1122 | DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); |
1128 | if (fixed_mode) |
1123 | drm_connector_cleanup(connector); |
1129 | drm_mode_destroy(dev, fixed_mode); |
1124 | drm_encoder_cleanup(encoder); |
1130 | kfree(lvds_encoder); |
1125 | kfree(lvds_encoder); |