diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-10-07 19:01:07 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-10-08 04:20:04 -0400 |
commit | 4d9264615b98fe8015eca7d84a9862b1489c69d4 (patch) | |
tree | 02c04f133ee1e56e7ee2bf661ed5aba50d7668bb | |
parent | cfcb0fc9c2f2decf065e9a6a1c622541e8b4090b (diff) |
drm/i915/dp: remove redundant is_pch_edp checks
If is_edp is true, is_pch_edp will always be true. So limit the calls
to the latter function to places where the distinction actually matters.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f2810ade343c..1b736637e13e 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -160,7 +160,7 @@ intel_dp_link_required(struct drm_device *dev, struct intel_dp *intel_dp, int pi | |||
160 | { | 160 | { |
161 | struct drm_i915_private *dev_priv = dev->dev_private; | 161 | struct drm_i915_private *dev_priv = dev->dev_private; |
162 | 162 | ||
163 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 163 | if (is_edp(intel_dp)) |
164 | return (pixel_clock * dev_priv->edp.bpp + 7) / 8; | 164 | return (pixel_clock * dev_priv->edp.bpp + 7) / 8; |
165 | else | 165 | else |
166 | return pixel_clock * 3; | 166 | return pixel_clock * 3; |
@@ -182,8 +182,7 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
182 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | 182 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); |
183 | int max_lanes = intel_dp_max_lane_count(intel_dp); | 183 | int max_lanes = intel_dp_max_lane_count(intel_dp); |
184 | 184 | ||
185 | if ((is_edp(intel_dp) || is_pch_edp(intel_dp)) && | 185 | if (is_edp(intel_dp) && dev_priv->panel_fixed_mode) { |
186 | dev_priv->panel_fixed_mode) { | ||
187 | if (mode->hdisplay > dev_priv->panel_fixed_mode->hdisplay) | 186 | if (mode->hdisplay > dev_priv->panel_fixed_mode->hdisplay) |
188 | return MODE_PANEL; | 187 | return MODE_PANEL; |
189 | 188 | ||
@@ -552,8 +551,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
552 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 551 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
553 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 552 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
554 | 553 | ||
555 | if ((is_edp(intel_dp) || is_pch_edp(intel_dp)) && | 554 | if (is_edp(intel_dp) && dev_priv->panel_fixed_mode) { |
556 | dev_priv->panel_fixed_mode) { | ||
557 | intel_fixed_panel_mode(dev_priv->panel_fixed_mode, adjusted_mode); | 555 | intel_fixed_panel_mode(dev_priv->panel_fixed_mode, adjusted_mode); |
558 | intel_pch_panel_fitting(dev, DRM_MODE_SCALE_FULLSCREEN, | 556 | intel_pch_panel_fitting(dev, DRM_MODE_SCALE_FULLSCREEN, |
559 | mode, adjusted_mode); | 557 | mode, adjusted_mode); |
@@ -582,7 +580,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
582 | } | 580 | } |
583 | } | 581 | } |
584 | 582 | ||
585 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) { | 583 | if (is_edp(intel_dp)) { |
586 | /* okay we failed just pick the highest */ | 584 | /* okay we failed just pick the highest */ |
587 | intel_dp->lane_count = max_lane_count; | 585 | intel_dp->lane_count = max_lane_count; |
588 | intel_dp->link_bw = bws[max_clock]; | 586 | intel_dp->link_bw = bws[max_clock]; |
@@ -931,7 +929,7 @@ static void intel_dp_prepare(struct drm_encoder *encoder) | |||
931 | struct drm_i915_private *dev_priv = dev->dev_private; | 929 | struct drm_i915_private *dev_priv = dev->dev_private; |
932 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); | 930 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); |
933 | 931 | ||
934 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) { | 932 | if (is_edp(intel_dp)) { |
935 | ironlake_edp_panel_off(dev); | 933 | ironlake_edp_panel_off(dev); |
936 | ironlake_edp_backlight_off(dev); | 934 | ironlake_edp_backlight_off(dev); |
937 | ironlake_edp_panel_vdd_on(dev); | 935 | ironlake_edp_panel_vdd_on(dev); |
@@ -948,14 +946,13 @@ static void intel_dp_commit(struct drm_encoder *encoder) | |||
948 | 946 | ||
949 | intel_dp_start_link_train(intel_dp); | 947 | intel_dp_start_link_train(intel_dp); |
950 | 948 | ||
951 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 949 | if (is_edp(intel_dp)) |
952 | ironlake_edp_panel_on(dev); | 950 | ironlake_edp_panel_on(dev); |
953 | 951 | ||
954 | intel_dp_complete_link_train(intel_dp); | 952 | intel_dp_complete_link_train(intel_dp); |
955 | 953 | ||
956 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 954 | if (is_edp(intel_dp)) |
957 | ironlake_edp_backlight_on(dev); | 955 | ironlake_edp_backlight_on(dev); |
958 | intel_dp->dpms_mode = DRM_MODE_DPMS_ON; | ||
959 | } | 956 | } |
960 | 957 | ||
961 | static void | 958 | static void |
@@ -967,21 +964,21 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode) | |||
967 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); | 964 | uint32_t dp_reg = I915_READ(intel_dp->output_reg); |
968 | 965 | ||
969 | if (mode != DRM_MODE_DPMS_ON) { | 966 | if (mode != DRM_MODE_DPMS_ON) { |
970 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) { | 967 | if (is_edp(intel_dp)) { |
971 | ironlake_edp_backlight_off(dev); | 968 | ironlake_edp_backlight_off(dev); |
972 | ironlake_edp_panel_off(dev); | 969 | ironlake_edp_panel_off(dev); |
973 | } | 970 | } |
974 | if (dp_reg & DP_PORT_EN) | 971 | if (dp_reg & DP_PORT_EN) |
975 | intel_dp_link_down(intel_dp); | 972 | intel_dp_link_down(intel_dp); |
976 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 973 | if (is_edp(intel_dp)) |
977 | ironlake_edp_pll_off(encoder); | 974 | ironlake_edp_pll_off(encoder); |
978 | } else { | 975 | } else { |
979 | if (!(dp_reg & DP_PORT_EN)) { | 976 | if (!(dp_reg & DP_PORT_EN)) { |
980 | intel_dp_start_link_train(intel_dp); | 977 | intel_dp_start_link_train(intel_dp); |
981 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 978 | if (is_edp(intel_dp)) |
982 | ironlake_edp_panel_on(dev); | 979 | ironlake_edp_panel_on(dev); |
983 | intel_dp_complete_link_train(intel_dp); | 980 | intel_dp_complete_link_train(intel_dp); |
984 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 981 | if (is_edp(intel_dp)) |
985 | ironlake_edp_backlight_on(dev); | 982 | ironlake_edp_backlight_on(dev); |
986 | } | 983 | } |
987 | } | 984 | } |
@@ -1447,7 +1444,7 @@ ironlake_dp_detect(struct drm_connector *connector) | |||
1447 | enum drm_connector_status status; | 1444 | enum drm_connector_status status; |
1448 | 1445 | ||
1449 | /* Panel needs power for AUX to work */ | 1446 | /* Panel needs power for AUX to work */ |
1450 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 1447 | if (is_edp(intel_dp)) |
1451 | ironlake_edp_panel_vdd_on(connector->dev); | 1448 | ironlake_edp_panel_vdd_on(connector->dev); |
1452 | status = connector_status_disconnected; | 1449 | status = connector_status_disconnected; |
1453 | if (intel_dp_aux_native_read(intel_dp, | 1450 | if (intel_dp_aux_native_read(intel_dp, |
@@ -1459,7 +1456,7 @@ ironlake_dp_detect(struct drm_connector *connector) | |||
1459 | } | 1456 | } |
1460 | DRM_DEBUG_KMS("DPCD: %hx%hx%hx%hx\n", intel_dp->dpcd[0], | 1457 | DRM_DEBUG_KMS("DPCD: %hx%hx%hx%hx\n", intel_dp->dpcd[0], |
1461 | intel_dp->dpcd[1], intel_dp->dpcd[2], intel_dp->dpcd[3]); | 1458 | intel_dp->dpcd[1], intel_dp->dpcd[2], intel_dp->dpcd[3]); |
1462 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) | 1459 | if (is_edp(intel_dp)) |
1463 | ironlake_edp_panel_vdd_off(connector->dev); | 1460 | ironlake_edp_panel_vdd_off(connector->dev); |
1464 | return status; | 1461 | return status; |
1465 | } | 1462 | } |
@@ -1526,8 +1523,7 @@ static int intel_dp_get_modes(struct drm_connector *connector) | |||
1526 | 1523 | ||
1527 | ret = intel_ddc_get_modes(connector, &intel_dp->adapter); | 1524 | ret = intel_ddc_get_modes(connector, &intel_dp->adapter); |
1528 | if (ret) { | 1525 | if (ret) { |
1529 | if ((is_edp(intel_dp) || is_pch_edp(intel_dp)) && | 1526 | if (is_edp(intel_dp) && !dev_priv->panel_fixed_mode) { |
1530 | !dev_priv->panel_fixed_mode) { | ||
1531 | struct drm_display_mode *newmode; | 1527 | struct drm_display_mode *newmode; |
1532 | list_for_each_entry(newmode, &connector->probed_modes, | 1528 | list_for_each_entry(newmode, &connector->probed_modes, |
1533 | head) { | 1529 | head) { |
@@ -1543,7 +1539,7 @@ static int intel_dp_get_modes(struct drm_connector *connector) | |||
1543 | } | 1539 | } |
1544 | 1540 | ||
1545 | /* if eDP has no EDID, try to use fixed panel mode from VBT */ | 1541 | /* if eDP has no EDID, try to use fixed panel mode from VBT */ |
1546 | if (is_edp(intel_dp) || is_pch_edp(intel_dp)) { | 1542 | if (is_edp(intel_dp)) { |
1547 | if (dev_priv->panel_fixed_mode != NULL) { | 1543 | if (dev_priv->panel_fixed_mode != NULL) { |
1548 | struct drm_display_mode *mode; | 1544 | struct drm_display_mode *mode; |
1549 | mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode); | 1545 | mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode); |
@@ -1741,7 +1737,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
1741 | 1737 | ||
1742 | intel_encoder->hot_plug = intel_dp_hot_plug; | 1738 | intel_encoder->hot_plug = intel_dp_hot_plug; |
1743 | 1739 | ||
1744 | if (output_reg == DP_A || is_pch_edp(intel_dp)) { | 1740 | if (is_edp(intel_dp)) { |
1745 | /* initialize panel mode from VBT if available for eDP */ | 1741 | /* initialize panel mode from VBT if available for eDP */ |
1746 | if (dev_priv->lfp_lvds_vbt_mode) { | 1742 | if (dev_priv->lfp_lvds_vbt_mode) { |
1747 | dev_priv->panel_fixed_mode = | 1743 | dev_priv->panel_fixed_mode = |