aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-09-08 11:05:45 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-06 04:29:40 -0400
commit3be60de9e9dc92c852c196cf4b62e287fa53963c (patch)
tree8de3cd23a7d53e371fce370c42792d3d9da9d121
parent9571b190cf474ae02a7e018a21d14052d750070f (diff)
drm/i915: Skip CHV PHY asserts until PHY has been fully reset
The BIOS can leave the CHV display PHY in some odd state where some of the LDOs/lanes won't power down fully when unused. This will trigger a host of asserts that were added in: 30142273a3e83936fd7b45aa5339311a9295ca51 drm/i915: Add CHV PHY LDO power sanity checks 6669e39f95b5530ca8cb9137703ceb5e83e5d648 drm/i915: Add some CHV DPIO lane power state asserts To avoid that, skip the asserts until the PHY power well has been disabled at least once. That will fully reset the PHY, and once brought back up, the dynamic power down features will work correctly. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Deepak S<deepak.s@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c46
2 files changed, 48 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1eab9bab152a..35bf5cb04785 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1953,6 +1953,9 @@ struct drm_i915_private {
1953 1953
1954 bool edp_low_vswing; 1954 bool edp_low_vswing;
1955 1955
1956 /* perform PHY state sanity checks? */
1957 bool chv_phy_assert[2];
1958
1956 /* 1959 /*
1957 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch 1960 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
1958 * will be rejected. Instead look for a better place. 1961 * will be rejected. Instead look for a better place.
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index e1fdbabaf2bf..0cfe4c14866a 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -993,8 +993,29 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
993 lookup_power_well(dev_priv, PUNIT_POWER_WELL_DPIO_CMN_D); 993 lookup_power_well(dev_priv, PUNIT_POWER_WELL_DPIO_CMN_D);
994 u32 phy_control = dev_priv->chv_phy_control; 994 u32 phy_control = dev_priv->chv_phy_control;
995 u32 phy_status = 0; 995 u32 phy_status = 0;
996 u32 phy_status_mask = 0xffffffff;
996 u32 tmp; 997 u32 tmp;
997 998
999 /*
1000 * The BIOS can leave the PHY is some weird state
1001 * where it doesn't fully power down some parts.
1002 * Disable the asserts until the PHY has been fully
1003 * reset (ie. the power well has been disabled at
1004 * least once).
1005 */
1006 if (!dev_priv->chv_phy_assert[DPIO_PHY0])
1007 phy_status_mask &= ~(PHY_STATUS_CMN_LDO(DPIO_PHY0, DPIO_CH0) |
1008 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH0, 0) |
1009 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH0, 1) |
1010 PHY_STATUS_CMN_LDO(DPIO_PHY0, DPIO_CH1) |
1011 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH1, 0) |
1012 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH1, 1));
1013
1014 if (!dev_priv->chv_phy_assert[DPIO_PHY1])
1015 phy_status_mask &= ~(PHY_STATUS_CMN_LDO(DPIO_PHY1, DPIO_CH0) |
1016 PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 0) |
1017 PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1));
1018
998 if (cmn_bc->ops->is_enabled(dev_priv, cmn_bc)) { 1019 if (cmn_bc->ops->is_enabled(dev_priv, cmn_bc)) {
999 phy_status |= PHY_POWERGOOD(DPIO_PHY0); 1020 phy_status |= PHY_POWERGOOD(DPIO_PHY0);
1000 1021
@@ -1055,11 +1076,13 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
1055 phy_status |= PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1); 1076 phy_status |= PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1);
1056 } 1077 }
1057 1078
1079 phy_status &= phy_status_mask;
1080
1058 /* 1081 /*
1059 * The PHY may be busy with some initial calibration and whatnot, 1082 * The PHY may be busy with some initial calibration and whatnot,
1060 * so the power state can take a while to actually change. 1083 * so the power state can take a while to actually change.
1061 */ 1084 */
1062 if (wait_for((tmp = I915_READ(DISPLAY_PHY_STATUS)) == phy_status, 10)) 1085 if (wait_for((tmp = I915_READ(DISPLAY_PHY_STATUS) & phy_status_mask) == phy_status, 10))
1063 WARN(phy_status != tmp, 1086 WARN(phy_status != tmp,
1064 "Unexpected PHY_STATUS 0x%08x, expected 0x%08x (PHY_CONTROL=0x%08x)\n", 1087 "Unexpected PHY_STATUS 0x%08x, expected 0x%08x (PHY_CONTROL=0x%08x)\n",
1065 tmp, phy_status, dev_priv->chv_phy_control); 1088 tmp, phy_status, dev_priv->chv_phy_control);
@@ -1152,6 +1175,9 @@ static void chv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
1152 DRM_DEBUG_KMS("Disabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n", 1175 DRM_DEBUG_KMS("Disabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n",
1153 phy, dev_priv->chv_phy_control); 1176 phy, dev_priv->chv_phy_control);
1154 1177
1178 /* PHY is fully reset now, so we can enable the PHY state asserts */
1179 dev_priv->chv_phy_assert[phy] = true;
1180
1155 assert_chv_phy_status(dev_priv); 1181 assert_chv_phy_status(dev_priv);
1156} 1182}
1157 1183
@@ -1161,6 +1187,16 @@ static void assert_chv_phy_powergate(struct drm_i915_private *dev_priv, enum dpi
1161 enum pipe pipe = phy == DPIO_PHY0 ? PIPE_A : PIPE_C; 1187 enum pipe pipe = phy == DPIO_PHY0 ? PIPE_A : PIPE_C;
1162 u32 reg, val, expected, actual; 1188 u32 reg, val, expected, actual;
1163 1189
1190 /*
1191 * The BIOS can leave the PHY is some weird state
1192 * where it doesn't fully power down some parts.
1193 * Disable the asserts until the PHY has been fully
1194 * reset (ie. the power well has been disabled at
1195 * least once).
1196 */
1197 if (!dev_priv->chv_phy_assert[phy])
1198 return;
1199
1164 if (ch == DPIO_CH0) 1200 if (ch == DPIO_CH0)
1165 reg = _CHV_CMN_DW0_CH0; 1201 reg = _CHV_CMN_DW0_CH0;
1166 else 1202 else
@@ -1916,6 +1952,10 @@ static void chv_phy_control_init(struct drm_i915_private *dev_priv)
1916 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY0, DPIO_CH1); 1952 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY0, DPIO_CH1);
1917 1953
1918 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY0); 1954 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY0);
1955
1956 dev_priv->chv_phy_assert[DPIO_PHY0] = false;
1957 } else {
1958 dev_priv->chv_phy_assert[DPIO_PHY0] = true;
1919 } 1959 }
1920 1960
1921 if (cmn_d->ops->is_enabled(dev_priv, cmn_d)) { 1961 if (cmn_d->ops->is_enabled(dev_priv, cmn_d)) {
@@ -1934,6 +1974,10 @@ static void chv_phy_control_init(struct drm_i915_private *dev_priv)
1934 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY1, DPIO_CH0); 1974 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY1, DPIO_CH0);
1935 1975
1936 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY1); 1976 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY1);
1977
1978 dev_priv->chv_phy_assert[DPIO_PHY1] = false;
1979 } else {
1980 dev_priv->chv_phy_assert[DPIO_PHY1] = true;
1937 } 1981 }
1938 1982
1939 I915_WRITE(DISPLAY_PHY_CONTROL, dev_priv->chv_phy_control); 1983 I915_WRITE(DISPLAY_PHY_CONTROL, dev_priv->chv_phy_control);