Rev 3243 | Rev 3746 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3243 | Rev 3480 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | * in advance. The buffer values are different for FDI and DP modes, |
82 | * in advance. The buffer values are different for FDI and DP modes, |
83 | * but the HDMI/DVI fields are shared among those. So we program the DDI |
83 | * but the HDMI/DVI fields are shared among those. So we program the DDI |
84 | * in either FDI or DP modes only, as HDMI connections will work with both |
84 | * in either FDI or DP modes only, as HDMI connections will work with both |
85 | * of those |
85 | * of those |
86 | */ |
86 | */ |
87 | void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, bool use_fdi_mode) |
87 | static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, |
- | 88 | bool use_fdi_mode) |
|
88 | { |
89 | { |
89 | struct drm_i915_private *dev_priv = dev->dev_private; |
90 | struct drm_i915_private *dev_priv = dev->dev_private; |
90 | u32 reg; |
91 | u32 reg; |
91 | int i; |
92 | int i; |
92 | const u32 *ddi_translations = ((use_fdi_mode) ? |
93 | const u32 *ddi_translations = ((use_fdi_mode) ? |
Line 112... | Line 113... | ||
112 | */ |
113 | */ |
113 | void intel_prepare_ddi(struct drm_device *dev) |
114 | void intel_prepare_ddi(struct drm_device *dev) |
114 | { |
115 | { |
115 | int port; |
116 | int port; |
Line 116... | Line 117... | ||
116 | 117 | ||
- | 118 | if (!HAS_DDI(dev)) |
|
- | 119 | return; |
|
117 | if (IS_HASWELL(dev)) { |
120 | |
118 | for (port = PORT_A; port < PORT_E; port++) |
121 | for (port = PORT_A; port < PORT_E; port++) |
Line 119... | Line 122... | ||
119 | intel_prepare_ddi_buffers(dev, port, false); |
122 | intel_prepare_ddi_buffers(dev, port, false); |
120 | 123 | ||
121 | /* DDI E is the suggested one to work in FDI mode, so program is as such by |
124 | /* DDI E is the suggested one to work in FDI mode, so program is as such |
122 | * default. It will have to be re-programmed in case a digital DP output |
125 | * by default. It will have to be re-programmed in case a digital DP |
123 | * will be detected on it |
126 | * output will be detected on it |
124 | */ |
127 | */ |
125 | intel_prepare_ddi_buffers(dev, PORT_E, true); |
- | |
Line 126... | Line 128... | ||
126 | } |
128 | intel_prepare_ddi_buffers(dev, PORT_E, true); |
127 | } |
129 | } |
128 | 130 | ||
129 | static const long hsw_ddi_buf_ctl_values[] = { |
131 | static const long hsw_ddi_buf_ctl_values[] = { |
Line 176... | Line 178... | ||
176 | I915_WRITE(_FDI_RXA_MISC, FDI_RX_PWRDN_LANE1_VAL(2) | |
178 | I915_WRITE(_FDI_RXA_MISC, FDI_RX_PWRDN_LANE1_VAL(2) | |
177 | FDI_RX_PWRDN_LANE0_VAL(2) | |
179 | FDI_RX_PWRDN_LANE0_VAL(2) | |
178 | FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90); |
180 | FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90); |
Line 179... | Line 181... | ||
179 | 181 | ||
180 | /* Enable the PCH Receiver FDI PLL */ |
182 | /* Enable the PCH Receiver FDI PLL */ |
181 | rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE | |
183 | rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE | |
182 | ((intel_crtc->fdi_lanes - 1) << 19); |
- | |
183 | if (dev_priv->fdi_rx_polarity_reversed) |
- | |
184 | rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT; |
184 | FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19); |
185 | I915_WRITE(_FDI_RXA_CTL, rx_ctl_val); |
185 | I915_WRITE(_FDI_RXA_CTL, rx_ctl_val); |
186 | POSTING_READ(_FDI_RXA_CTL); |
186 | POSTING_READ(_FDI_RXA_CTL); |
Line 187... | Line 187... | ||
187 | udelay(220); |
187 | udelay(220); |
Line 201... | Line 201... | ||
201 | DP_TP_CTL_FDI_AUTOTRAIN | |
201 | DP_TP_CTL_FDI_AUTOTRAIN | |
202 | DP_TP_CTL_ENHANCED_FRAME_ENABLE | |
202 | DP_TP_CTL_ENHANCED_FRAME_ENABLE | |
203 | DP_TP_CTL_LINK_TRAIN_PAT1 | |
203 | DP_TP_CTL_LINK_TRAIN_PAT1 | |
204 | DP_TP_CTL_ENABLE); |
204 | DP_TP_CTL_ENABLE); |
Line 205... | Line 205... | ||
205 | 205 | ||
- | 206 | /* Configure and enable DDI_BUF_CTL for DDI E with next voltage. |
|
- | 207 | * DDI E does not support port reversal, the functionality is |
|
- | 208 | * achieved on the PCH side in FDI_RX_CTL, so no need to set the |
|
206 | /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */ |
209 | * port reversal bit */ |
207 | I915_WRITE(DDI_BUF_CTL(PORT_E), |
210 | I915_WRITE(DDI_BUF_CTL(PORT_E), |
208 | DDI_BUF_CTL_ENABLE | |
211 | DDI_BUF_CTL_ENABLE | |
209 | ((intel_crtc->fdi_lanes - 1) << 1) | |
212 | ((intel_crtc->fdi_lanes - 1) << 1) | |
210 | hsw_ddi_buf_ctl_values[i / 2]); |
213 | hsw_ddi_buf_ctl_values[i / 2]); |
Line 673... | Line 676... | ||
673 | int type = intel_encoder->type; |
676 | int type = intel_encoder->type; |
Line 674... | Line 677... | ||
674 | 677 | ||
675 | DRM_DEBUG_KMS("Preparing DDI mode for Haswell on port %c, pipe %c\n", |
678 | DRM_DEBUG_KMS("Preparing DDI mode for Haswell on port %c, pipe %c\n", |
Line -... | Line 679... | ||
- | 679 | port_name(port), pipe_name(pipe)); |
|
676 | port_name(port), pipe_name(pipe)); |
680 | |
677 | 681 | intel_crtc->eld_vld = false; |
|
- | 682 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
|
- | 683 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
|
Line -... | Line 684... | ||
- | 684 | struct intel_digital_port *intel_dig_port = |
|
678 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
685 | enc_to_dig_port(encoder); |
679 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
686 | |
680 | 687 | intel_dp->DP = intel_dig_port->port_reversal | |
|
681 | intel_dp->DP = DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; |
688 | DDI_BUF_CTL_ENABLE | DDI_BUF_EMP_400MV_0DB_HSW; |
682 | switch (intel_dp->lane_count) { |
689 | switch (intel_dp->lane_count) { |
683 | case 1: |
690 | case 1: |
Line 983... | Line 990... | ||
983 | temp |= TRANS_DDI_PHSYNC; |
990 | temp |= TRANS_DDI_PHSYNC; |
Line 984... | Line 991... | ||
984 | 991 | ||
985 | if (cpu_transcoder == TRANSCODER_EDP) { |
992 | if (cpu_transcoder == TRANSCODER_EDP) { |
986 | switch (pipe) { |
993 | switch (pipe) { |
- | 994 | case PIPE_A: |
|
- | 995 | /* Can only use the always-on power well for eDP when |
|
- | 996 | * not using the panel fitter, and when not using motion |
|
- | 997 | * blur mitigation (which we don't support). */ |
|
987 | case PIPE_A: |
998 | if (dev_priv->pch_pf_size) |
- | 999 | temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; |
|
- | 1000 | else |
|
988 | temp |= TRANS_DDI_EDP_INPUT_A_ONOFF; |
1001 | temp |= TRANS_DDI_EDP_INPUT_A_ON; |
989 | break; |
1002 | break; |
990 | case PIPE_B: |
1003 | case PIPE_B: |
991 | temp |= TRANS_DDI_EDP_INPUT_B_ONOFF; |
1004 | temp |= TRANS_DDI_EDP_INPUT_B_ONOFF; |
992 | break; |
1005 | break; |
Line 1067... | Line 1080... | ||
1067 | return false; |
1080 | return false; |
Line 1068... | Line 1081... | ||
1068 | 1081 | ||
1069 | if (port == PORT_A) |
1082 | if (port == PORT_A) |
1070 | cpu_transcoder = TRANSCODER_EDP; |
1083 | cpu_transcoder = TRANSCODER_EDP; |
1071 | else |
1084 | else |
Line 1072... | Line 1085... | ||
1072 | cpu_transcoder = pipe; |
1085 | cpu_transcoder = (enum transcoder) pipe; |
Line 1073... | Line 1086... | ||
1073 | 1086 | ||
1074 | tmp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder)); |
1087 | tmp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder)); |
Line 1283... | Line 1296... | ||
1283 | } |
1296 | } |
Line 1284... | Line 1297... | ||
1284 | 1297 | ||
1285 | static void intel_enable_ddi(struct intel_encoder *intel_encoder) |
1298 | static void intel_enable_ddi(struct intel_encoder *intel_encoder) |
1286 | { |
1299 | { |
- | 1300 | struct drm_encoder *encoder = &intel_encoder->base; |
|
- | 1301 | struct drm_crtc *crtc = encoder->crtc; |
|
- | 1302 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
|
1287 | struct drm_encoder *encoder = &intel_encoder->base; |
1303 | int pipe = intel_crtc->pipe; |
1288 | struct drm_device *dev = encoder->dev; |
1304 | struct drm_device *dev = encoder->dev; |
1289 | struct drm_i915_private *dev_priv = dev->dev_private; |
1305 | struct drm_i915_private *dev_priv = dev->dev_private; |
1290 | enum port port = intel_ddi_get_encoder_port(intel_encoder); |
1306 | enum port port = intel_ddi_get_encoder_port(intel_encoder); |
- | 1307 | int type = intel_encoder->type; |
|
Line 1291... | Line 1308... | ||
1291 | int type = intel_encoder->type; |
1308 | uint32_t tmp; |
- | 1309 | ||
- | 1310 | if (type == INTEL_OUTPUT_HDMI) { |
|
- | 1311 | struct intel_digital_port *intel_dig_port = |
|
1292 | 1312 | enc_to_dig_port(encoder); |
|
1293 | if (type == INTEL_OUTPUT_HDMI) { |
1313 | |
1294 | /* In HDMI/DVI mode, the port width, and swing/emphasis values |
1314 | /* In HDMI/DVI mode, the port width, and swing/emphasis values |
1295 | * are ignored so nothing special needs to be done besides |
1315 | * are ignored so nothing special needs to be done besides |
1296 | * enabling the port. |
1316 | * enabling the port. |
- | 1317 | */ |
|
1297 | */ |
1318 | I915_WRITE(DDI_BUF_CTL(port), |
1298 | I915_WRITE(DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE); |
1319 | intel_dig_port->port_reversal | DDI_BUF_CTL_ENABLE); |
Line 1299... | Line 1320... | ||
1299 | } else if (type == INTEL_OUTPUT_EDP) { |
1320 | } else if (type == INTEL_OUTPUT_EDP) { |
1300 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1321 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
- | 1322 | ||
- | 1323 | ironlake_edp_backlight_on(intel_dp); |
|
- | 1324 | } |
|
- | 1325 | ||
- | 1326 | if (intel_crtc->eld_vld) { |
|
- | 1327 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); |
|
1301 | 1328 | tmp |= ((AUDIO_OUTPUT_ENABLE_A | AUDIO_ELD_VALID_A) << (pipe * 4)); |
|
Line 1302... | Line 1329... | ||
1302 | ironlake_edp_backlight_on(intel_dp); |
1329 | I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp); |
1303 | } |
1330 | } |
1304 | } |
1331 | } |
- | 1332 | ||
- | 1333 | static void intel_disable_ddi(struct intel_encoder *intel_encoder) |
|
- | 1334 | { |
|
1305 | 1335 | struct drm_encoder *encoder = &intel_encoder->base; |
|
- | 1336 | struct drm_crtc *crtc = encoder->crtc; |
|
- | 1337 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
|
- | 1338 | int pipe = intel_crtc->pipe; |
|
Line 1306... | Line 1339... | ||
1306 | static void intel_disable_ddi(struct intel_encoder *intel_encoder) |
1339 | int type = intel_encoder->type; |
1307 | { |
1340 | struct drm_device *dev = encoder->dev; |
Line 1308... | Line 1341... | ||
1308 | struct drm_encoder *encoder = &intel_encoder->base; |
1341 | struct drm_i915_private *dev_priv = dev->dev_private; |
1309 | int type = intel_encoder->type; |
1342 | uint32_t tmp; |
- | 1343 | ||
- | 1344 | if (type == INTEL_OUTPUT_EDP) { |
|
- | 1345 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
|
- | 1346 | ||
1310 | 1347 | ironlake_edp_backlight_off(intel_dp); |
|
Line 1311... | Line 1348... | ||
1311 | if (type == INTEL_OUTPUT_EDP) { |
1348 | } |
1312 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1349 | |
1313 | 1350 | tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); |
|
Line 1352... | Line 1389... | ||
1352 | { |
1389 | { |
1353 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
1390 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
1354 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
1391 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
1355 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
1392 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
1356 | enum port port = intel_dig_port->port; |
1393 | enum port port = intel_dig_port->port; |
1357 | bool wait; |
- | |
1358 | uint32_t val; |
1394 | uint32_t val; |
- | 1395 | bool wait = false; |
|
Line 1359... | Line 1396... | ||
1359 | 1396 | ||
1360 | if (I915_READ(DP_TP_CTL(port)) & DP_TP_CTL_ENABLE) { |
1397 | if (I915_READ(DP_TP_CTL(port)) & DP_TP_CTL_ENABLE) { |
1361 | val = I915_READ(DDI_BUF_CTL(port)); |
1398 | val = I915_READ(DDI_BUF_CTL(port)); |
1362 | if (val & DDI_BUF_CTL_ENABLE) { |
1399 | if (val & DDI_BUF_CTL_ENABLE) { |
Line 1450... | Line 1487... | ||
1450 | }; |
1487 | }; |
Line 1451... | Line 1488... | ||
1451 | 1488 | ||
1452 | static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = { |
1489 | static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = { |
1453 | .mode_fixup = intel_ddi_mode_fixup, |
1490 | .mode_fixup = intel_ddi_mode_fixup, |
1454 | .mode_set = intel_ddi_mode_set, |
- | |
1455 | .disable = intel_encoder_noop, |
1491 | .mode_set = intel_ddi_mode_set, |
Line 1456... | Line 1492... | ||
1456 | }; |
1492 | }; |
1457 | 1493 | ||
- | 1494 | void intel_ddi_init(struct drm_device *dev, enum port port) |
|
1458 | void intel_ddi_init(struct drm_device *dev, enum port port) |
1495 | { |
1459 | { |
1496 | struct drm_i915_private *dev_priv = dev->dev_private; |
1460 | struct intel_digital_port *intel_dig_port; |
1497 | struct intel_digital_port *intel_dig_port; |
1461 | struct intel_encoder *intel_encoder; |
1498 | struct intel_encoder *intel_encoder; |
1462 | struct drm_encoder *encoder; |
1499 | struct drm_encoder *encoder; |
Line 1495... | Line 1532... | ||
1495 | intel_encoder->disable = intel_disable_ddi; |
1532 | intel_encoder->disable = intel_disable_ddi; |
1496 | intel_encoder->post_disable = intel_ddi_post_disable; |
1533 | intel_encoder->post_disable = intel_ddi_post_disable; |
1497 | intel_encoder->get_hw_state = intel_ddi_get_hw_state; |
1534 | intel_encoder->get_hw_state = intel_ddi_get_hw_state; |
Line 1498... | Line 1535... | ||
1498 | 1535 | ||
- | 1536 | intel_dig_port->port = port; |
|
- | 1537 | intel_dig_port->port_reversal = I915_READ(DDI_BUF_CTL(port)) & |
|
1499 | intel_dig_port->port = port; |
1538 | DDI_BUF_PORT_REVERSAL; |
1500 | if (hdmi_connector) |
1539 | if (hdmi_connector) |
1501 | intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port); |
1540 | intel_dig_port->hdmi.sdvox_reg = DDI_BUF_CTL(port); |
1502 | else |
1541 | else |
1503 | intel_dig_port->hdmi.sdvox_reg = 0; |
1542 | intel_dig_port->hdmi.sdvox_reg = 0; |