aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-08-30 20:06:22 -0400
committerDave Airlie <airlied@redhat.com>2015-08-30 20:06:22 -0400
commit701078d538e5b2bec95cbbc53cca71c120cd063f (patch)
tree51c98a6859ee724011ca43edd4f3748702a55dca
parentd3e8ea50922d90aea473474bdcede34ce743e1a5 (diff)
parent26951caf55d73ceb1967b0bf12f6d0b96853508e (diff)
Merge tag 'drm-intel-next-fixes-2015-08-28' of git://anongit.freedesktop.org/drm-intel into drm-next
Some i915 fixes headed for v4.3. SKL DDI-E is a wip, but here's the first in a series. * tag 'drm-intel-next-fixes-2015-08-28' of git://anongit.freedesktop.org/drm-intel: drm/i915/skl: enable DDI-E hotplug drm/i915: Fix build warning on 32-bit drm/i915/skl: Update DDI buffer translation programming. drm/i915: Allow parsing of variable size child device entries from VBT drm/i915: fix link rates reported for SKL drm/i915: fix VBT parsing for SDVO child device mapping
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h1
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c2
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c48
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h12
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c87
-rw-r--r--drivers/gpu/drm/i915/intel_bios.h6
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c75
-rw-r--r--drivers/gpu/drm/i915/intel_display.c3
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c22
-rw-r--r--drivers/gpu/drm/i915/intel_hotplug.c3
10 files changed, 165 insertions, 94 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 599441beea17..089459b39771 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -214,6 +214,7 @@ enum hpd_pin {
214 HPD_PORT_B, 214 HPD_PORT_B,
215 HPD_PORT_C, 215 HPD_PORT_C,
216 HPD_PORT_D, 216 HPD_PORT_D,
217 HPD_PORT_E,
217 HPD_NUM_PINS 218 HPD_NUM_PINS
218}; 219};
219 220
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index a36cb95ec798..f361c4a56995 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -348,7 +348,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
348 * memory, so just consider the start. */ 348 * memory, so just consider the start. */
349 reserved_total = stolen_top - reserved_base; 349 reserved_total = stolen_top - reserved_base;
350 350
351 DRM_DEBUG_KMS("Memory reserved for graphics device: %luK, usable: %luK\n", 351 DRM_DEBUG_KMS("Memory reserved for graphics device: %zuK, usable: %luK\n",
352 dev_priv->gtt.stolen_size >> 10, 352 dev_priv->gtt.stolen_size >> 10,
353 (dev_priv->gtt.stolen_size - reserved_total) >> 10); 353 (dev_priv->gtt.stolen_size - reserved_total) >> 10);
354 354
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 1118c39281f9..d94c92d842fb 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
61 [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT 61 [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
62}; 62};
63 63
64static const u32 hpd_spt[HPD_NUM_PINS] = {
65 [HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
66 [HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
67 [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
68 [HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
69};
70
64static const u32 hpd_mask_i915[HPD_NUM_PINS] = { 71static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
65 [HPD_CRT] = CRT_HOTPLUG_INT_EN, 72 [HPD_CRT] = CRT_HOTPLUG_INT_EN,
66 [HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN, 73 [HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
@@ -1252,6 +1259,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)
1252 return val & PORTC_HOTPLUG_LONG_DETECT; 1259 return val & PORTC_HOTPLUG_LONG_DETECT;
1253 case PORT_D: 1260 case PORT_D:
1254 return val & PORTD_HOTPLUG_LONG_DETECT; 1261 return val & PORTD_HOTPLUG_LONG_DETECT;
1262 case PORT_E:
1263 return val & PORTE_HOTPLUG_LONG_DETECT;
1255 default: 1264 default:
1256 return false; 1265 return false;
1257 } 1266 }
@@ -1752,7 +1761,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
1752{ 1761{
1753 struct drm_i915_private *dev_priv = dev->dev_private; 1762 struct drm_i915_private *dev_priv = dev->dev_private;
1754 int pipe; 1763 int pipe;
1755 u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT; 1764 u32 hotplug_trigger;
1765
1766 if (HAS_PCH_SPT(dev))
1767 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
1768 else
1769 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
1756 1770
1757 if (hotplug_trigger) { 1771 if (hotplug_trigger) {
1758 u32 dig_hotplug_reg, pin_mask, long_mask; 1772 u32 dig_hotplug_reg, pin_mask, long_mask;
@@ -1760,9 +1774,23 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
1760 dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG); 1774 dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
1761 I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg); 1775 I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
1762 1776
1763 intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger, 1777 if (HAS_PCH_SPT(dev)) {
1764 dig_hotplug_reg, hpd_cpt, 1778 intel_get_hpd_pins(&pin_mask, &long_mask,
1765 pch_port_hotplug_long_detect); 1779 hotplug_trigger,
1780 dig_hotplug_reg, hpd_spt,
1781 pch_port_hotplug_long_detect);
1782
1783 /* detect PORTE HP event */
1784 dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
1785 if (pch_port_hotplug_long_detect(PORT_E,
1786 dig_hotplug_reg))
1787 long_mask |= 1 << HPD_PORT_E;
1788 } else
1789 intel_get_hpd_pins(&pin_mask, &long_mask,
1790 hotplug_trigger,
1791 dig_hotplug_reg, hpd_cpt,
1792 pch_port_hotplug_long_detect);
1793
1766 intel_hpd_irq_handler(dev, pin_mask, long_mask); 1794 intel_hpd_irq_handler(dev, pin_mask, long_mask);
1767 } 1795 }
1768 1796
@@ -2984,6 +3012,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
2984 for_each_intel_encoder(dev, intel_encoder) 3012 for_each_intel_encoder(dev, intel_encoder)
2985 if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED) 3013 if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
2986 enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin]; 3014 enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
3015 } else if (HAS_PCH_SPT(dev)) {
3016 hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
3017 for_each_intel_encoder(dev, intel_encoder)
3018 if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
3019 enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];
2987 } else { 3020 } else {
2988 hotplug_irqs = SDE_HOTPLUG_MASK_CPT; 3021 hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
2989 for_each_intel_encoder(dev, intel_encoder) 3022 for_each_intel_encoder(dev, intel_encoder)
@@ -3005,6 +3038,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
3005 hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms; 3038 hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
3006 hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms; 3039 hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
3007 I915_WRITE(PCH_PORT_HOTPLUG, hotplug); 3040 I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
3041
3042 /* enable SPT PORTE hot plug */
3043 if (HAS_PCH_SPT(dev)) {
3044 hotplug = I915_READ(PCH_PORT_HOTPLUG2);
3045 hotplug |= PORTE_HOTPLUG_ENABLE;
3046 I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
3047 }
3008} 3048}
3009 3049
3010static void bxt_hpd_irq_setup(struct drm_device *dev) 3050static void bxt_hpd_irq_setup(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 8e46c348366b..83a0888756d6 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5949,6 +5949,7 @@ enum skl_disp_power_wells {
5949#define SDE_AUXC_CPT (1 << 26) 5949#define SDE_AUXC_CPT (1 << 26)
5950#define SDE_AUXB_CPT (1 << 25) 5950#define SDE_AUXB_CPT (1 << 25)
5951#define SDE_AUX_MASK_CPT (7 << 25) 5951#define SDE_AUX_MASK_CPT (7 << 25)
5952#define SDE_PORTE_HOTPLUG_SPT (1 << 25)
5952#define SDE_PORTD_HOTPLUG_CPT (1 << 23) 5953#define SDE_PORTD_HOTPLUG_CPT (1 << 23)
5953#define SDE_PORTC_HOTPLUG_CPT (1 << 22) 5954#define SDE_PORTC_HOTPLUG_CPT (1 << 22)
5954#define SDE_PORTB_HOTPLUG_CPT (1 << 21) 5955#define SDE_PORTB_HOTPLUG_CPT (1 << 21)
@@ -5959,6 +5960,10 @@ enum skl_disp_power_wells {
5959 SDE_PORTD_HOTPLUG_CPT | \ 5960 SDE_PORTD_HOTPLUG_CPT | \
5960 SDE_PORTC_HOTPLUG_CPT | \ 5961 SDE_PORTC_HOTPLUG_CPT | \
5961 SDE_PORTB_HOTPLUG_CPT) 5962 SDE_PORTB_HOTPLUG_CPT)
5963#define SDE_HOTPLUG_MASK_SPT (SDE_PORTE_HOTPLUG_SPT | \
5964 SDE_PORTD_HOTPLUG_CPT | \
5965 SDE_PORTC_HOTPLUG_CPT | \
5966 SDE_PORTB_HOTPLUG_CPT)
5962#define SDE_GMBUS_CPT (1 << 17) 5967#define SDE_GMBUS_CPT (1 << 17)
5963#define SDE_ERROR_CPT (1 << 16) 5968#define SDE_ERROR_CPT (1 << 16)
5964#define SDE_AUDIO_CP_REQ_C_CPT (1 << 10) 5969#define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)
@@ -6030,6 +6035,13 @@ enum skl_disp_power_wells {
6030#define PORTB_HOTPLUG_SHORT_DETECT (1 << 0) 6035#define PORTB_HOTPLUG_SHORT_DETECT (1 << 0)
6031#define PORTB_HOTPLUG_LONG_DETECT (2 << 0) 6036#define PORTB_HOTPLUG_LONG_DETECT (2 << 0)
6032 6037
6038#define PCH_PORT_HOTPLUG2 0xc403C /* SHOTPLUG_CTL2 */
6039#define PORTE_HOTPLUG_ENABLE (1 << 4)
6040#define PORTE_HOTPLUG_STATUS_MASK (0x3 << 0)
6041#define PORTE_HOTPLUG_NO_DETECT (0 << 0)
6042#define PORTE_HOTPLUG_SHORT_DETECT (1 << 0)
6043#define PORTE_HOTPLUG_LONG_DETECT (2 << 0)
6044
6033#define PCH_GPIOA 0xc5010 6045#define PCH_GPIOA 0xc5010
6034#define PCH_GPIOB 0xc5014 6046#define PCH_GPIOB 0xc5014
6035#define PCH_GPIOC 0xc5018 6047#define PCH_GPIOC 0xc5018
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c5b82fed95be..be83b77aa018 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -401,7 +401,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
401{ 401{
402 struct sdvo_device_mapping *p_mapping; 402 struct sdvo_device_mapping *p_mapping;
403 const struct bdb_general_definitions *p_defs; 403 const struct bdb_general_definitions *p_defs;
404 const union child_device_config *p_child; 404 const struct old_child_dev_config *child; /* legacy */
405 int i, child_device_num, count; 405 int i, child_device_num, count;
406 u16 block_size; 406 u16 block_size;
407 407
@@ -410,14 +410,14 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
410 DRM_DEBUG_KMS("No general definition block is found, unable to construct sdvo mapping.\n"); 410 DRM_DEBUG_KMS("No general definition block is found, unable to construct sdvo mapping.\n");
411 return; 411 return;
412 } 412 }
413 /* judge whether the size of child device meets the requirements. 413
414 * If the child device size obtained from general definition block 414 /*
415 * is different with sizeof(struct child_device_config), skip the 415 * Only parse SDVO mappings when the general definitions block child
416 * parsing of sdvo device info 416 * device size matches that of the *legacy* child device config
417 * struct. Thus, SDVO mapping will be skipped for newer VBT.
417 */ 418 */
418 if (p_defs->child_dev_size != sizeof(*p_child)) { 419 if (p_defs->child_dev_size != sizeof(*child)) {
419 /* different child dev size . Ignore it */ 420 DRM_DEBUG_KMS("Unsupported child device size for SDVO mapping.\n");
420 DRM_DEBUG_KMS("different child size is found. Invalid.\n");
421 return; 421 return;
422 } 422 }
423 /* get the block size of general definitions */ 423 /* get the block size of general definitions */
@@ -427,37 +427,37 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
427 p_defs->child_dev_size; 427 p_defs->child_dev_size;
428 count = 0; 428 count = 0;
429 for (i = 0; i < child_device_num; i++) { 429 for (i = 0; i < child_device_num; i++) {
430 p_child = child_device_ptr(p_defs, i); 430 child = &child_device_ptr(p_defs, i)->old;
431 if (!p_child->old.device_type) { 431 if (!child->device_type) {
432 /* skip the device block if device type is invalid */ 432 /* skip the device block if device type is invalid */
433 continue; 433 continue;
434 } 434 }
435 if (p_child->old.slave_addr != SLAVE_ADDR1 && 435 if (child->slave_addr != SLAVE_ADDR1 &&
436 p_child->old.slave_addr != SLAVE_ADDR2) { 436 child->slave_addr != SLAVE_ADDR2) {
437 /* 437 /*
438 * If the slave address is neither 0x70 nor 0x72, 438 * If the slave address is neither 0x70 nor 0x72,
439 * it is not a SDVO device. Skip it. 439 * it is not a SDVO device. Skip it.
440 */ 440 */
441 continue; 441 continue;
442 } 442 }
443 if (p_child->old.dvo_port != DEVICE_PORT_DVOB && 443 if (child->dvo_port != DEVICE_PORT_DVOB &&
444 p_child->old.dvo_port != DEVICE_PORT_DVOC) { 444 child->dvo_port != DEVICE_PORT_DVOC) {
445 /* skip the incorrect SDVO port */ 445 /* skip the incorrect SDVO port */
446 DRM_DEBUG_KMS("Incorrect SDVO port. Skip it\n"); 446 DRM_DEBUG_KMS("Incorrect SDVO port. Skip it\n");
447 continue; 447 continue;
448 } 448 }
449 DRM_DEBUG_KMS("the SDVO device with slave addr %2x is found on" 449 DRM_DEBUG_KMS("the SDVO device with slave addr %2x is found on"
450 " %s port\n", 450 " %s port\n",
451 p_child->old.slave_addr, 451 child->slave_addr,
452 (p_child->old.dvo_port == DEVICE_PORT_DVOB) ? 452 (child->dvo_port == DEVICE_PORT_DVOB) ?
453 "SDVOB" : "SDVOC"); 453 "SDVOB" : "SDVOC");
454 p_mapping = &(dev_priv->sdvo_mappings[p_child->old.dvo_port - 1]); 454 p_mapping = &(dev_priv->sdvo_mappings[child->dvo_port - 1]);
455 if (!p_mapping->initialized) { 455 if (!p_mapping->initialized) {
456 p_mapping->dvo_port = p_child->old.dvo_port; 456 p_mapping->dvo_port = child->dvo_port;
457 p_mapping->slave_addr = p_child->old.slave_addr; 457 p_mapping->slave_addr = child->slave_addr;
458 p_mapping->dvo_wiring = p_child->old.dvo_wiring; 458 p_mapping->dvo_wiring = child->dvo_wiring;
459 p_mapping->ddc_pin = p_child->old.ddc_pin; 459 p_mapping->ddc_pin = child->ddc_pin;
460 p_mapping->i2c_pin = p_child->old.i2c_pin; 460 p_mapping->i2c_pin = child->i2c_pin;
461 p_mapping->initialized = 1; 461 p_mapping->initialized = 1;
462 DRM_DEBUG_KMS("SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n", 462 DRM_DEBUG_KMS("SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n",
463 p_mapping->dvo_port, 463 p_mapping->dvo_port,
@@ -469,7 +469,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
469 DRM_DEBUG_KMS("Maybe one SDVO port is shared by " 469 DRM_DEBUG_KMS("Maybe one SDVO port is shared by "
470 "two SDVO device.\n"); 470 "two SDVO device.\n");
471 } 471 }
472 if (p_child->old.slave2_addr) { 472 if (child->slave2_addr) {
473 /* Maybe this is a SDVO device with multiple inputs */ 473 /* Maybe this is a SDVO device with multiple inputs */
474 /* And the mapping info is not added */ 474 /* And the mapping info is not added */
475 DRM_DEBUG_KMS("there exists the slave2_addr. Maybe this" 475 DRM_DEBUG_KMS("there exists the slave2_addr. Maybe this"
@@ -1051,17 +1051,39 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
1051 const union child_device_config *p_child; 1051 const union child_device_config *p_child;
1052 union child_device_config *child_dev_ptr; 1052 union child_device_config *child_dev_ptr;
1053 int i, child_device_num, count; 1053 int i, child_device_num, count;
1054 u16 block_size; 1054 u8 expected_size;
1055 u16 block_size;
1055 1056
1056 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); 1057 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
1057 if (!p_defs) { 1058 if (!p_defs) {
1058 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n"); 1059 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
1059 return; 1060 return;
1060 } 1061 }
1061 if (p_defs->child_dev_size < sizeof(*p_child)) { 1062 if (bdb->version < 195) {
1062 DRM_ERROR("General definiton block child device size is too small.\n"); 1063 expected_size = sizeof(struct old_child_dev_config);
1064 } else if (bdb->version == 195) {
1065 expected_size = 37;
1066 } else if (bdb->version <= 197) {
1067 expected_size = 38;
1068 } else {
1069 expected_size = 38;
1070 BUILD_BUG_ON(sizeof(*p_child) < 38);
1071 DRM_DEBUG_DRIVER("Expected child device config size for VBT version %u not known; assuming %u\n",
1072 bdb->version, expected_size);
1073 }
1074
1075 /* The legacy sized child device config is the minimum we need. */
1076 if (p_defs->child_dev_size < sizeof(struct old_child_dev_config)) {
1077 DRM_ERROR("Child device config size %u is too small.\n",
1078 p_defs->child_dev_size);
1063 return; 1079 return;
1064 } 1080 }
1081
1082 /* Flag an error for unexpected size, but continue anyway. */
1083 if (p_defs->child_dev_size != expected_size)
1084 DRM_ERROR("Unexpected child device config size %u (expected %u for VBT version %u)\n",
1085 p_defs->child_dev_size, expected_size, bdb->version);
1086
1065 /* get the block size of general definitions */ 1087 /* get the block size of general definitions */
1066 block_size = get_blocksize(p_defs); 1088 block_size = get_blocksize(p_defs);
1067 /* get the number of child device */ 1089 /* get the number of child device */
@@ -1106,7 +1128,14 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
1106 1128
1107 child_dev_ptr = dev_priv->vbt.child_dev + count; 1129 child_dev_ptr = dev_priv->vbt.child_dev + count;
1108 count++; 1130 count++;
1109 memcpy(child_dev_ptr, p_child, sizeof(*p_child)); 1131
1132 /*
1133 * Copy as much as we know (sizeof) and is available
1134 * (child_dev_size) of the child device. Accessing the data must
1135 * depend on VBT version.
1136 */
1137 memcpy(child_dev_ptr, p_child,
1138 min_t(size_t, p_defs->child_dev_size, sizeof(*p_child)));
1110 } 1139 }
1111 return; 1140 return;
1112} 1141}
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 6d909efbf43f..06d0dbde2be6 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -203,9 +203,11 @@ struct bdb_general_features {
203#define DEVICE_PORT_DVOB 0x01 203#define DEVICE_PORT_DVOB 0x01
204#define DEVICE_PORT_DVOC 0x02 204#define DEVICE_PORT_DVOC 0x02
205 205
206/* We used to keep this struct but without any version control. We should avoid 206/*
207 * We used to keep this struct but without any version control. We should avoid
207 * using it in the future, but it should be safe to keep using it in the old 208 * using it in the future, but it should be safe to keep using it in the old
208 * code. */ 209 * code. Do not change; we rely on its size.
210 */
209struct old_child_dev_config { 211struct old_child_dev_config {
210 u16 handle; 212 u16 handle;
211 u16 device_type; 213 u16 device_type;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 6cfe65d6a8cf..19004557c868 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -128,7 +128,7 @@ static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = {
128 { 0x80FFFFFF, 0x001B0002, 0x0 },/* 9: 1000 1000 0 */ 128 { 0x80FFFFFF, 0x001B0002, 0x0 },/* 9: 1000 1000 0 */
129}; 129};
130 130
131/* Skylake H, S, and Skylake Y with 0.95V VccIO */ 131/* Skylake H and S */
132static const struct ddi_buf_trans skl_ddi_translations_dp[] = { 132static const struct ddi_buf_trans skl_ddi_translations_dp[] = {
133 { 0x00002016, 0x000000A0, 0x0 }, 133 { 0x00002016, 0x000000A0, 0x0 },
134 { 0x00005012, 0x0000009B, 0x0 }, 134 { 0x00005012, 0x0000009B, 0x0 },
@@ -143,23 +143,23 @@ static const struct ddi_buf_trans skl_ddi_translations_dp[] = {
143 143
144/* Skylake U */ 144/* Skylake U */
145static const struct ddi_buf_trans skl_u_ddi_translations_dp[] = { 145static const struct ddi_buf_trans skl_u_ddi_translations_dp[] = {
146 { 0x00002016, 0x000000A2, 0x0 }, 146 { 0x0000201B, 0x000000A2, 0x0 },
147 { 0x00005012, 0x00000088, 0x0 }, 147 { 0x00005012, 0x00000088, 0x0 },
148 { 0x00007011, 0x00000087, 0x0 }, 148 { 0x00007011, 0x00000087, 0x0 },
149 { 0x80009010, 0x000000C7, 0x1 }, /* Uses I_boost */ 149 { 0x80009010, 0x000000C7, 0x1 }, /* Uses I_boost level 0x1 */
150 { 0x00002016, 0x0000009D, 0x0 }, 150 { 0x0000201B, 0x0000009D, 0x0 },
151 { 0x00005012, 0x000000C7, 0x0 }, 151 { 0x00005012, 0x000000C7, 0x0 },
152 { 0x00007011, 0x000000C7, 0x0 }, 152 { 0x00007011, 0x000000C7, 0x0 },
153 { 0x00002016, 0x00000088, 0x0 }, 153 { 0x00002016, 0x00000088, 0x0 },
154 { 0x00005012, 0x000000C7, 0x0 }, 154 { 0x00005012, 0x000000C7, 0x0 },
155}; 155};
156 156
157/* Skylake Y with 0.85V VccIO */ 157/* Skylake Y */
158static const struct ddi_buf_trans skl_y_085v_ddi_translations_dp[] = { 158static const struct ddi_buf_trans skl_y_ddi_translations_dp[] = {
159 { 0x00000018, 0x000000A2, 0x0 }, 159 { 0x00000018, 0x000000A2, 0x0 },
160 { 0x00005012, 0x00000088, 0x0 }, 160 { 0x00005012, 0x00000088, 0x0 },
161 { 0x00007011, 0x00000087, 0x0 }, 161 { 0x00007011, 0x00000087, 0x0 },
162 { 0x80009010, 0x000000C7, 0x1 }, /* Uses I_boost */ 162 { 0x80009010, 0x000000C7, 0x3 }, /* Uses I_boost level 0x3 */
163 { 0x00000018, 0x0000009D, 0x0 }, 163 { 0x00000018, 0x0000009D, 0x0 },
164 { 0x00005012, 0x000000C7, 0x0 }, 164 { 0x00005012, 0x000000C7, 0x0 },
165 { 0x00007011, 0x000000C7, 0x0 }, 165 { 0x00007011, 0x000000C7, 0x0 },
@@ -168,7 +168,7 @@ static const struct ddi_buf_trans skl_y_085v_ddi_translations_dp[] = {
168}; 168};
169 169
170/* 170/*
171 * Skylake H and S, and Skylake Y with 0.95V VccIO 171 * Skylake H and S
172 * eDP 1.4 low vswing translation parameters 172 * eDP 1.4 low vswing translation parameters
173 */ 173 */
174static const struct ddi_buf_trans skl_ddi_translations_edp[] = { 174static const struct ddi_buf_trans skl_ddi_translations_edp[] = {
@@ -202,10 +202,10 @@ static const struct ddi_buf_trans skl_u_ddi_translations_edp[] = {
202}; 202};
203 203
204/* 204/*
205 * Skylake Y with 0.95V VccIO 205 * Skylake Y
206 * eDP 1.4 low vswing translation parameters 206 * eDP 1.4 low vswing translation parameters
207 */ 207 */
208static const struct ddi_buf_trans skl_y_085v_ddi_translations_edp[] = { 208static const struct ddi_buf_trans skl_y_ddi_translations_edp[] = {
209 { 0x00000018, 0x000000A8, 0x0 }, 209 { 0x00000018, 0x000000A8, 0x0 },
210 { 0x00004013, 0x000000AB, 0x0 }, 210 { 0x00004013, 0x000000AB, 0x0 },
211 { 0x00007011, 0x000000A4, 0x0 }, 211 { 0x00007011, 0x000000A4, 0x0 },
@@ -218,7 +218,7 @@ static const struct ddi_buf_trans skl_y_085v_ddi_translations_edp[] = {
218 { 0x00000018, 0x0000008A, 0x0 }, 218 { 0x00000018, 0x0000008A, 0x0 },
219}; 219};
220 220
221/* Skylake H, S and U, and Skylake Y with 0.95V VccIO */ 221/* Skylake U, H and S */
222static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = { 222static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = {
223 { 0x00000018, 0x000000AC, 0x0 }, 223 { 0x00000018, 0x000000AC, 0x0 },
224 { 0x00005012, 0x0000009D, 0x0 }, 224 { 0x00005012, 0x0000009D, 0x0 },
@@ -233,8 +233,8 @@ static const struct ddi_buf_trans skl_ddi_translations_hdmi[] = {
233 { 0x00000018, 0x000000C7, 0x0 }, 233 { 0x00000018, 0x000000C7, 0x0 },
234}; 234};
235 235
236/* Skylake Y with 0.85V VccIO */ 236/* Skylake Y */
237static const struct ddi_buf_trans skl_y_085v_ddi_translations_hdmi[] = { 237static const struct ddi_buf_trans skl_y_ddi_translations_hdmi[] = {
238 { 0x00000018, 0x000000A1, 0x0 }, 238 { 0x00000018, 0x000000A1, 0x0 },
239 { 0x00005012, 0x000000DF, 0x0 }, 239 { 0x00005012, 0x000000DF, 0x0 },
240 { 0x00007011, 0x00000084, 0x0 }, 240 { 0x00007011, 0x00000084, 0x0 },
@@ -244,7 +244,7 @@ static const struct ddi_buf_trans skl_y_085v_ddi_translations_hdmi[] = {
244 { 0x00006013, 0x000000C7, 0x0 }, 244 { 0x00006013, 0x000000C7, 0x0 },
245 { 0x00000018, 0x0000008A, 0x0 }, 245 { 0x00000018, 0x0000008A, 0x0 },
246 { 0x00003015, 0x000000C7, 0x0 }, /* Default */ 246 { 0x00003015, 0x000000C7, 0x0 }, /* Default */
247 { 0x80003015, 0x000000C7, 0x7 }, /* Uses I_boost */ 247 { 0x80003015, 0x000000C7, 0x7 }, /* Uses I_boost level 0x7 */
248 { 0x00000018, 0x000000C7, 0x0 }, 248 { 0x00000018, 0x000000C7, 0x0 },
249}; 249};
250 250
@@ -335,19 +335,11 @@ intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
335static const struct ddi_buf_trans *skl_get_buf_trans_dp(struct drm_device *dev, 335static const struct ddi_buf_trans *skl_get_buf_trans_dp(struct drm_device *dev,
336 int *n_entries) 336 int *n_entries)
337{ 337{
338 struct drm_i915_private *dev_priv = dev->dev_private;
339 const struct ddi_buf_trans *ddi_translations; 338 const struct ddi_buf_trans *ddi_translations;
340 static int is_095v = -1;
341
342 if (is_095v == -1) {
343 u32 spr1 = I915_READ(UAIMI_SPR1);
344
345 is_095v = spr1 & SKL_VCCIO_MASK;
346 }
347 339
348 if (IS_SKL_ULX(dev) && !is_095v) { 340 if (IS_SKL_ULX(dev)) {
349 ddi_translations = skl_y_085v_ddi_translations_dp; 341 ddi_translations = skl_y_ddi_translations_dp;
350 *n_entries = ARRAY_SIZE(skl_y_085v_ddi_translations_dp); 342 *n_entries = ARRAY_SIZE(skl_y_ddi_translations_dp);
351 } else if (IS_SKL_ULT(dev)) { 343 } else if (IS_SKL_ULT(dev)) {
352 ddi_translations = skl_u_ddi_translations_dp; 344 ddi_translations = skl_u_ddi_translations_dp;
353 *n_entries = ARRAY_SIZE(skl_u_ddi_translations_dp); 345 *n_entries = ARRAY_SIZE(skl_u_ddi_translations_dp);
@@ -364,23 +356,14 @@ static const struct ddi_buf_trans *skl_get_buf_trans_edp(struct drm_device *dev,
364{ 356{
365 struct drm_i915_private *dev_priv = dev->dev_private; 357 struct drm_i915_private *dev_priv = dev->dev_private;
366 const struct ddi_buf_trans *ddi_translations; 358 const struct ddi_buf_trans *ddi_translations;
367 static int is_095v = -1;
368
369 if (is_095v == -1) {
370 u32 spr1 = I915_READ(UAIMI_SPR1);
371 359
372 is_095v = spr1 & SKL_VCCIO_MASK; 360 if (IS_SKL_ULX(dev)) {
373 }
374
375 if (IS_SKL_ULX(dev) && !is_095v) {
376 if (dev_priv->edp_low_vswing) { 361 if (dev_priv->edp_low_vswing) {
377 ddi_translations = skl_y_085v_ddi_translations_edp; 362 ddi_translations = skl_y_ddi_translations_edp;
378 *n_entries = 363 *n_entries = ARRAY_SIZE(skl_y_ddi_translations_edp);
379 ARRAY_SIZE(skl_y_085v_ddi_translations_edp);
380 } else { 364 } else {
381 ddi_translations = skl_y_085v_ddi_translations_dp; 365 ddi_translations = skl_y_ddi_translations_dp;
382 *n_entries = 366 *n_entries = ARRAY_SIZE(skl_y_ddi_translations_dp);
383 ARRAY_SIZE(skl_y_085v_ddi_translations_dp);
384 } 367 }
385 } else if (IS_SKL_ULT(dev)) { 368 } else if (IS_SKL_ULT(dev)) {
386 if (dev_priv->edp_low_vswing) { 369 if (dev_priv->edp_low_vswing) {
@@ -407,19 +390,11 @@ static const struct ddi_buf_trans *
407skl_get_buf_trans_hdmi(struct drm_device *dev, 390skl_get_buf_trans_hdmi(struct drm_device *dev,
408 int *n_entries) 391 int *n_entries)
409{ 392{
410 struct drm_i915_private *dev_priv = dev->dev_private;
411 const struct ddi_buf_trans *ddi_translations; 393 const struct ddi_buf_trans *ddi_translations;
412 static int is_095v = -1;
413
414 if (is_095v == -1) {
415 u32 spr1 = I915_READ(UAIMI_SPR1);
416
417 is_095v = spr1 & SKL_VCCIO_MASK;
418 }
419 394
420 if (IS_SKL_ULX(dev) && !is_095v) { 395 if (IS_SKL_ULX(dev)) {
421 ddi_translations = skl_y_085v_ddi_translations_hdmi; 396 ddi_translations = skl_y_ddi_translations_hdmi;
422 *n_entries = ARRAY_SIZE(skl_y_085v_ddi_translations_hdmi); 397 *n_entries = ARRAY_SIZE(skl_y_ddi_translations_hdmi);
423 } else { 398 } else {
424 ddi_translations = skl_ddi_translations_hdmi; 399 ddi_translations = skl_ddi_translations_hdmi;
425 *n_entries = ARRAY_SIZE(skl_ddi_translations_hdmi); 400 *n_entries = ARRAY_SIZE(skl_ddi_translations_hdmi);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 83936403502f..53f5476bc4bb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1098,6 +1098,9 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
1098 case PORT_D: 1098 case PORT_D:
1099 bit = SDE_PORTD_HOTPLUG_CPT; 1099 bit = SDE_PORTD_HOTPLUG_CPT;
1100 break; 1100 break;
1101 case PORT_E:
1102 bit = SDE_PORTE_HOTPLUG_SPT;
1103 break;
1101 default: 1104 default:
1102 return true; 1105 return true;
1103 } 1106 }
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d0f4eb793cf5..3781cd3e358a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1223,21 +1223,24 @@ static bool intel_dp_source_supports_hbr2(struct drm_device *dev)
1223static int 1223static int
1224intel_dp_source_rates(struct drm_device *dev, const int **source_rates) 1224intel_dp_source_rates(struct drm_device *dev, const int **source_rates)
1225{ 1225{
1226 int size;
1227
1226 if (IS_BROXTON(dev)) { 1228 if (IS_BROXTON(dev)) {
1227 *source_rates = bxt_rates; 1229 *source_rates = bxt_rates;
1228 return ARRAY_SIZE(bxt_rates); 1230 size = ARRAY_SIZE(bxt_rates);
1229 } else if (IS_SKYLAKE(dev)) { 1231 } else if (IS_SKYLAKE(dev)) {
1230 *source_rates = skl_rates; 1232 *source_rates = skl_rates;
1231 return ARRAY_SIZE(skl_rates); 1233 size = ARRAY_SIZE(skl_rates);
1234 } else {
1235 *source_rates = default_rates;
1236 size = ARRAY_SIZE(default_rates);
1232 } 1237 }
1233 1238
1234 *source_rates = default_rates;
1235
1236 /* This depends on the fact that 5.4 is last value in the array */ 1239 /* This depends on the fact that 5.4 is last value in the array */
1237 if (intel_dp_source_supports_hbr2(dev)) 1240 if (!intel_dp_source_supports_hbr2(dev))
1238 return (DP_LINK_BW_5_4 >> 3) + 1; 1241 size--;
1239 else 1242
1240 return (DP_LINK_BW_2_7 >> 3) + 1; 1243 return size;
1241} 1244}
1242 1245
1243static void 1246static void
@@ -5857,6 +5860,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
5857 case PORT_D: 5860 case PORT_D:
5858 intel_encoder->hpd_pin = HPD_PORT_D; 5861 intel_encoder->hpd_pin = HPD_PORT_D;
5859 break; 5862 break;
5863 case PORT_E:
5864 intel_encoder->hpd_pin = HPD_PORT_E;
5865 break;
5860 default: 5866 default:
5861 BUG(); 5867 BUG();
5862 } 5868 }
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 032a0bf75f3b..53c0173a39fe 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)
91 case HPD_PORT_D: 91 case HPD_PORT_D:
92 *port = PORT_D; 92 *port = PORT_D;
93 return true; 93 return true;
94 case HPD_PORT_E:
95 *port = PORT_E;
96 return true;
94 default: 97 default:
95 return false; /* no hpd */ 98 return false; /* no hpd */
96 } 99 }