diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 359 |
1 files changed, 150 insertions, 209 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index a0d5a1a039e0..b41c87ac561f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4934,7 +4934,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
4934 | struct fdi_m_n m_n = {0}; | 4934 | struct fdi_m_n m_n = {0}; |
4935 | u32 reg, temp; | 4935 | u32 reg, temp; |
4936 | u32 lvds_sync = 0; | 4936 | u32 lvds_sync = 0; |
4937 | int target_clock; | 4937 | int target_clock, pixel_multiplier, lane, link_bw, bpp, factor; |
4938 | 4938 | ||
4939 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { | 4939 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { |
4940 | if (encoder->base.crtc != crtc) | 4940 | if (encoder->base.crtc != crtc) |
@@ -4976,8 +4976,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
4976 | refclk / 1000); | 4976 | refclk / 1000); |
4977 | } else if (!IS_GEN2(dev)) { | 4977 | } else if (!IS_GEN2(dev)) { |
4978 | refclk = 96000; | 4978 | refclk = 96000; |
4979 | if (HAS_PCH_SPLIT(dev) && | 4979 | if (!has_edp_encoder || |
4980 | (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base))) | 4980 | intel_encoder_is_pch_edp(&has_edp_encoder->base)) |
4981 | refclk = 120000; /* 120Mhz refclk */ | 4981 | refclk = 120000; /* 120Mhz refclk */ |
4982 | } else { | 4982 | } else { |
4983 | refclk = 48000; | 4983 | refclk = 48000; |
@@ -5036,140 +5036,137 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5036 | } | 5036 | } |
5037 | 5037 | ||
5038 | /* FDI link */ | 5038 | /* FDI link */ |
5039 | if (HAS_PCH_SPLIT(dev)) { | 5039 | pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); |
5040 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); | 5040 | lane = 0; |
5041 | int lane = 0, link_bw, bpp; | 5041 | /* CPU eDP doesn't require FDI link, so just set DP M/N |
5042 | /* CPU eDP doesn't require FDI link, so just set DP M/N | 5042 | according to current link config */ |
5043 | according to current link config */ | 5043 | if (has_edp_encoder && |
5044 | if (has_edp_encoder && !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5044 | !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5045 | target_clock = mode->clock; | ||
5046 | intel_edp_link_config(has_edp_encoder, | ||
5047 | &lane, &link_bw); | ||
5048 | } else { | ||
5049 | /* [e]DP over FDI requires target mode clock | ||
5050 | instead of link clock */ | ||
5051 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) | ||
5045 | target_clock = mode->clock; | 5052 | target_clock = mode->clock; |
5046 | intel_edp_link_config(has_edp_encoder, | 5053 | else |
5047 | &lane, &link_bw); | 5054 | target_clock = adjusted_mode->clock; |
5048 | } else { | 5055 | |
5049 | /* [e]DP over FDI requires target mode clock | 5056 | /* FDI is a binary signal running at ~2.7GHz, encoding |
5050 | instead of link clock */ | 5057 | * each output octet as 10 bits. The actual frequency |
5051 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) | 5058 | * is stored as a divider into a 100MHz clock, and the |
5052 | target_clock = mode->clock; | 5059 | * mode pixel clock is stored in units of 1KHz. |
5053 | else | 5060 | * Hence the bw of each lane in terms of the mode signal |
5054 | target_clock = adjusted_mode->clock; | 5061 | * is: |
5055 | 5062 | */ | |
5056 | /* FDI is a binary signal running at ~2.7GHz, encoding | 5063 | link_bw = intel_fdi_link_freq(dev) * MHz(100)/KHz(1)/10; |
5057 | * each output octet as 10 bits. The actual frequency | 5064 | } |
5058 | * is stored as a divider into a 100MHz clock, and the | ||
5059 | * mode pixel clock is stored in units of 1KHz. | ||
5060 | * Hence the bw of each lane in terms of the mode signal | ||
5061 | * is: | ||
5062 | */ | ||
5063 | link_bw = intel_fdi_link_freq(dev) * MHz(100)/KHz(1)/10; | ||
5064 | } | ||
5065 | 5065 | ||
5066 | /* determine panel color depth */ | 5066 | /* determine panel color depth */ |
5067 | temp = I915_READ(PIPECONF(pipe)); | 5067 | temp = I915_READ(PIPECONF(pipe)); |
5068 | temp &= ~PIPE_BPC_MASK; | 5068 | temp &= ~PIPE_BPC_MASK; |
5069 | if (is_lvds) { | 5069 | if (is_lvds) { |
5070 | /* the BPC will be 6 if it is 18-bit LVDS panel */ | 5070 | /* the BPC will be 6 if it is 18-bit LVDS panel */ |
5071 | if ((I915_READ(PCH_LVDS) & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP) | 5071 | if ((I915_READ(PCH_LVDS) & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP) |
5072 | temp |= PIPE_8BPC; | 5072 | temp |= PIPE_8BPC; |
5073 | else | 5073 | else |
5074 | temp |= PIPE_6BPC; | 5074 | temp |= PIPE_6BPC; |
5075 | } else if (has_edp_encoder) { | 5075 | } else if (has_edp_encoder) { |
5076 | switch (dev_priv->edp.bpp/3) { | 5076 | switch (dev_priv->edp.bpp/3) { |
5077 | case 8: | 5077 | case 8: |
5078 | temp |= PIPE_8BPC; | ||
5079 | break; | ||
5080 | case 10: | ||
5081 | temp |= PIPE_10BPC; | ||
5082 | break; | ||
5083 | case 6: | ||
5084 | temp |= PIPE_6BPC; | ||
5085 | break; | ||
5086 | case 12: | ||
5087 | temp |= PIPE_12BPC; | ||
5088 | break; | ||
5089 | } | ||
5090 | } else | ||
5091 | temp |= PIPE_8BPC; | 5078 | temp |= PIPE_8BPC; |
5092 | I915_WRITE(PIPECONF(pipe), temp); | ||
5093 | |||
5094 | switch (temp & PIPE_BPC_MASK) { | ||
5095 | case PIPE_8BPC: | ||
5096 | bpp = 24; | ||
5097 | break; | 5079 | break; |
5098 | case PIPE_10BPC: | 5080 | case 10: |
5099 | bpp = 30; | 5081 | temp |= PIPE_10BPC; |
5100 | break; | 5082 | break; |
5101 | case PIPE_6BPC: | 5083 | case 6: |
5102 | bpp = 18; | 5084 | temp |= PIPE_6BPC; |
5103 | break; | 5085 | break; |
5104 | case PIPE_12BPC: | 5086 | case 12: |
5105 | bpp = 36; | 5087 | temp |= PIPE_12BPC; |
5106 | break; | 5088 | break; |
5107 | default: | ||
5108 | DRM_ERROR("unknown pipe bpc value\n"); | ||
5109 | bpp = 24; | ||
5110 | } | ||
5111 | |||
5112 | if (!lane) { | ||
5113 | /* | ||
5114 | * Account for spread spectrum to avoid | ||
5115 | * oversubscribing the link. Max center spread | ||
5116 | * is 2.5%; use 5% for safety's sake. | ||
5117 | */ | ||
5118 | u32 bps = target_clock * bpp * 21 / 20; | ||
5119 | lane = bps / (link_bw * 8) + 1; | ||
5120 | } | 5089 | } |
5090 | } else | ||
5091 | temp |= PIPE_8BPC; | ||
5092 | I915_WRITE(PIPECONF(pipe), temp); | ||
5121 | 5093 | ||
5122 | intel_crtc->fdi_lanes = lane; | 5094 | switch (temp & PIPE_BPC_MASK) { |
5095 | case PIPE_8BPC: | ||
5096 | bpp = 24; | ||
5097 | break; | ||
5098 | case PIPE_10BPC: | ||
5099 | bpp = 30; | ||
5100 | break; | ||
5101 | case PIPE_6BPC: | ||
5102 | bpp = 18; | ||
5103 | break; | ||
5104 | case PIPE_12BPC: | ||
5105 | bpp = 36; | ||
5106 | break; | ||
5107 | default: | ||
5108 | DRM_ERROR("unknown pipe bpc value\n"); | ||
5109 | bpp = 24; | ||
5110 | } | ||
5123 | 5111 | ||
5124 | if (pixel_multiplier > 1) | 5112 | if (!lane) { |
5125 | link_bw *= pixel_multiplier; | 5113 | /* |
5126 | ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); | 5114 | * Account for spread spectrum to avoid |
5115 | * oversubscribing the link. Max center spread | ||
5116 | * is 2.5%; use 5% for safety's sake. | ||
5117 | */ | ||
5118 | u32 bps = target_clock * bpp * 21 / 20; | ||
5119 | lane = bps / (link_bw * 8) + 1; | ||
5127 | } | 5120 | } |
5128 | 5121 | ||
5122 | intel_crtc->fdi_lanes = lane; | ||
5123 | |||
5124 | if (pixel_multiplier > 1) | ||
5125 | link_bw *= pixel_multiplier; | ||
5126 | ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); | ||
5127 | |||
5129 | /* Ironlake: try to setup display ref clock before DPLL | 5128 | /* Ironlake: try to setup display ref clock before DPLL |
5130 | * enabling. This is only under driver's control after | 5129 | * enabling. This is only under driver's control after |
5131 | * PCH B stepping, previous chipset stepping should be | 5130 | * PCH B stepping, previous chipset stepping should be |
5132 | * ignoring this setting. | 5131 | * ignoring this setting. |
5133 | */ | 5132 | */ |
5134 | if (HAS_PCH_SPLIT(dev)) { | 5133 | temp = I915_READ(PCH_DREF_CONTROL); |
5135 | temp = I915_READ(PCH_DREF_CONTROL); | 5134 | /* Always enable nonspread source */ |
5136 | /* Always enable nonspread source */ | 5135 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; |
5137 | temp &= ~DREF_NONSPREAD_SOURCE_MASK; | 5136 | temp |= DREF_NONSPREAD_SOURCE_ENABLE; |
5138 | temp |= DREF_NONSPREAD_SOURCE_ENABLE; | 5137 | temp &= ~DREF_SSC_SOURCE_MASK; |
5139 | temp &= ~DREF_SSC_SOURCE_MASK; | 5138 | temp |= DREF_SSC_SOURCE_ENABLE; |
5140 | temp |= DREF_SSC_SOURCE_ENABLE; | 5139 | I915_WRITE(PCH_DREF_CONTROL, temp); |
5141 | I915_WRITE(PCH_DREF_CONTROL, temp); | 5140 | |
5142 | 5141 | POSTING_READ(PCH_DREF_CONTROL); | |
5143 | POSTING_READ(PCH_DREF_CONTROL); | 5142 | udelay(200); |
5144 | udelay(200); | ||
5145 | |||
5146 | if (has_edp_encoder) { | ||
5147 | if (intel_panel_use_ssc(dev_priv)) { | ||
5148 | temp |= DREF_SSC1_ENABLE; | ||
5149 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
5150 | |||
5151 | POSTING_READ(PCH_DREF_CONTROL); | ||
5152 | udelay(200); | ||
5153 | } | ||
5154 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; | ||
5155 | 5143 | ||
5156 | /* Enable CPU source on CPU attached eDP */ | 5144 | if (has_edp_encoder) { |
5157 | if (!intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5145 | if (intel_panel_use_ssc(dev_priv)) { |
5158 | if (intel_panel_use_ssc(dev_priv)) | 5146 | temp |= DREF_SSC1_ENABLE; |
5159 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; | ||
5160 | else | ||
5161 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | ||
5162 | } else { | ||
5163 | /* Enable SSC on PCH eDP if needed */ | ||
5164 | if (intel_panel_use_ssc(dev_priv)) { | ||
5165 | DRM_ERROR("enabling SSC on PCH\n"); | ||
5166 | temp |= DREF_SUPERSPREAD_SOURCE_ENABLE; | ||
5167 | } | ||
5168 | } | ||
5169 | I915_WRITE(PCH_DREF_CONTROL, temp); | 5147 | I915_WRITE(PCH_DREF_CONTROL, temp); |
5148 | |||
5170 | POSTING_READ(PCH_DREF_CONTROL); | 5149 | POSTING_READ(PCH_DREF_CONTROL); |
5171 | udelay(200); | 5150 | udelay(200); |
5172 | } | 5151 | } |
5152 | temp &= ~DREF_CPU_SOURCE_OUTPUT_MASK; | ||
5153 | |||
5154 | /* Enable CPU source on CPU attached eDP */ | ||
5155 | if (!intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | ||
5156 | if (intel_panel_use_ssc(dev_priv)) | ||
5157 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; | ||
5158 | else | ||
5159 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | ||
5160 | } else { | ||
5161 | /* Enable SSC on PCH eDP if needed */ | ||
5162 | if (intel_panel_use_ssc(dev_priv)) { | ||
5163 | DRM_ERROR("enabling SSC on PCH\n"); | ||
5164 | temp |= DREF_SUPERSPREAD_SOURCE_ENABLE; | ||
5165 | } | ||
5166 | } | ||
5167 | I915_WRITE(PCH_DREF_CONTROL, temp); | ||
5168 | POSTING_READ(PCH_DREF_CONTROL); | ||
5169 | udelay(200); | ||
5173 | } | 5170 | } |
5174 | 5171 | ||
5175 | if (IS_PINEVIEW(dev)) { | 5172 | if (IS_PINEVIEW(dev)) { |
@@ -5185,24 +5182,19 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5185 | } | 5182 | } |
5186 | 5183 | ||
5187 | /* Enable autotuning of the PLL clock (if permissible) */ | 5184 | /* Enable autotuning of the PLL clock (if permissible) */ |
5188 | if (HAS_PCH_SPLIT(dev)) { | 5185 | factor = 21; |
5189 | int factor = 21; | 5186 | if (is_lvds) { |
5190 | 5187 | if ((intel_panel_use_ssc(dev_priv) && | |
5191 | if (is_lvds) { | 5188 | dev_priv->lvds_ssc_freq == 100) || |
5192 | if ((intel_panel_use_ssc(dev_priv) && | 5189 | (I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) |
5193 | dev_priv->lvds_ssc_freq == 100) || | 5190 | factor = 25; |
5194 | (I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) | 5191 | } else if (is_sdvo && is_tv) |
5195 | factor = 25; | 5192 | factor = 20; |
5196 | } else if (is_sdvo && is_tv) | ||
5197 | factor = 20; | ||
5198 | 5193 | ||
5199 | if (clock.m1 < factor * clock.n) | 5194 | if (clock.m1 < factor * clock.n) |
5200 | fp |= FP_CB_TUNE; | 5195 | fp |= FP_CB_TUNE; |
5201 | } | ||
5202 | 5196 | ||
5203 | dpll = 0; | 5197 | dpll = 0; |
5204 | if (!HAS_PCH_SPLIT(dev)) | ||
5205 | dpll = DPLL_VGA_MODE_DIS; | ||
5206 | 5198 | ||
5207 | if (!IS_GEN2(dev)) { | 5199 | if (!IS_GEN2(dev)) { |
5208 | if (is_lvds) | 5200 | if (is_lvds) |
@@ -5214,7 +5206,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5214 | if (pixel_multiplier > 1) { | 5206 | if (pixel_multiplier > 1) { |
5215 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 5207 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
5216 | dpll |= (pixel_multiplier - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; | 5208 | dpll |= (pixel_multiplier - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; |
5217 | else if (HAS_PCH_SPLIT(dev)) | 5209 | else |
5218 | dpll |= (pixel_multiplier - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; | 5210 | dpll |= (pixel_multiplier - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; |
5219 | } | 5211 | } |
5220 | dpll |= DPLL_DVO_HIGH_SPEED; | 5212 | dpll |= DPLL_DVO_HIGH_SPEED; |
@@ -5228,8 +5220,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5228 | else { | 5220 | else { |
5229 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 5221 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
5230 | /* also FPA1 */ | 5222 | /* also FPA1 */ |
5231 | if (HAS_PCH_SPLIT(dev)) | 5223 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; |
5232 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; | ||
5233 | if (IS_G4X(dev) && has_reduced_clock) | 5224 | if (IS_G4X(dev) && has_reduced_clock) |
5234 | dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; | 5225 | dpll |= (1 << (reduced_clock.p1 - 1)) << DPLL_FPA1_P1_POST_DIV_SHIFT; |
5235 | } | 5226 | } |
@@ -5247,8 +5238,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5247 | dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; | 5238 | dpll |= DPLLB_LVDS_P2_CLOCK_DIV_14; |
5248 | break; | 5239 | break; |
5249 | } | 5240 | } |
5250 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) | ||
5251 | dpll |= (6 << PLL_LOAD_PULSE_PHASE_SHIFT); | ||
5252 | } else { | 5241 | } else { |
5253 | if (is_lvds) { | 5242 | if (is_lvds) { |
5254 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 5243 | dpll |= (1 << (clock.p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
@@ -5279,15 +5268,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5279 | /* Set up the display plane register */ | 5268 | /* Set up the display plane register */ |
5280 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 5269 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
5281 | 5270 | ||
5282 | /* Ironlake's plane is forced to pipe, bit 24 is to | ||
5283 | enable color space conversion */ | ||
5284 | if (!HAS_PCH_SPLIT(dev)) { | ||
5285 | if (pipe == 0) | ||
5286 | dspcntr &= ~DISPPLANE_SEL_PIPE_MASK; | ||
5287 | else | ||
5288 | dspcntr |= DISPPLANE_SEL_PIPE_B; | ||
5289 | } | ||
5290 | |||
5291 | if (pipe == 0 && INTEL_INFO(dev)->gen < 4) { | 5271 | if (pipe == 0 && INTEL_INFO(dev)->gen < 4) { |
5292 | /* Enable pixel doubling when the dot clock is > 90% of the (display) | 5272 | /* Enable pixel doubling when the dot clock is > 90% of the (display) |
5293 | * core speed. | 5273 | * core speed. |
@@ -5302,20 +5282,12 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5302 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; | 5282 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; |
5303 | } | 5283 | } |
5304 | 5284 | ||
5305 | if (!HAS_PCH_SPLIT(dev)) | ||
5306 | dpll |= DPLL_VCO_ENABLE; | ||
5307 | |||
5308 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); | 5285 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); |
5309 | drm_mode_debug_printmodeline(mode); | 5286 | drm_mode_debug_printmodeline(mode); |
5310 | 5287 | ||
5311 | /* assign to Ironlake registers */ | 5288 | /* assign to Ironlake registers */ |
5312 | if (HAS_PCH_SPLIT(dev)) { | 5289 | fp_reg = PCH_FP0(pipe); |
5313 | fp_reg = PCH_FP0(pipe); | 5290 | dpll_reg = PCH_DPLL(pipe); |
5314 | dpll_reg = PCH_DPLL(pipe); | ||
5315 | } else { | ||
5316 | fp_reg = FP0(pipe); | ||
5317 | dpll_reg = DPLL(pipe); | ||
5318 | } | ||
5319 | 5291 | ||
5320 | /* PCH eDP needs FDI, but CPU eDP does not */ | 5292 | /* PCH eDP needs FDI, but CPU eDP does not */ |
5321 | if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5293 | if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
@@ -5354,9 +5326,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5354 | * things on. | 5326 | * things on. |
5355 | */ | 5327 | */ |
5356 | if (is_lvds) { | 5328 | if (is_lvds) { |
5357 | reg = LVDS; | 5329 | reg = PCH_LVDS; |
5358 | if (HAS_PCH_SPLIT(dev)) | ||
5359 | reg = PCH_LVDS; | ||
5360 | 5330 | ||
5361 | temp = I915_READ(reg); | 5331 | temp = I915_READ(reg); |
5362 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; | 5332 | temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; |
@@ -5385,13 +5355,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5385 | * appropriately here, but we need to look more thoroughly into how | 5355 | * appropriately here, but we need to look more thoroughly into how |
5386 | * panels behave in the two modes. | 5356 | * panels behave in the two modes. |
5387 | */ | 5357 | */ |
5388 | /* set the dithering flag on non-PCH LVDS as needed */ | ||
5389 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | ||
5390 | if (dev_priv->lvds_dither) | ||
5391 | temp |= LVDS_ENABLE_DITHER; | ||
5392 | else | ||
5393 | temp &= ~LVDS_ENABLE_DITHER; | ||
5394 | } | ||
5395 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) | 5358 | if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) |
5396 | lvds_sync |= LVDS_HSYNC_POLARITY; | 5359 | lvds_sync |= LVDS_HSYNC_POLARITY; |
5397 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) | 5360 | if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) |
@@ -5412,18 +5375,16 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5412 | } | 5375 | } |
5413 | 5376 | ||
5414 | /* set the dithering flag and clear for anything other than a panel. */ | 5377 | /* set the dithering flag and clear for anything other than a panel. */ |
5415 | if (HAS_PCH_SPLIT(dev)) { | 5378 | pipeconf &= ~PIPECONF_DITHER_EN; |
5416 | pipeconf &= ~PIPECONF_DITHER_EN; | 5379 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; |
5417 | pipeconf &= ~PIPECONF_DITHER_TYPE_MASK; | 5380 | if (dev_priv->lvds_dither && (is_lvds || has_edp_encoder)) { |
5418 | if (dev_priv->lvds_dither && (is_lvds || has_edp_encoder)) { | 5381 | pipeconf |= PIPECONF_DITHER_EN; |
5419 | pipeconf |= PIPECONF_DITHER_EN; | 5382 | pipeconf |= PIPECONF_DITHER_TYPE_ST1; |
5420 | pipeconf |= PIPECONF_DITHER_TYPE_ST1; | ||
5421 | } | ||
5422 | } | 5383 | } |
5423 | 5384 | ||
5424 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5385 | if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5425 | intel_dp_set_m_n(crtc, mode, adjusted_mode); | 5386 | intel_dp_set_m_n(crtc, mode, adjusted_mode); |
5426 | } else if (HAS_PCH_SPLIT(dev)) { | 5387 | } else { |
5427 | /* For non-DP output, clear any trans DP clock recovery setting.*/ | 5388 | /* For non-DP output, clear any trans DP clock recovery setting.*/ |
5428 | I915_WRITE(TRANSDATA_M1(pipe), 0); | 5389 | I915_WRITE(TRANSDATA_M1(pipe), 0); |
5429 | I915_WRITE(TRANSDATA_N1(pipe), 0); | 5390 | I915_WRITE(TRANSDATA_N1(pipe), 0); |
@@ -5431,31 +5392,20 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5431 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); | 5392 | I915_WRITE(TRANSDPLINK_N1(pipe), 0); |
5432 | } | 5393 | } |
5433 | 5394 | ||
5434 | if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5395 | if (!has_edp_encoder || |
5396 | intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | ||
5435 | I915_WRITE(dpll_reg, dpll); | 5397 | I915_WRITE(dpll_reg, dpll); |
5436 | 5398 | ||
5437 | /* Wait for the clocks to stabilize. */ | 5399 | /* Wait for the clocks to stabilize. */ |
5438 | POSTING_READ(dpll_reg); | 5400 | POSTING_READ(dpll_reg); |
5439 | udelay(150); | 5401 | udelay(150); |
5440 | 5402 | ||
5441 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | 5403 | /* The pixel multiplier can only be updated once the |
5442 | temp = 0; | 5404 | * DPLL is enabled and the clocks are stable. |
5443 | if (is_sdvo) { | 5405 | * |
5444 | temp = intel_mode_get_pixel_multiplier(adjusted_mode); | 5406 | * So write it again. |
5445 | if (temp > 1) | 5407 | */ |
5446 | temp = (temp - 1) << DPLL_MD_UDI_MULTIPLIER_SHIFT; | 5408 | I915_WRITE(dpll_reg, dpll); |
5447 | else | ||
5448 | temp = 0; | ||
5449 | } | ||
5450 | I915_WRITE(DPLL_MD(pipe), temp); | ||
5451 | } else { | ||
5452 | /* The pixel multiplier can only be updated once the | ||
5453 | * DPLL is enabled and the clocks are stable. | ||
5454 | * | ||
5455 | * So write it again. | ||
5456 | */ | ||
5457 | I915_WRITE(dpll_reg, dpll); | ||
5458 | } | ||
5459 | } | 5409 | } |
5460 | 5410 | ||
5461 | intel_crtc->lowfreq_avail = false; | 5411 | intel_crtc->lowfreq_avail = false; |
@@ -5506,33 +5456,24 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5506 | (adjusted_mode->crtc_vsync_start - 1) | | 5456 | (adjusted_mode->crtc_vsync_start - 1) | |
5507 | ((adjusted_mode->crtc_vsync_end - 1) << 16)); | 5457 | ((adjusted_mode->crtc_vsync_end - 1) << 16)); |
5508 | 5458 | ||
5509 | /* pipesrc and dspsize control the size that is scaled from, | 5459 | /* pipesrc controls the size that is scaled from, which should |
5510 | * which should always be the user's requested size. | 5460 | * always be the user's requested size. |
5511 | */ | 5461 | */ |
5512 | if (!HAS_PCH_SPLIT(dev)) { | ||
5513 | I915_WRITE(DSPSIZE(plane), | ||
5514 | ((mode->vdisplay - 1) << 16) | | ||
5515 | (mode->hdisplay - 1)); | ||
5516 | I915_WRITE(DSPPOS(plane), 0); | ||
5517 | } | ||
5518 | I915_WRITE(PIPESRC(pipe), | 5462 | I915_WRITE(PIPESRC(pipe), |
5519 | ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); | 5463 | ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1)); |
5520 | 5464 | ||
5521 | if (HAS_PCH_SPLIT(dev)) { | 5465 | I915_WRITE(PIPE_DATA_M1(pipe), TU_SIZE(m_n.tu) | m_n.gmch_m); |
5522 | I915_WRITE(PIPE_DATA_M1(pipe), TU_SIZE(m_n.tu) | m_n.gmch_m); | 5466 | I915_WRITE(PIPE_DATA_N1(pipe), m_n.gmch_n); |
5523 | I915_WRITE(PIPE_DATA_N1(pipe), m_n.gmch_n); | 5467 | I915_WRITE(PIPE_LINK_M1(pipe), m_n.link_m); |
5524 | I915_WRITE(PIPE_LINK_M1(pipe), m_n.link_m); | 5468 | I915_WRITE(PIPE_LINK_N1(pipe), m_n.link_n); |
5525 | I915_WRITE(PIPE_LINK_N1(pipe), m_n.link_n); | ||
5526 | 5469 | ||
5527 | if (has_edp_encoder && !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 5470 | if (has_edp_encoder && |
5528 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); | 5471 | !intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
5529 | } | 5472 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); |
5530 | } | 5473 | } |
5531 | 5474 | ||
5532 | I915_WRITE(PIPECONF(pipe), pipeconf); | 5475 | I915_WRITE(PIPECONF(pipe), pipeconf); |
5533 | POSTING_READ(PIPECONF(pipe)); | 5476 | POSTING_READ(PIPECONF(pipe)); |
5534 | if (!HAS_PCH_SPLIT(dev)) | ||
5535 | intel_enable_pipe(dev_priv, pipe, false); | ||
5536 | 5477 | ||
5537 | intel_wait_for_vblank(dev, pipe); | 5478 | intel_wait_for_vblank(dev, pipe); |
5538 | 5479 | ||