diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2013-11-03 00:07:43 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-11-08 12:09:57 -0500 |
commit | 8f93f4f1e8612e8d13fa4a5b3373aa7a87f93b31 (patch) | |
tree | 709fe432aa3c089793d8a2f94cff88009ef2dfc1 | |
parent | 300644c7dc4699fe9afb61b280aa5ed7109a4d93 (diff) |
drm/i915/bdw: add support for BDW DP voltage swings and pre-emphasis
They're not the same as the Haswell ones.
Reviewed-by: Art Runyan <arthur.j.runyan@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Todd Previte <tprevite@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 55 |
2 files changed, 63 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 0b7983b87ce8..ad903b927fb8 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -5197,6 +5197,7 @@ | |||
5197 | #define DDI_BUF_CTL_B 0x64100 | 5197 | #define DDI_BUF_CTL_B 0x64100 |
5198 | #define DDI_BUF_CTL(port) _PORT(port, DDI_BUF_CTL_A, DDI_BUF_CTL_B) | 5198 | #define DDI_BUF_CTL(port) _PORT(port, DDI_BUF_CTL_A, DDI_BUF_CTL_B) |
5199 | #define DDI_BUF_CTL_ENABLE (1<<31) | 5199 | #define DDI_BUF_CTL_ENABLE (1<<31) |
5200 | /* Haswell */ | ||
5200 | #define DDI_BUF_EMP_400MV_0DB_HSW (0<<24) /* Sel0 */ | 5201 | #define DDI_BUF_EMP_400MV_0DB_HSW (0<<24) /* Sel0 */ |
5201 | #define DDI_BUF_EMP_400MV_3_5DB_HSW (1<<24) /* Sel1 */ | 5202 | #define DDI_BUF_EMP_400MV_3_5DB_HSW (1<<24) /* Sel1 */ |
5202 | #define DDI_BUF_EMP_400MV_6DB_HSW (2<<24) /* Sel2 */ | 5203 | #define DDI_BUF_EMP_400MV_6DB_HSW (2<<24) /* Sel2 */ |
@@ -5206,6 +5207,16 @@ | |||
5206 | #define DDI_BUF_EMP_600MV_6DB_HSW (6<<24) /* Sel6 */ | 5207 | #define DDI_BUF_EMP_600MV_6DB_HSW (6<<24) /* Sel6 */ |
5207 | #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */ | 5208 | #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */ |
5208 | #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */ | 5209 | #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */ |
5210 | /* Broadwell */ | ||
5211 | #define DDI_BUF_EMP_400MV_0DB_BDW (0<<24) /* Sel0 */ | ||
5212 | #define DDI_BUF_EMP_400MV_3_5DB_BDW (1<<24) /* Sel1 */ | ||
5213 | #define DDI_BUF_EMP_400MV_6DB_BDW (2<<24) /* Sel2 */ | ||
5214 | #define DDI_BUF_EMP_600MV_0DB_BDW (3<<24) /* Sel3 */ | ||
5215 | #define DDI_BUF_EMP_600MV_3_5DB_BDW (4<<24) /* Sel4 */ | ||
5216 | #define DDI_BUF_EMP_600MV_6DB_BDW (5<<24) /* Sel5 */ | ||
5217 | #define DDI_BUF_EMP_800MV_0DB_BDW (6<<24) /* Sel6 */ | ||
5218 | #define DDI_BUF_EMP_800MV_3_5DB_BDW (7<<24) /* Sel7 */ | ||
5219 | #define DDI_BUF_EMP_1200MV_0DB_BDW (8<<24) /* Sel8 */ | ||
5209 | #define DDI_BUF_EMP_MASK (0xf<<24) | 5220 | #define DDI_BUF_EMP_MASK (0xf<<24) |
5210 | #define DDI_BUF_PORT_REVERSAL (1<<16) | 5221 | #define DDI_BUF_PORT_REVERSAL (1<<16) |
5211 | #define DDI_BUF_IS_IDLE (1<<7) | 5222 | #define DDI_BUF_IS_IDLE (1<<7) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 7619eae35b25..f39856e12094 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1958,7 +1958,7 @@ intel_dp_voltage_max(struct intel_dp *intel_dp) | |||
1958 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1958 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1959 | enum port port = dp_to_dig_port(intel_dp)->port; | 1959 | enum port port = dp_to_dig_port(intel_dp)->port; |
1960 | 1960 | ||
1961 | if (IS_VALLEYVIEW(dev)) | 1961 | if (IS_VALLEYVIEW(dev) || IS_BROADWELL(dev)) |
1962 | return DP_TRAIN_VOLTAGE_SWING_1200; | 1962 | return DP_TRAIN_VOLTAGE_SWING_1200; |
1963 | else if (IS_GEN7(dev) && port == PORT_A) | 1963 | else if (IS_GEN7(dev) && port == PORT_A) |
1964 | return DP_TRAIN_VOLTAGE_SWING_800; | 1964 | return DP_TRAIN_VOLTAGE_SWING_800; |
@@ -1974,7 +1974,18 @@ intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) | |||
1974 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1974 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1975 | enum port port = dp_to_dig_port(intel_dp)->port; | 1975 | enum port port = dp_to_dig_port(intel_dp)->port; |
1976 | 1976 | ||
1977 | if (HAS_DDI(dev)) { | 1977 | if (IS_BROADWELL(dev)) { |
1978 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | ||
1979 | case DP_TRAIN_VOLTAGE_SWING_400: | ||
1980 | case DP_TRAIN_VOLTAGE_SWING_600: | ||
1981 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
1982 | case DP_TRAIN_VOLTAGE_SWING_800: | ||
1983 | return DP_TRAIN_PRE_EMPHASIS_3_5; | ||
1984 | case DP_TRAIN_VOLTAGE_SWING_1200: | ||
1985 | default: | ||
1986 | return DP_TRAIN_PRE_EMPHASIS_0; | ||
1987 | } | ||
1988 | } else if (IS_HASWELL(dev)) { | ||
1978 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | 1989 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { |
1979 | case DP_TRAIN_VOLTAGE_SWING_400: | 1990 | case DP_TRAIN_VOLTAGE_SWING_400: |
1980 | return DP_TRAIN_PRE_EMPHASIS_9_5; | 1991 | return DP_TRAIN_PRE_EMPHASIS_9_5; |
@@ -2286,6 +2297,41 @@ intel_hsw_signal_levels(uint8_t train_set) | |||
2286 | } | 2297 | } |
2287 | } | 2298 | } |
2288 | 2299 | ||
2300 | static uint32_t | ||
2301 | intel_bdw_signal_levels(uint8_t train_set) | ||
2302 | { | ||
2303 | int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK | | ||
2304 | DP_TRAIN_PRE_EMPHASIS_MASK); | ||
2305 | switch (signal_levels) { | ||
2306 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: | ||
2307 | return DDI_BUF_EMP_400MV_0DB_BDW; /* Sel0 */ | ||
2308 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
2309 | return DDI_BUF_EMP_400MV_3_5DB_BDW; /* Sel1 */ | ||
2310 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: | ||
2311 | return DDI_BUF_EMP_400MV_6DB_BDW; /* Sel2 */ | ||
2312 | |||
2313 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0: | ||
2314 | return DDI_BUF_EMP_600MV_0DB_BDW; /* Sel3 */ | ||
2315 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
2316 | return DDI_BUF_EMP_600MV_3_5DB_BDW; /* Sel4 */ | ||
2317 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6: | ||
2318 | return DDI_BUF_EMP_600MV_6DB_BDW; /* Sel5 */ | ||
2319 | |||
2320 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: | ||
2321 | return DDI_BUF_EMP_800MV_0DB_BDW; /* Sel6 */ | ||
2322 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
2323 | return DDI_BUF_EMP_800MV_3_5DB_BDW; /* Sel7 */ | ||
2324 | |||
2325 | case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0: | ||
2326 | return DDI_BUF_EMP_1200MV_0DB_BDW; /* Sel8 */ | ||
2327 | |||
2328 | default: | ||
2329 | DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:" | ||
2330 | "0x%x\n", signal_levels); | ||
2331 | return DDI_BUF_EMP_400MV_0DB_BDW; /* Sel0 */ | ||
2332 | } | ||
2333 | } | ||
2334 | |||
2289 | /* Properly updates "DP" with the correct signal levels. */ | 2335 | /* Properly updates "DP" with the correct signal levels. */ |
2290 | static void | 2336 | static void |
2291 | intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) | 2337 | intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) |
@@ -2296,7 +2342,10 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP) | |||
2296 | uint32_t signal_levels, mask; | 2342 | uint32_t signal_levels, mask; |
2297 | uint8_t train_set = intel_dp->train_set[0]; | 2343 | uint8_t train_set = intel_dp->train_set[0]; |
2298 | 2344 | ||
2299 | if (HAS_DDI(dev)) { | 2345 | if (IS_BROADWELL(dev)) { |
2346 | signal_levels = intel_bdw_signal_levels(train_set); | ||
2347 | mask = DDI_BUF_EMP_MASK; | ||
2348 | } else if (IS_HASWELL(dev)) { | ||
2300 | signal_levels = intel_hsw_signal_levels(train_set); | 2349 | signal_levels = intel_hsw_signal_levels(train_set); |
2301 | mask = DDI_BUF_EMP_MASK; | 2350 | mask = DDI_BUF_EMP_MASK; |
2302 | } else if (IS_VALLEYVIEW(dev)) { | 2351 | } else if (IS_VALLEYVIEW(dev)) { |