diff options
author | Imre Deak <imre.deak@intel.com> | 2013-05-16 07:40:36 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-31 14:54:01 -0400 |
commit | bc7d38a43ab1af4cad1c235c3aa30426b6c7d6c5 (patch) | |
tree | 34781f7c7b1f867a790821d2ea23ebc5358331b9 /drivers/gpu/drm | |
parent | a62d0834dee83994e41fcd0e5b7f10aad3d80de0 (diff) |
drm/i915: replace is_cpu_edp() with a check for port A
The patch changes all remaining is_cpu_edp() check with a check for port
A. We can do this, since in all these cases ValleyView is handled
separately and port A is always a CPU side eDP port.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 320bd61ea2f2..91918f99611e 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -685,6 +685,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
685 | struct drm_i915_private *dev_priv = dev->dev_private; | 685 | struct drm_i915_private *dev_priv = dev->dev_private; |
686 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; | 686 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; |
687 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 687 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
688 | enum port port = dp_to_dig_port(intel_dp)->port; | ||
688 | struct intel_crtc *intel_crtc = encoder->new_crtc; | 689 | struct intel_crtc *intel_crtc = encoder->new_crtc; |
689 | struct intel_connector *intel_connector = intel_dp->attached_connector; | 690 | struct intel_connector *intel_connector = intel_dp->attached_connector; |
690 | int lane_count, clock; | 691 | int lane_count, clock; |
@@ -694,7 +695,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
694 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 695 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
695 | int target_clock, link_avail, link_clock; | 696 | int target_clock, link_avail, link_clock; |
696 | 697 | ||
697 | if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev) && !is_cpu_edp(intel_dp)) | 698 | if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev) && port != PORT_A) |
698 | pipe_config->has_pch_encoder = true; | 699 | pipe_config->has_pch_encoder = true; |
699 | 700 | ||
700 | pipe_config->has_dp_encoder = true; | 701 | pipe_config->has_dp_encoder = true; |
@@ -828,6 +829,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
828 | struct drm_device *dev = encoder->dev; | 829 | struct drm_device *dev = encoder->dev; |
829 | struct drm_i915_private *dev_priv = dev->dev_private; | 830 | struct drm_i915_private *dev_priv = dev->dev_private; |
830 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 831 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
832 | enum port port = dp_to_dig_port(intel_dp)->port; | ||
831 | struct drm_crtc *crtc = encoder->crtc; | 833 | struct drm_crtc *crtc = encoder->crtc; |
832 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 834 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
833 | 835 | ||
@@ -868,7 +870,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
868 | 870 | ||
869 | /* Split out the IBX/CPU vs CPT settings */ | 871 | /* Split out the IBX/CPU vs CPT settings */ |
870 | 872 | ||
871 | if (is_cpu_edp(intel_dp) && IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) { | 873 | if (port == PORT_A && IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) { |
872 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 874 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
873 | intel_dp->DP |= DP_SYNC_HS_HIGH; | 875 | intel_dp->DP |= DP_SYNC_HS_HIGH; |
874 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 876 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
@@ -885,7 +887,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
885 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | 887 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; |
886 | else | 888 | else |
887 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | 889 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; |
888 | } else if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | 890 | } else if (!HAS_PCH_CPT(dev) || port == PORT_A) { |
889 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev)) | 891 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev)) |
890 | intel_dp->DP |= intel_dp->color_range; | 892 | intel_dp->DP |= intel_dp->color_range; |
891 | 893 | ||
@@ -901,7 +903,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
901 | if (intel_crtc->pipe == 1) | 903 | if (intel_crtc->pipe == 1) |
902 | intel_dp->DP |= DP_PIPEB_SELECT; | 904 | intel_dp->DP |= DP_PIPEB_SELECT; |
903 | 905 | ||
904 | if (is_cpu_edp(intel_dp) && !IS_VALLEYVIEW(dev)) { | 906 | if (port == PORT_A && !IS_VALLEYVIEW(dev)) { |
905 | /* don't miss out required setting for eDP */ | 907 | /* don't miss out required setting for eDP */ |
906 | if (adjusted_mode->clock < 200000) | 908 | if (adjusted_mode->clock < 200000) |
907 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | 909 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; |
@@ -912,7 +914,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
912 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | 914 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; |
913 | } | 915 | } |
914 | 916 | ||
915 | if (is_cpu_edp(intel_dp) && !IS_VALLEYVIEW(dev)) | 917 | if (port == PORT_A && !IS_VALLEYVIEW(dev)) |
916 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); | 918 | ironlake_set_pll_edp(crtc, adjusted_mode->clock); |
917 | } | 919 | } |
918 | 920 | ||
@@ -1302,6 +1304,7 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder, | |||
1302 | enum pipe *pipe) | 1304 | enum pipe *pipe) |
1303 | { | 1305 | { |
1304 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 1306 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
1307 | enum port port = dp_to_dig_port(intel_dp)->port; | ||
1305 | struct drm_device *dev = encoder->base.dev; | 1308 | struct drm_device *dev = encoder->base.dev; |
1306 | struct drm_i915_private *dev_priv = dev->dev_private; | 1309 | struct drm_i915_private *dev_priv = dev->dev_private; |
1307 | u32 tmp = I915_READ(intel_dp->output_reg); | 1310 | u32 tmp = I915_READ(intel_dp->output_reg); |
@@ -1309,9 +1312,9 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder, | |||
1309 | if (!(tmp & DP_PORT_EN)) | 1312 | if (!(tmp & DP_PORT_EN)) |
1310 | return false; | 1313 | return false; |
1311 | 1314 | ||
1312 | if (is_cpu_edp(intel_dp) && IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) { | 1315 | if (port == PORT_A && IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) { |
1313 | *pipe = PORT_TO_PIPE_CPT(tmp); | 1316 | *pipe = PORT_TO_PIPE_CPT(tmp); |
1314 | } else if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | 1317 | } else if (!HAS_PCH_CPT(dev) || port == PORT_A) { |
1315 | *pipe = PORT_TO_PIPE(tmp); | 1318 | *pipe = PORT_TO_PIPE(tmp); |
1316 | } else { | 1319 | } else { |
1317 | u32 trans_sel; | 1320 | u32 trans_sel; |
@@ -1431,14 +1434,14 @@ static void intel_enable_dp(struct intel_encoder *encoder) | |||
1431 | static void intel_pre_enable_dp(struct intel_encoder *encoder) | 1434 | static void intel_pre_enable_dp(struct intel_encoder *encoder) |
1432 | { | 1435 | { |
1433 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); | 1436 | struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); |
1437 | struct intel_digital_port *dport = dp_to_dig_port(intel_dp); | ||
1434 | struct drm_device *dev = encoder->base.dev; | 1438 | struct drm_device *dev = encoder->base.dev; |
1435 | struct drm_i915_private *dev_priv = dev->dev_private; | 1439 | struct drm_i915_private *dev_priv = dev->dev_private; |
1436 | 1440 | ||
1437 | if (is_cpu_edp(intel_dp) && !IS_VALLEYVIEW(dev)) | 1441 | if (dport->port == PORT_A && !IS_VALLEYVIEW(dev)) |
1438 | ironlake_edp_pll_on(intel_dp); | 1442 | ironlake_edp_pll_on(intel_dp); |
1439 | 1443 | ||
1440 | if (IS_VALLEYVIEW(dev)) { | 1444 | if (IS_VALLEYVIEW(dev)) { |
1441 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); | ||
1442 | struct intel_crtc *intel_crtc = | 1445 | struct intel_crtc *intel_crtc = |
1443 | to_intel_crtc(encoder->base.crtc); | 1446 | to_intel_crtc(encoder->base.crtc); |
1444 | int port = vlv_dport_to_channel(dport); | 1447 | int port = vlv_dport_to_channel(dport); |
@@ -1546,12 +1549,13 @@ static uint8_t | |||
1546 | intel_dp_voltage_max(struct intel_dp *intel_dp) | 1549 | intel_dp_voltage_max(struct intel_dp *intel_dp) |
1547 | { | 1550 | { |
1548 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1551 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1552 | enum port port = dp_to_dig_port(intel_dp)->port; | ||
1549 | 1553 | ||
1550 | if (IS_VALLEYVIEW(dev)) | 1554 | if (IS_VALLEYVIEW(dev)) |
1551 | return DP_TRAIN_VOLTAGE_SWING_1200; | 1555 | return DP_TRAIN_VOLTAGE_SWING_1200; |
1552 | else if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) | 1556 | else if (IS_GEN7(dev) && port == PORT_A) |
1553 | return DP_TRAIN_VOLTAGE_SWING_800; | 1557 | return DP_TRAIN_VOLTAGE_SWING_800; |
1554 | else if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1558 | else if (HAS_PCH_CPT(dev) && port != PORT_A) |
1555 | return DP_TRAIN_VOLTAGE_SWING_1200; | 1559 | return DP_TRAIN_VOLTAGE_SWING_1200; |
1556 | else | 1560 | else |
1557 | return DP_TRAIN_VOLTAGE_SWING_800; | 1561 | return DP_TRAIN_VOLTAGE_SWING_800; |
@@ -1561,6 +1565,7 @@ static uint8_t | |||
1561 | intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) | 1565 | intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) |
1562 | { | 1566 | { |
1563 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1567 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1568 | enum port port = dp_to_dig_port(intel_dp)->port; | ||
1564 | 1569 | ||
1565 | if (HAS_DDI(dev)) { | 1570 | if (HAS_DDI(dev)) { |
1566 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | 1571 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { |
@@ -1586,7 +1591,7 @@ intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) | |||
1586 | default: | 1591 | default: |
1587 | return DP_TRAIN_PRE_EMPHASIS_0; | 1592 | return DP_TRAIN_PRE_EMPHASIS_0; |
1588 | } | 1593 | } |
1589 | } else if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | 1594 | } else if (IS_GEN7(dev) && port == PORT_A) { |
1590 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | 1595 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { |
1591 | case DP_TRAIN_VOLTAGE_SWING_400: | 1596 | case DP_TRAIN_VOLTAGE_SWING_400: |
1592 | return DP_TRAIN_PRE_EMPHASIS_6; | 1597 | return DP_TRAIN_PRE_EMPHASIS_6; |
@@ -1873,6 +1878,7 @@ static void | |||
1873 | intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) | 1878 | intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) |
1874 | { | 1879 | { |
1875 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 1880 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
1881 | enum port port = intel_dig_port->port; | ||
1876 | struct drm_device *dev = intel_dig_port->base.base.dev; | 1882 | struct drm_device *dev = intel_dig_port->base.base.dev; |
1877 | uint32_t signal_levels, mask; | 1883 | uint32_t signal_levels, mask; |
1878 | uint8_t train_set = intel_dp->train_set[0]; | 1884 | uint8_t train_set = intel_dp->train_set[0]; |
@@ -1883,10 +1889,10 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) | |||
1883 | } else if (IS_VALLEYVIEW(dev)) { | 1889 | } else if (IS_VALLEYVIEW(dev)) { |
1884 | signal_levels = intel_vlv_signal_levels(intel_dp); | 1890 | signal_levels = intel_vlv_signal_levels(intel_dp); |
1885 | mask = 0; | 1891 | mask = 0; |
1886 | } else if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | 1892 | } else if (IS_GEN7(dev) && port == PORT_A) { |
1887 | signal_levels = intel_gen7_edp_signal_levels(train_set); | 1893 | signal_levels = intel_gen7_edp_signal_levels(train_set); |
1888 | mask = EDP_LINK_TRAIN_VOL_EMP_MASK_IVB; | 1894 | mask = EDP_LINK_TRAIN_VOL_EMP_MASK_IVB; |
1889 | } else if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | 1895 | } else if (IS_GEN6(dev) && port == PORT_A) { |
1890 | signal_levels = intel_gen6_edp_signal_levels(train_set); | 1896 | signal_levels = intel_gen6_edp_signal_levels(train_set); |
1891 | mask = EDP_LINK_TRAIN_VOL_EMP_MASK_SNB; | 1897 | mask = EDP_LINK_TRAIN_VOL_EMP_MASK_SNB; |
1892 | } else { | 1898 | } else { |
@@ -1936,8 +1942,7 @@ intel_dp_set_link_train(struct intel_dp *intel_dp, | |||
1936 | } | 1942 | } |
1937 | I915_WRITE(DP_TP_CTL(port), temp); | 1943 | I915_WRITE(DP_TP_CTL(port), temp); |
1938 | 1944 | ||
1939 | } else if (HAS_PCH_CPT(dev) && | 1945 | } else if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || port != PORT_A)) { |
1940 | (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) { | ||
1941 | dp_reg_value &= ~DP_LINK_TRAIN_MASK_CPT; | 1946 | dp_reg_value &= ~DP_LINK_TRAIN_MASK_CPT; |
1942 | 1947 | ||
1943 | switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) { | 1948 | switch (dp_train_pat & DP_TRAINING_PATTERN_MASK) { |
@@ -2188,6 +2193,7 @@ static void | |||
2188 | intel_dp_link_down(struct intel_dp *intel_dp) | 2193 | intel_dp_link_down(struct intel_dp *intel_dp) |
2189 | { | 2194 | { |
2190 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 2195 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
2196 | enum port port = intel_dig_port->port; | ||
2191 | struct drm_device *dev = intel_dig_port->base.base.dev; | 2197 | struct drm_device *dev = intel_dig_port->base.base.dev; |
2192 | struct drm_i915_private *dev_priv = dev->dev_private; | 2198 | struct drm_i915_private *dev_priv = dev->dev_private; |
2193 | struct intel_crtc *intel_crtc = | 2199 | struct intel_crtc *intel_crtc = |
@@ -2217,7 +2223,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
2217 | 2223 | ||
2218 | DRM_DEBUG_KMS("\n"); | 2224 | DRM_DEBUG_KMS("\n"); |
2219 | 2225 | ||
2220 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) { | 2226 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || port != PORT_A)) { |
2221 | DP &= ~DP_LINK_TRAIN_MASK_CPT; | 2227 | DP &= ~DP_LINK_TRAIN_MASK_CPT; |
2222 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); | 2228 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); |
2223 | } else { | 2229 | } else { |
@@ -2944,9 +2950,6 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | |||
2944 | pp_div_reg = PIPEA_PP_DIVISOR; | 2950 | pp_div_reg = PIPEA_PP_DIVISOR; |
2945 | } | 2951 | } |
2946 | 2952 | ||
2947 | if (IS_VALLEYVIEW(dev)) | ||
2948 | port_sel = I915_READ(pp_on_reg) & 0xc0000000; | ||
2949 | |||
2950 | /* And finally store the new values in the power sequencer. */ | 2953 | /* And finally store the new values in the power sequencer. */ |
2951 | pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | | 2954 | pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | |
2952 | (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT); | 2955 | (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT); |
@@ -2960,8 +2963,10 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | |||
2960 | 2963 | ||
2961 | /* Haswell doesn't have any port selection bits for the panel | 2964 | /* Haswell doesn't have any port selection bits for the panel |
2962 | * power sequencer any more. */ | 2965 | * power sequencer any more. */ |
2963 | if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) { | 2966 | if (IS_VALLEYVIEW(dev)) { |
2964 | if (is_cpu_edp(intel_dp)) | 2967 | port_sel = I915_READ(pp_on_reg) & 0xc0000000; |
2968 | } else if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) { | ||
2969 | if (dp_to_dig_port(intel_dp)->port == PORT_A) | ||
2965 | port_sel = PANEL_POWER_PORT_DP_A; | 2970 | port_sel = PANEL_POWER_PORT_DP_A; |
2966 | else | 2971 | else |
2967 | port_sel = PANEL_POWER_PORT_DP_D; | 2972 | port_sel = PANEL_POWER_PORT_DP_D; |