summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-12-09 05:17:45 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-12-09 05:17:45 +0000
commitda9ca334f0499db2ca5605c4e8b046a63c040f90 (patch)
treed98d8dc372160eca3d752c76ed4b7d63a1fa62a1 /sys/dev/pci/drm
parent84217ceb032e1a9e6701fe49d1e40fab3cec8f96 (diff)
Backport some commits from mainline linux to enable High Bit Rate 2
(HBR2) for Broadwell and non-ULX Haswell DisplayPort. This enables support for 3840x2160 60Hz SST. Initial patch from and tested by Scot Doyle. drm/i915: Enable 5.4Ghz (HBR2) link rate for Displayport 1.2-capable devices from Todd Previte 06ea66b6bb445043dc25a9626254d5c130093199 drm/i915: don't try DP_LINK_BW_5_4 on HSW ULX from Paulo Zanoni 9bbfd20abe5025adbb0ac75160bd2e41158a9e83 drm/i915/dp: add missing \n in the TPS3 debug message from Jani Nikula f8d8a672f9370278ae2c9752ad3021662dbc42fd drm/i915/dp: only use training pattern 3 on platforms that support it from Jani Nikula 7809a61176b385ebb3299ea43c58b1bb31ffb8c0
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.h5
-rw-r--r--sys/dev/pci/drm/i915/intel_dp.c35
-rw-r--r--sys/dev/pci/drm/i915/intel_drv.h3
-rw-r--r--sys/dev/pci/drm/i915_pciids.h6
4 files changed, 37 insertions, 12 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h
index 21e99f91a06..420b1f0375d 100644
--- a/sys/dev/pci/drm/i915/i915_drv.h
+++ b/sys/dev/pci/drm/i915/i915_drv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_drv.h,v 1.72 2015/11/01 14:07:43 jsg Exp $ */
+/* $OpenBSD: i915_drv.h,v 1.73 2015/12/09 05:17:44 jsg Exp $ */
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
*/
/*
@@ -1954,6 +1954,9 @@ struct drm_i915_file_private {
#define IS_ULT(dev) (IS_HSW_ULT(dev) || IS_BDW_ULT(dev))
#define IS_HSW_GT3(dev) (IS_HASWELL(dev) && \
((dev)->pdev->device & 0x00F0) == 0x0020)
+/* ULX machines are also considered ULT. */
+#define IS_HSW_ULX(dev) ((dev)->pdev->device == 0x0A0E || \
+ (dev)->pdev->device == 0x0A1E)
#define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
/*
diff --git a/sys/dev/pci/drm/i915/intel_dp.c b/sys/dev/pci/drm/i915/intel_dp.c
index 72c520d2ece..f1cd909bcee 100644
--- a/sys/dev/pci/drm/i915/intel_dp.c
+++ b/sys/dev/pci/drm/i915/intel_dp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_dp.c,v 1.26 2015/09/23 23:12:12 kettenis Exp $ */
+/* $OpenBSD: intel_dp.c,v 1.27 2015/12/09 05:17:44 jsg Exp $ */
/*
* Copyright © 2008 Intel Corporation
*
@@ -94,13 +94,19 @@ static int
intel_dp_max_link_bw(struct intel_dp *intel_dp)
{
int max_link_bw = intel_dp->dpcd[DP_MAX_LINK_RATE];
+ struct drm_device *dev = intel_dp->attached_connector->base.dev;
switch (max_link_bw) {
case DP_LINK_BW_1_62:
case DP_LINK_BW_2_7:
break;
case DP_LINK_BW_5_4: /* 1.2 capable displays may advertise higher bw */
- max_link_bw = DP_LINK_BW_2_7;
+ if (((IS_HASWELL(dev) && !IS_HSW_ULX(dev)) ||
+ INTEL_INFO(dev)->gen >= 8) &&
+ intel_dp->dpcd[DP_DPCD_REV] >= 0x12)
+ max_link_bw = DP_LINK_BW_5_4;
+ else
+ max_link_bw = DP_LINK_BW_2_7;
break;
default:
WARN(1, "invalid max DP link bw val %x, using 1.62Gbps\n",
@@ -847,9 +853,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
struct intel_connector *intel_connector = intel_dp->attached_connector;
int lane_count, clock;
int max_lane_count = drm_dp_max_lane_count(intel_dp->dpcd);
- int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0;
+ /* Conveniently, the link BW constants become indices with a shift...*/
+ int max_clock = intel_dp_max_link_bw(intel_dp) >> 3;
int bpp, mode_rate;
- static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
+ static int bws[] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7, DP_LINK_BW_5_4 };
int link_avail, link_clock;
if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev) && port != PORT_A)
@@ -2673,10 +2680,15 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
bool channel_eq = false;
int tries, cr_tries;
uint32_t DP = intel_dp->DP;
+ uint32_t training_pattern = DP_TRAINING_PATTERN_2;
+
+ /* Training Pattern 3 for HBR2 ot 1.2 devices that support it*/
+ if (intel_dp->link_bw == DP_LINK_BW_5_4 || intel_dp->use_tps3)
+ training_pattern = DP_TRAINING_PATTERN_3;
/* channel equalization */
if (!intel_dp_set_link_train(intel_dp, &DP,
- DP_TRAINING_PATTERN_2 |
+ training_pattern |
DP_LINK_SCRAMBLING_DISABLE)) {
DRM_ERROR("failed to start channel equalization\n");
return;
@@ -2703,7 +2715,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
if (!drm_dp_clock_recovery_ok(link_status, intel_dp->lane_count)) {
intel_dp_start_link_train(intel_dp);
intel_dp_set_link_train(intel_dp, &DP,
- DP_TRAINING_PATTERN_2 |
+ training_pattern |
DP_LINK_SCRAMBLING_DISABLE);
cr_tries++;
continue;
@@ -2719,7 +2731,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
intel_dp_link_down(intel_dp);
intel_dp_start_link_train(intel_dp);
intel_dp_set_link_train(intel_dp, &DP,
- DP_TRAINING_PATTERN_2 |
+ training_pattern |
DP_LINK_SCRAMBLING_DISABLE);
tries = 0;
cr_tries++;
@@ -2865,6 +2877,15 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
}
}
+ /* Training Pattern 3 support, both source and sink */
+ if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 &&
+ intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED &&
+ (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8)) {
+ intel_dp->use_tps3 = true;
+ DRM_DEBUG_KMS("Displayport TPS3 supported\n");
+ } else
+ intel_dp->use_tps3 = false;
+
if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
DP_DWN_STRM_PORT_PRESENT))
return true; /* native DP sink */
diff --git a/sys/dev/pci/drm/i915/intel_drv.h b/sys/dev/pci/drm/i915/intel_drv.h
index d90a38eb005..d536066c522 100644
--- a/sys/dev/pci/drm/i915/intel_drv.h
+++ b/sys/dev/pci/drm/i915/intel_drv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intel_drv.h,v 1.8 2015/09/23 23:12:12 kettenis Exp $ */
+/* $OpenBSD: intel_drv.h,v 1.9 2015/12/09 05:17:44 jsg Exp $ */
/*
* Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
* Copyright (c) 2007-2008 Intel Corporation
@@ -497,6 +497,7 @@ struct intel_dp {
struct delayed_work panel_vdd_work;
bool want_panel_vdd;
bool psr_setup_done;
+ bool use_tps3;
struct intel_connector *attached_connector;
};
diff --git a/sys/dev/pci/drm/i915_pciids.h b/sys/dev/pci/drm/i915_pciids.h
index eda241a919e..9798a3be6c7 100644
--- a/sys/dev/pci/drm/i915_pciids.h
+++ b/sys/dev/pci/drm/i915_pciids.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_pciids.h,v 1.1 2015/09/23 23:12:11 kettenis Exp $ */
+/* $OpenBSD: i915_pciids.h,v 1.2 2015/12/09 05:17:44 jsg Exp $ */
/*
* Copyright 2013 Intel Corporation
* All Rights Reserved.
@@ -192,8 +192,8 @@
INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \
INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \
INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \
- INTEL_VGA_DEVICE(0x0A0E, info), /* ULT GT1 reserved */ \
- INTEL_VGA_DEVICE(0x0A1E, info), /* ULT GT2 reserved */ \
+ INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \
+ INTEL_VGA_DEVICE(0x0A1E, info), /* ULX GT2 mobile */ \
INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \
INTEL_VGA_DEVICE(0x0D06, info), /* CRW GT1 mobile */ \
INTEL_VGA_DEVICE(0x0D16, info), /* CRW GT2 mobile */ \