aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_runtime_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_runtime_pm.c')
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c61
1 files changed, 54 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index d194492263eb..ec010ee74050 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -657,9 +657,15 @@ static void skl_set_power_well(struct drm_i915_private *dev_priv,
657 } 657 }
658 } else { 658 } else {
659 if (enable_requested) { 659 if (enable_requested) {
660 I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask); 660 if (IS_SKYLAKE(dev) &&
661 POSTING_READ(HSW_PWR_WELL_DRIVER); 661 (power_well->data == SKL_DISP_PW_1) &&
662 DRM_DEBUG_KMS("Disabling %s\n", power_well->name); 662 (intel_csr_load_status_get(dev_priv) == FW_LOADED))
663 DRM_DEBUG_KMS("Not Disabling PW1, dmc will handle\n");
664 else {
665 I915_WRITE(HSW_PWR_WELL_DRIVER, tmp & ~req_mask);
666 POSTING_READ(HSW_PWR_WELL_DRIVER);
667 DRM_DEBUG_KMS("Disabling %s\n", power_well->name);
668 }
663 669
664 if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) && 670 if ((GEN9_ENABLE_DC5(dev) || SKL_ENABLE_DC6(dev)) &&
665 power_well->data == SKL_DISP_PW_2) { 671 power_well->data == SKL_DISP_PW_2) {
@@ -988,8 +994,29 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
988 lookup_power_well(dev_priv, PUNIT_POWER_WELL_DPIO_CMN_D); 994 lookup_power_well(dev_priv, PUNIT_POWER_WELL_DPIO_CMN_D);
989 u32 phy_control = dev_priv->chv_phy_control; 995 u32 phy_control = dev_priv->chv_phy_control;
990 u32 phy_status = 0; 996 u32 phy_status = 0;
997 u32 phy_status_mask = 0xffffffff;
991 u32 tmp; 998 u32 tmp;
992 999
1000 /*
1001 * The BIOS can leave the PHY is some weird state
1002 * where it doesn't fully power down some parts.
1003 * Disable the asserts until the PHY has been fully
1004 * reset (ie. the power well has been disabled at
1005 * least once).
1006 */
1007 if (!dev_priv->chv_phy_assert[DPIO_PHY0])
1008 phy_status_mask &= ~(PHY_STATUS_CMN_LDO(DPIO_PHY0, DPIO_CH0) |
1009 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH0, 0) |
1010 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH0, 1) |
1011 PHY_STATUS_CMN_LDO(DPIO_PHY0, DPIO_CH1) |
1012 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH1, 0) |
1013 PHY_STATUS_SPLINE_LDO(DPIO_PHY0, DPIO_CH1, 1));
1014
1015 if (!dev_priv->chv_phy_assert[DPIO_PHY1])
1016 phy_status_mask &= ~(PHY_STATUS_CMN_LDO(DPIO_PHY1, DPIO_CH0) |
1017 PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 0) |
1018 PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1));
1019
993 if (cmn_bc->ops->is_enabled(dev_priv, cmn_bc)) { 1020 if (cmn_bc->ops->is_enabled(dev_priv, cmn_bc)) {
994 phy_status |= PHY_POWERGOOD(DPIO_PHY0); 1021 phy_status |= PHY_POWERGOOD(DPIO_PHY0);
995 1022
@@ -1050,11 +1077,13 @@ static void assert_chv_phy_status(struct drm_i915_private *dev_priv)
1050 phy_status |= PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1); 1077 phy_status |= PHY_STATUS_SPLINE_LDO(DPIO_PHY1, DPIO_CH0, 1);
1051 } 1078 }
1052 1079
1080 phy_status &= phy_status_mask;
1081
1053 /* 1082 /*
1054 * The PHY may be busy with some initial calibration and whatnot, 1083 * The PHY may be busy with some initial calibration and whatnot,
1055 * so the power state can take a while to actually change. 1084 * so the power state can take a while to actually change.
1056 */ 1085 */
1057 if (wait_for((tmp = I915_READ(DISPLAY_PHY_STATUS)) == phy_status, 10)) 1086 if (wait_for((tmp = I915_READ(DISPLAY_PHY_STATUS) & phy_status_mask) == phy_status, 10))
1058 WARN(phy_status != tmp, 1087 WARN(phy_status != tmp,
1059 "Unexpected PHY_STATUS 0x%08x, expected 0x%08x (PHY_CONTROL=0x%08x)\n", 1088 "Unexpected PHY_STATUS 0x%08x, expected 0x%08x (PHY_CONTROL=0x%08x)\n",
1060 tmp, phy_status, dev_priv->chv_phy_control); 1089 tmp, phy_status, dev_priv->chv_phy_control);
@@ -1147,6 +1176,9 @@ static void chv_dpio_cmn_power_well_disable(struct drm_i915_private *dev_priv,
1147 DRM_DEBUG_KMS("Disabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n", 1176 DRM_DEBUG_KMS("Disabled DPIO PHY%d (PHY_CONTROL=0x%08x)\n",
1148 phy, dev_priv->chv_phy_control); 1177 phy, dev_priv->chv_phy_control);
1149 1178
1179 /* PHY is fully reset now, so we can enable the PHY state asserts */
1180 dev_priv->chv_phy_assert[phy] = true;
1181
1150 assert_chv_phy_status(dev_priv); 1182 assert_chv_phy_status(dev_priv);
1151} 1183}
1152 1184
@@ -1156,6 +1188,16 @@ static void assert_chv_phy_powergate(struct drm_i915_private *dev_priv, enum dpi
1156 enum pipe pipe = phy == DPIO_PHY0 ? PIPE_A : PIPE_C; 1188 enum pipe pipe = phy == DPIO_PHY0 ? PIPE_A : PIPE_C;
1157 u32 reg, val, expected, actual; 1189 u32 reg, val, expected, actual;
1158 1190
1191 /*
1192 * The BIOS can leave the PHY is some weird state
1193 * where it doesn't fully power down some parts.
1194 * Disable the asserts until the PHY has been fully
1195 * reset (ie. the power well has been disabled at
1196 * least once).
1197 */
1198 if (!dev_priv->chv_phy_assert[phy])
1199 return;
1200
1159 if (ch == DPIO_CH0) 1201 if (ch == DPIO_CH0)
1160 reg = _CHV_CMN_DW0_CH0; 1202 reg = _CHV_CMN_DW0_CH0;
1161 else 1203 else
@@ -1823,7 +1865,6 @@ static void intel_runtime_pm_disable(struct drm_i915_private *dev_priv)
1823 1865
1824 /* Make sure we're not suspended first. */ 1866 /* Make sure we're not suspended first. */
1825 pm_runtime_get_sync(device); 1867 pm_runtime_get_sync(device);
1826 pm_runtime_disable(device);
1827} 1868}
1828 1869
1829/** 1870/**
@@ -1912,6 +1953,10 @@ static void chv_phy_control_init(struct drm_i915_private *dev_priv)
1912 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY0, DPIO_CH1); 1953 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY0, DPIO_CH1);
1913 1954
1914 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY0); 1955 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY0);
1956
1957 dev_priv->chv_phy_assert[DPIO_PHY0] = false;
1958 } else {
1959 dev_priv->chv_phy_assert[DPIO_PHY0] = true;
1915 } 1960 }
1916 1961
1917 if (cmn_d->ops->is_enabled(dev_priv, cmn_d)) { 1962 if (cmn_d->ops->is_enabled(dev_priv, cmn_d)) {
@@ -1930,6 +1975,10 @@ static void chv_phy_control_init(struct drm_i915_private *dev_priv)
1930 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY1, DPIO_CH0); 1975 PHY_CH_POWER_DOWN_OVRD(mask, DPIO_PHY1, DPIO_CH0);
1931 1976
1932 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY1); 1977 dev_priv->chv_phy_control |= PHY_COM_LANE_RESET_DEASSERT(DPIO_PHY1);
1978
1979 dev_priv->chv_phy_assert[DPIO_PHY1] = false;
1980 } else {
1981 dev_priv->chv_phy_assert[DPIO_PHY1] = true;
1933 } 1982 }
1934 1983
1935 I915_WRITE(DISPLAY_PHY_CONTROL, dev_priv->chv_phy_control); 1984 I915_WRITE(DISPLAY_PHY_CONTROL, dev_priv->chv_phy_control);
@@ -2115,8 +2164,6 @@ void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
2115 if (!HAS_RUNTIME_PM(dev)) 2164 if (!HAS_RUNTIME_PM(dev))
2116 return; 2165 return;
2117 2166
2118 pm_runtime_set_active(device);
2119
2120 /* 2167 /*
2121 * RPM depends on RC6 to save restore the GT HW context, so make RC6 a 2168 * RPM depends on RC6 to save restore the GT HW context, so make RC6 a
2122 * requirement. 2169 * requirement.