diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 189 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 36 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_suspend.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 138 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 111 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 23 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 158 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_lvds.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 3 |
16 files changed, 591 insertions, 104 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 756af4d7ec74..7496d245f28c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1439,6 +1439,8 @@ EXPORT_SYMBOL(drm_detect_monitor_audio); | |||
1439 | static void drm_add_display_info(struct edid *edid, | 1439 | static void drm_add_display_info(struct edid *edid, |
1440 | struct drm_display_info *info) | 1440 | struct drm_display_info *info) |
1441 | { | 1441 | { |
1442 | u8 *edid_ext; | ||
1443 | |||
1442 | info->width_mm = edid->width_cm * 10; | 1444 | info->width_mm = edid->width_cm * 10; |
1443 | info->height_mm = edid->height_cm * 10; | 1445 | info->height_mm = edid->height_cm * 10; |
1444 | 1446 | ||
@@ -1483,6 +1485,13 @@ static void drm_add_display_info(struct edid *edid, | |||
1483 | info->color_formats = DRM_COLOR_FORMAT_YCRCB444; | 1485 | info->color_formats = DRM_COLOR_FORMAT_YCRCB444; |
1484 | if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422) | 1486 | if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422) |
1485 | info->color_formats = DRM_COLOR_FORMAT_YCRCB422; | 1487 | info->color_formats = DRM_COLOR_FORMAT_YCRCB422; |
1488 | |||
1489 | /* Get data from CEA blocks if present */ | ||
1490 | edid_ext = drm_find_cea_extension(edid); | ||
1491 | if (!edid_ext) | ||
1492 | return; | ||
1493 | |||
1494 | info->cea_rev = edid_ext[1]; | ||
1486 | } | 1495 | } |
1487 | 1496 | ||
1488 | /** | 1497 | /** |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index e2662497d50f..a8ab6263e0d7 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1338,6 +1338,155 @@ static const struct file_operations i915_wedged_fops = { | |||
1338 | .llseek = default_llseek, | 1338 | .llseek = default_llseek, |
1339 | }; | 1339 | }; |
1340 | 1340 | ||
1341 | static int | ||
1342 | i915_max_freq_open(struct inode *inode, | ||
1343 | struct file *filp) | ||
1344 | { | ||
1345 | filp->private_data = inode->i_private; | ||
1346 | return 0; | ||
1347 | } | ||
1348 | |||
1349 | static ssize_t | ||
1350 | i915_max_freq_read(struct file *filp, | ||
1351 | char __user *ubuf, | ||
1352 | size_t max, | ||
1353 | loff_t *ppos) | ||
1354 | { | ||
1355 | struct drm_device *dev = filp->private_data; | ||
1356 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1357 | char buf[80]; | ||
1358 | int len; | ||
1359 | |||
1360 | len = snprintf(buf, sizeof (buf), | ||
1361 | "max freq: %d\n", dev_priv->max_delay * 50); | ||
1362 | |||
1363 | if (len > sizeof (buf)) | ||
1364 | len = sizeof (buf); | ||
1365 | |||
1366 | return simple_read_from_buffer(ubuf, max, ppos, buf, len); | ||
1367 | } | ||
1368 | |||
1369 | static ssize_t | ||
1370 | i915_max_freq_write(struct file *filp, | ||
1371 | const char __user *ubuf, | ||
1372 | size_t cnt, | ||
1373 | loff_t *ppos) | ||
1374 | { | ||
1375 | struct drm_device *dev = filp->private_data; | ||
1376 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1377 | char buf[20]; | ||
1378 | int val = 1; | ||
1379 | |||
1380 | if (cnt > 0) { | ||
1381 | if (cnt > sizeof (buf) - 1) | ||
1382 | return -EINVAL; | ||
1383 | |||
1384 | if (copy_from_user(buf, ubuf, cnt)) | ||
1385 | return -EFAULT; | ||
1386 | buf[cnt] = 0; | ||
1387 | |||
1388 | val = simple_strtoul(buf, NULL, 0); | ||
1389 | } | ||
1390 | |||
1391 | DRM_DEBUG_DRIVER("Manually setting max freq to %d\n", val); | ||
1392 | |||
1393 | /* | ||
1394 | * Turbo will still be enabled, but won't go above the set value. | ||
1395 | */ | ||
1396 | dev_priv->max_delay = val / 50; | ||
1397 | |||
1398 | gen6_set_rps(dev, val / 50); | ||
1399 | |||
1400 | return cnt; | ||
1401 | } | ||
1402 | |||
1403 | static const struct file_operations i915_max_freq_fops = { | ||
1404 | .owner = THIS_MODULE, | ||
1405 | .open = i915_max_freq_open, | ||
1406 | .read = i915_max_freq_read, | ||
1407 | .write = i915_max_freq_write, | ||
1408 | .llseek = default_llseek, | ||
1409 | }; | ||
1410 | |||
1411 | static int | ||
1412 | i915_cache_sharing_open(struct inode *inode, | ||
1413 | struct file *filp) | ||
1414 | { | ||
1415 | filp->private_data = inode->i_private; | ||
1416 | return 0; | ||
1417 | } | ||
1418 | |||
1419 | static ssize_t | ||
1420 | i915_cache_sharing_read(struct file *filp, | ||
1421 | char __user *ubuf, | ||
1422 | size_t max, | ||
1423 | loff_t *ppos) | ||
1424 | { | ||
1425 | struct drm_device *dev = filp->private_data; | ||
1426 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1427 | char buf[80]; | ||
1428 | u32 snpcr; | ||
1429 | int len; | ||
1430 | |||
1431 | mutex_lock(&dev_priv->dev->struct_mutex); | ||
1432 | snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); | ||
1433 | mutex_unlock(&dev_priv->dev->struct_mutex); | ||
1434 | |||
1435 | len = snprintf(buf, sizeof (buf), | ||
1436 | "%d\n", (snpcr & GEN6_MBC_SNPCR_MASK) >> | ||
1437 | GEN6_MBC_SNPCR_SHIFT); | ||
1438 | |||
1439 | if (len > sizeof (buf)) | ||
1440 | len = sizeof (buf); | ||
1441 | |||
1442 | return simple_read_from_buffer(ubuf, max, ppos, buf, len); | ||
1443 | } | ||
1444 | |||
1445 | static ssize_t | ||
1446 | i915_cache_sharing_write(struct file *filp, | ||
1447 | const char __user *ubuf, | ||
1448 | size_t cnt, | ||
1449 | loff_t *ppos) | ||
1450 | { | ||
1451 | struct drm_device *dev = filp->private_data; | ||
1452 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1453 | char buf[20]; | ||
1454 | u32 snpcr; | ||
1455 | int val = 1; | ||
1456 | |||
1457 | if (cnt > 0) { | ||
1458 | if (cnt > sizeof (buf) - 1) | ||
1459 | return -EINVAL; | ||
1460 | |||
1461 | if (copy_from_user(buf, ubuf, cnt)) | ||
1462 | return -EFAULT; | ||
1463 | buf[cnt] = 0; | ||
1464 | |||
1465 | val = simple_strtoul(buf, NULL, 0); | ||
1466 | } | ||
1467 | |||
1468 | if (val < 0 || val > 3) | ||
1469 | return -EINVAL; | ||
1470 | |||
1471 | DRM_DEBUG_DRIVER("Manually setting uncore sharing to %d\n", val); | ||
1472 | |||
1473 | /* Update the cache sharing policy here as well */ | ||
1474 | snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); | ||
1475 | snpcr &= ~GEN6_MBC_SNPCR_MASK; | ||
1476 | snpcr |= (val << GEN6_MBC_SNPCR_SHIFT); | ||
1477 | I915_WRITE(GEN6_MBCUNIT_SNPCR, snpcr); | ||
1478 | |||
1479 | return cnt; | ||
1480 | } | ||
1481 | |||
1482 | static const struct file_operations i915_cache_sharing_fops = { | ||
1483 | .owner = THIS_MODULE, | ||
1484 | .open = i915_cache_sharing_open, | ||
1485 | .read = i915_cache_sharing_read, | ||
1486 | .write = i915_cache_sharing_write, | ||
1487 | .llseek = default_llseek, | ||
1488 | }; | ||
1489 | |||
1341 | /* As the drm_debugfs_init() routines are called before dev->dev_private is | 1490 | /* As the drm_debugfs_init() routines are called before dev->dev_private is |
1342 | * allocated we need to hook into the minor for release. */ | 1491 | * allocated we need to hook into the minor for release. */ |
1343 | static int | 1492 | static int |
@@ -1437,6 +1586,36 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor) | |||
1437 | return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops); | 1586 | return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops); |
1438 | } | 1587 | } |
1439 | 1588 | ||
1589 | static int i915_max_freq_create(struct dentry *root, struct drm_minor *minor) | ||
1590 | { | ||
1591 | struct drm_device *dev = minor->dev; | ||
1592 | struct dentry *ent; | ||
1593 | |||
1594 | ent = debugfs_create_file("i915_max_freq", | ||
1595 | S_IRUGO | S_IWUSR, | ||
1596 | root, dev, | ||
1597 | &i915_max_freq_fops); | ||
1598 | if (IS_ERR(ent)) | ||
1599 | return PTR_ERR(ent); | ||
1600 | |||
1601 | return drm_add_fake_info_node(minor, ent, &i915_max_freq_fops); | ||
1602 | } | ||
1603 | |||
1604 | static int i915_cache_sharing_create(struct dentry *root, struct drm_minor *minor) | ||
1605 | { | ||
1606 | struct drm_device *dev = minor->dev; | ||
1607 | struct dentry *ent; | ||
1608 | |||
1609 | ent = debugfs_create_file("i915_cache_sharing", | ||
1610 | S_IRUGO | S_IWUSR, | ||
1611 | root, dev, | ||
1612 | &i915_cache_sharing_fops); | ||
1613 | if (IS_ERR(ent)) | ||
1614 | return PTR_ERR(ent); | ||
1615 | |||
1616 | return drm_add_fake_info_node(minor, ent, &i915_cache_sharing_fops); | ||
1617 | } | ||
1618 | |||
1440 | static struct drm_info_list i915_debugfs_list[] = { | 1619 | static struct drm_info_list i915_debugfs_list[] = { |
1441 | {"i915_capabilities", i915_capabilities, 0}, | 1620 | {"i915_capabilities", i915_capabilities, 0}, |
1442 | {"i915_gem_objects", i915_gem_object_info, 0}, | 1621 | {"i915_gem_objects", i915_gem_object_info, 0}, |
@@ -1490,6 +1669,12 @@ int i915_debugfs_init(struct drm_minor *minor) | |||
1490 | ret = i915_forcewake_create(minor->debugfs_root, minor); | 1669 | ret = i915_forcewake_create(minor->debugfs_root, minor); |
1491 | if (ret) | 1670 | if (ret) |
1492 | return ret; | 1671 | return ret; |
1672 | ret = i915_max_freq_create(minor->debugfs_root, minor); | ||
1673 | if (ret) | ||
1674 | return ret; | ||
1675 | ret = i915_cache_sharing_create(minor->debugfs_root, minor); | ||
1676 | if (ret) | ||
1677 | return ret; | ||
1493 | 1678 | ||
1494 | return drm_debugfs_create_files(i915_debugfs_list, | 1679 | return drm_debugfs_create_files(i915_debugfs_list, |
1495 | I915_DEBUGFS_ENTRIES, | 1680 | I915_DEBUGFS_ENTRIES, |
@@ -1504,6 +1689,10 @@ void i915_debugfs_cleanup(struct drm_minor *minor) | |||
1504 | 1, minor); | 1689 | 1, minor); |
1505 | drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops, | 1690 | drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops, |
1506 | 1, minor); | 1691 | 1, minor); |
1692 | drm_debugfs_remove_files((struct drm_info_list *) &i915_max_freq_fops, | ||
1693 | 1, minor); | ||
1694 | drm_debugfs_remove_files((struct drm_info_list *) &i915_cache_sharing_fops, | ||
1695 | 1, minor); | ||
1507 | } | 1696 | } |
1508 | 1697 | ||
1509 | #endif /* CONFIG_DEBUG_FS */ | 1698 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 12712824a6d2..8a3942c4f099 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -61,7 +61,6 @@ static void i915_write_hws_pga(struct drm_device *dev) | |||
61 | static int i915_init_phys_hws(struct drm_device *dev) | 61 | static int i915_init_phys_hws(struct drm_device *dev) |
62 | { | 62 | { |
63 | drm_i915_private_t *dev_priv = dev->dev_private; | 63 | drm_i915_private_t *dev_priv = dev->dev_private; |
64 | struct intel_ring_buffer *ring = LP_RING(dev_priv); | ||
65 | 64 | ||
66 | /* Program Hardware Status Page */ | 65 | /* Program Hardware Status Page */ |
67 | dev_priv->status_page_dmah = | 66 | dev_priv->status_page_dmah = |
@@ -71,10 +70,9 @@ static int i915_init_phys_hws(struct drm_device *dev) | |||
71 | DRM_ERROR("Can not allocate hardware status page\n"); | 70 | DRM_ERROR("Can not allocate hardware status page\n"); |
72 | return -ENOMEM; | 71 | return -ENOMEM; |
73 | } | 72 | } |
74 | ring->status_page.page_addr = | ||
75 | (void __force __iomem *)dev_priv->status_page_dmah->vaddr; | ||
76 | 73 | ||
77 | memset_io(ring->status_page.page_addr, 0, PAGE_SIZE); | 74 | memset_io((void __force __iomem *)dev_priv->status_page_dmah->vaddr, |
75 | 0, PAGE_SIZE); | ||
78 | 76 | ||
79 | i915_write_hws_pga(dev); | 77 | i915_write_hws_pga(dev); |
80 | 78 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index ce045a8cf82c..60e4b9ef618b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -62,7 +62,7 @@ module_param_named(semaphores, i915_semaphores, int, 0600); | |||
62 | MODULE_PARM_DESC(semaphores, | 62 | MODULE_PARM_DESC(semaphores, |
63 | "Use semaphores for inter-ring sync (default: false)"); | 63 | "Use semaphores for inter-ring sync (default: false)"); |
64 | 64 | ||
65 | unsigned int i915_enable_rc6 __read_mostly = 0; | 65 | unsigned int i915_enable_rc6 __read_mostly = 1; |
66 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 66 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); |
67 | MODULE_PARM_DESC(i915_enable_rc6, | 67 | MODULE_PARM_DESC(i915_enable_rc6, |
68 | "Enable power-saving render C-state 6 (default: true)"); | 68 | "Enable power-saving render C-state 6 (default: true)"); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 6867e193d85e..feb4f164fd1b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -544,6 +544,7 @@ typedef struct drm_i915_private { | |||
544 | u32 savePIPEB_LINK_M1; | 544 | u32 savePIPEB_LINK_M1; |
545 | u32 savePIPEB_LINK_N1; | 545 | u32 savePIPEB_LINK_N1; |
546 | u32 saveMCHBAR_RENDER_STANDBY; | 546 | u32 saveMCHBAR_RENDER_STANDBY; |
547 | u32 savePCH_PORT_HOTPLUG; | ||
547 | 548 | ||
548 | struct { | 549 | struct { |
549 | /** Bridge to intel-gtt-ko */ | 550 | /** Bridge to intel-gtt-ko */ |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d1cd8b89f47d..a546a71fb060 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3112,7 +3112,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, | |||
3112 | 3112 | ||
3113 | if (pipelined != obj->ring) { | 3113 | if (pipelined != obj->ring) { |
3114 | ret = i915_gem_object_wait_rendering(obj); | 3114 | ret = i915_gem_object_wait_rendering(obj); |
3115 | if (ret) | 3115 | if (ret == -ERESTARTSYS) |
3116 | return ret; | 3116 | return ret; |
3117 | } | 3117 | } |
3118 | 3118 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 23d1ae67d279..02f96fd0d52d 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -306,12 +306,15 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
306 | struct drm_mode_config *mode_config = &dev->mode_config; | 306 | struct drm_mode_config *mode_config = &dev->mode_config; |
307 | struct intel_encoder *encoder; | 307 | struct intel_encoder *encoder; |
308 | 308 | ||
309 | mutex_lock(&mode_config->mutex); | ||
309 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | 310 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); |
310 | 311 | ||
311 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) | 312 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
312 | if (encoder->hot_plug) | 313 | if (encoder->hot_plug) |
313 | encoder->hot_plug(encoder); | 314 | encoder->hot_plug(encoder); |
314 | 315 | ||
316 | mutex_unlock(&mode_config->mutex); | ||
317 | |||
315 | /* Just fire off a uevent and let userspace tell us what to do */ | 318 | /* Just fire off a uevent and let userspace tell us what to do */ |
316 | drm_helper_hpd_irq_event(dev); | 319 | drm_helper_hpd_irq_event(dev); |
317 | } | 320 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 02db299f621a..d1331f771e2f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -78,6 +78,14 @@ | |||
78 | #define GRDOM_RENDER (1<<2) | 78 | #define GRDOM_RENDER (1<<2) |
79 | #define GRDOM_MEDIA (3<<2) | 79 | #define GRDOM_MEDIA (3<<2) |
80 | 80 | ||
81 | #define GEN6_MBCUNIT_SNPCR 0x900c /* for LLC config */ | ||
82 | #define GEN6_MBC_SNPCR_SHIFT 21 | ||
83 | #define GEN6_MBC_SNPCR_MASK (3<<21) | ||
84 | #define GEN6_MBC_SNPCR_MAX (0<<21) | ||
85 | #define GEN6_MBC_SNPCR_MED (1<<21) | ||
86 | #define GEN6_MBC_SNPCR_LOW (2<<21) | ||
87 | #define GEN6_MBC_SNPCR_MIN (3<<21) /* only 1/16th of the cache is shared */ | ||
88 | |||
81 | #define GEN6_GDRST 0x941c | 89 | #define GEN6_GDRST 0x941c |
82 | #define GEN6_GRDOM_FULL (1 << 0) | 90 | #define GEN6_GRDOM_FULL (1 << 0) |
83 | #define GEN6_GRDOM_RENDER (1 << 1) | 91 | #define GEN6_GRDOM_RENDER (1 << 1) |
@@ -1506,6 +1514,7 @@ | |||
1506 | #define VIDEO_DIP_SELECT_AVI (0 << 19) | 1514 | #define VIDEO_DIP_SELECT_AVI (0 << 19) |
1507 | #define VIDEO_DIP_SELECT_VENDOR (1 << 19) | 1515 | #define VIDEO_DIP_SELECT_VENDOR (1 << 19) |
1508 | #define VIDEO_DIP_SELECT_SPD (3 << 19) | 1516 | #define VIDEO_DIP_SELECT_SPD (3 << 19) |
1517 | #define VIDEO_DIP_SELECT_MASK (3 << 19) | ||
1509 | #define VIDEO_DIP_FREQ_ONCE (0 << 16) | 1518 | #define VIDEO_DIP_FREQ_ONCE (0 << 16) |
1510 | #define VIDEO_DIP_FREQ_VSYNC (1 << 16) | 1519 | #define VIDEO_DIP_FREQ_VSYNC (1 << 16) |
1511 | #define VIDEO_DIP_FREQ_2VSYNC (2 << 16) | 1520 | #define VIDEO_DIP_FREQ_2VSYNC (2 << 16) |
@@ -2084,9 +2093,6 @@ | |||
2084 | #define DP_PIPEB_SELECT (1 << 30) | 2093 | #define DP_PIPEB_SELECT (1 << 30) |
2085 | #define DP_PIPE_MASK (1 << 30) | 2094 | #define DP_PIPE_MASK (1 << 30) |
2086 | 2095 | ||
2087 | #define DP_PIPE_ENABLED(V, P) \ | ||
2088 | (((V) & (DP_PIPE_MASK | DP_PORT_EN)) == ((P) << 30 | DP_PORT_EN)) | ||
2089 | |||
2090 | /* Link training mode - select a suitable mode for each stage */ | 2096 | /* Link training mode - select a suitable mode for each stage */ |
2091 | #define DP_LINK_TRAIN_PAT_1 (0 << 28) | 2097 | #define DP_LINK_TRAIN_PAT_1 (0 << 28) |
2092 | #define DP_LINK_TRAIN_PAT_2 (1 << 28) | 2098 | #define DP_LINK_TRAIN_PAT_2 (1 << 28) |
@@ -3024,6 +3030,20 @@ | |||
3024 | #define _TRANSA_DP_LINK_M2 0xe0048 | 3030 | #define _TRANSA_DP_LINK_M2 0xe0048 |
3025 | #define _TRANSA_DP_LINK_N2 0xe004c | 3031 | #define _TRANSA_DP_LINK_N2 0xe004c |
3026 | 3032 | ||
3033 | /* Per-transcoder DIP controls */ | ||
3034 | |||
3035 | #define _VIDEO_DIP_CTL_A 0xe0200 | ||
3036 | #define _VIDEO_DIP_DATA_A 0xe0208 | ||
3037 | #define _VIDEO_DIP_GCP_A 0xe0210 | ||
3038 | |||
3039 | #define _VIDEO_DIP_CTL_B 0xe1200 | ||
3040 | #define _VIDEO_DIP_DATA_B 0xe1208 | ||
3041 | #define _VIDEO_DIP_GCP_B 0xe1210 | ||
3042 | |||
3043 | #define TVIDEO_DIP_CTL(pipe) _PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B) | ||
3044 | #define TVIDEO_DIP_DATA(pipe) _PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B) | ||
3045 | #define TVIDEO_DIP_GCP(pipe) _PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B) | ||
3046 | |||
3027 | #define _TRANS_HTOTAL_B 0xe1000 | 3047 | #define _TRANS_HTOTAL_B 0xe1000 |
3028 | #define _TRANS_HBLANK_B 0xe1004 | 3048 | #define _TRANS_HBLANK_B 0xe1004 |
3029 | #define _TRANS_HSYNC_B 0xe1008 | 3049 | #define _TRANS_HSYNC_B 0xe1008 |
@@ -3076,6 +3096,16 @@ | |||
3076 | #define TRANS_6BPC (2<<5) | 3096 | #define TRANS_6BPC (2<<5) |
3077 | #define TRANS_12BPC (3<<5) | 3097 | #define TRANS_12BPC (3<<5) |
3078 | 3098 | ||
3099 | #define _TRANSA_CHICKEN2 0xf0064 | ||
3100 | #define _TRANSB_CHICKEN2 0xf1064 | ||
3101 | #define TRANS_CHICKEN2(pipe) _PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2) | ||
3102 | #define TRANS_AUTOTRAIN_GEN_STALL_DIS (1<<31) | ||
3103 | |||
3104 | #define SOUTH_CHICKEN1 0xc2000 | ||
3105 | #define FDIA_PHASE_SYNC_SHIFT_OVR 19 | ||
3106 | #define FDIA_PHASE_SYNC_SHIFT_EN 18 | ||
3107 | #define FDI_PHASE_SYNC_OVR(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2))) | ||
3108 | #define FDI_PHASE_SYNC_EN(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2))) | ||
3079 | #define SOUTH_CHICKEN2 0xc2004 | 3109 | #define SOUTH_CHICKEN2 0xc2004 |
3080 | #define DPLS_EDP_PPS_FIX_DIS (1<<0) | 3110 | #define DPLS_EDP_PPS_FIX_DIS (1<<0) |
3081 | 3111 | ||
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 285758603ac8..87677d60d0df 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -812,6 +812,7 @@ int i915_save_state(struct drm_device *dev) | |||
812 | dev_priv->saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR); | 812 | dev_priv->saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR); |
813 | dev_priv->saveMCHBAR_RENDER_STANDBY = | 813 | dev_priv->saveMCHBAR_RENDER_STANDBY = |
814 | I915_READ(RSTDBYCTL); | 814 | I915_READ(RSTDBYCTL); |
815 | dev_priv->savePCH_PORT_HOTPLUG = I915_READ(PCH_PORT_HOTPLUG); | ||
815 | } else { | 816 | } else { |
816 | dev_priv->saveIER = I915_READ(IER); | 817 | dev_priv->saveIER = I915_READ(IER); |
817 | dev_priv->saveIMR = I915_READ(IMR); | 818 | dev_priv->saveIMR = I915_READ(IMR); |
@@ -863,6 +864,7 @@ int i915_restore_state(struct drm_device *dev) | |||
863 | I915_WRITE(GTIMR, dev_priv->saveGTIMR); | 864 | I915_WRITE(GTIMR, dev_priv->saveGTIMR); |
864 | I915_WRITE(_FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); | 865 | I915_WRITE(_FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); |
865 | I915_WRITE(_FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); | 866 | I915_WRITE(_FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); |
867 | I915_WRITE(PCH_PORT_HOTPLUG, dev_priv->savePCH_PORT_HOTPLUG); | ||
866 | } else { | 868 | } else { |
867 | I915_WRITE(IER, dev_priv->saveIER); | 869 | I915_WRITE(IER, dev_priv->saveIER); |
868 | I915_WRITE(IMR, dev_priv->saveIMR); | 870 | I915_WRITE(IMR, dev_priv->saveIMR); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 393a39922e53..35364e68a091 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -980,11 +980,29 @@ static void assert_transcoder_disabled(struct drm_i915_private *dev_priv, | |||
980 | pipe_name(pipe)); | 980 | pipe_name(pipe)); |
981 | } | 981 | } |
982 | 982 | ||
983 | static bool dp_pipe_enabled(struct drm_i915_private *dev_priv, enum pipe pipe, | ||
984 | int reg, u32 port_sel, u32 val) | ||
985 | { | ||
986 | if ((val & DP_PORT_EN) == 0) | ||
987 | return false; | ||
988 | |||
989 | if (HAS_PCH_CPT(dev_priv->dev)) { | ||
990 | u32 trans_dp_ctl_reg = TRANS_DP_CTL(pipe); | ||
991 | u32 trans_dp_ctl = I915_READ(trans_dp_ctl_reg); | ||
992 | if ((trans_dp_ctl & TRANS_DP_PORT_SEL_MASK) != port_sel) | ||
993 | return false; | ||
994 | } else { | ||
995 | if ((val & DP_PIPE_MASK) != (pipe << 30)) | ||
996 | return false; | ||
997 | } | ||
998 | return true; | ||
999 | } | ||
1000 | |||
983 | static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv, | 1001 | static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv, |
984 | enum pipe pipe, int reg) | 1002 | enum pipe pipe, int reg, u32 port_sel) |
985 | { | 1003 | { |
986 | u32 val = I915_READ(reg); | 1004 | u32 val = I915_READ(reg); |
987 | WARN(DP_PIPE_ENABLED(val, pipe), | 1005 | WARN(dp_pipe_enabled(dev_priv, pipe, reg, port_sel, val), |
988 | "PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n", | 1006 | "PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n", |
989 | reg, pipe_name(pipe)); | 1007 | reg, pipe_name(pipe)); |
990 | } | 1008 | } |
@@ -1004,9 +1022,9 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv, | |||
1004 | int reg; | 1022 | int reg; |
1005 | u32 val; | 1023 | u32 val; |
1006 | 1024 | ||
1007 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_B); | 1025 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_B, TRANS_DP_PORT_SEL_B); |
1008 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_C); | 1026 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_C, TRANS_DP_PORT_SEL_C); |
1009 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_D); | 1027 | assert_pch_dp_disabled(dev_priv, pipe, PCH_DP_D, TRANS_DP_PORT_SEL_D); |
1010 | 1028 | ||
1011 | reg = PCH_ADPA; | 1029 | reg = PCH_ADPA; |
1012 | val = I915_READ(reg); | 1030 | val = I915_READ(reg); |
@@ -1276,6 +1294,17 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv, | |||
1276 | intel_wait_for_pipe_off(dev_priv->dev, pipe); | 1294 | intel_wait_for_pipe_off(dev_priv->dev, pipe); |
1277 | } | 1295 | } |
1278 | 1296 | ||
1297 | /* | ||
1298 | * Plane regs are double buffered, going from enabled->disabled needs a | ||
1299 | * trigger in order to latch. The display address reg provides this. | ||
1300 | */ | ||
1301 | static void intel_flush_display_plane(struct drm_i915_private *dev_priv, | ||
1302 | enum plane plane) | ||
1303 | { | ||
1304 | I915_WRITE(DSPADDR(plane), I915_READ(DSPADDR(plane))); | ||
1305 | I915_WRITE(DSPSURF(plane), I915_READ(DSPSURF(plane))); | ||
1306 | } | ||
1307 | |||
1279 | /** | 1308 | /** |
1280 | * intel_enable_plane - enable a display plane on a given pipe | 1309 | * intel_enable_plane - enable a display plane on a given pipe |
1281 | * @dev_priv: i915 private structure | 1310 | * @dev_priv: i915 private structure |
@@ -1299,20 +1328,10 @@ static void intel_enable_plane(struct drm_i915_private *dev_priv, | |||
1299 | return; | 1328 | return; |
1300 | 1329 | ||
1301 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); | 1330 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); |
1331 | intel_flush_display_plane(dev_priv, plane); | ||
1302 | intel_wait_for_vblank(dev_priv->dev, pipe); | 1332 | intel_wait_for_vblank(dev_priv->dev, pipe); |
1303 | } | 1333 | } |
1304 | 1334 | ||
1305 | /* | ||
1306 | * Plane regs are double buffered, going from enabled->disabled needs a | ||
1307 | * trigger in order to latch. The display address reg provides this. | ||
1308 | */ | ||
1309 | static void intel_flush_display_plane(struct drm_i915_private *dev_priv, | ||
1310 | enum plane plane) | ||
1311 | { | ||
1312 | u32 reg = DSPADDR(plane); | ||
1313 | I915_WRITE(reg, I915_READ(reg)); | ||
1314 | } | ||
1315 | |||
1316 | /** | 1335 | /** |
1317 | * intel_disable_plane - disable a display plane | 1336 | * intel_disable_plane - disable a display plane |
1318 | * @dev_priv: i915 private structure | 1337 | * @dev_priv: i915 private structure |
@@ -1338,19 +1357,24 @@ static void intel_disable_plane(struct drm_i915_private *dev_priv, | |||
1338 | } | 1357 | } |
1339 | 1358 | ||
1340 | static void disable_pch_dp(struct drm_i915_private *dev_priv, | 1359 | static void disable_pch_dp(struct drm_i915_private *dev_priv, |
1341 | enum pipe pipe, int reg) | 1360 | enum pipe pipe, int reg, u32 port_sel) |
1342 | { | 1361 | { |
1343 | u32 val = I915_READ(reg); | 1362 | u32 val = I915_READ(reg); |
1344 | if (DP_PIPE_ENABLED(val, pipe)) | 1363 | if (dp_pipe_enabled(dev_priv, pipe, reg, port_sel, val)) { |
1364 | DRM_DEBUG_KMS("Disabling pch dp %x on pipe %d\n", reg, pipe); | ||
1345 | I915_WRITE(reg, val & ~DP_PORT_EN); | 1365 | I915_WRITE(reg, val & ~DP_PORT_EN); |
1366 | } | ||
1346 | } | 1367 | } |
1347 | 1368 | ||
1348 | static void disable_pch_hdmi(struct drm_i915_private *dev_priv, | 1369 | static void disable_pch_hdmi(struct drm_i915_private *dev_priv, |
1349 | enum pipe pipe, int reg) | 1370 | enum pipe pipe, int reg) |
1350 | { | 1371 | { |
1351 | u32 val = I915_READ(reg); | 1372 | u32 val = I915_READ(reg); |
1352 | if (HDMI_PIPE_ENABLED(val, pipe)) | 1373 | if (HDMI_PIPE_ENABLED(val, pipe)) { |
1374 | DRM_DEBUG_KMS("Disabling pch HDMI %x on pipe %d\n", | ||
1375 | reg, pipe); | ||
1353 | I915_WRITE(reg, val & ~PORT_ENABLE); | 1376 | I915_WRITE(reg, val & ~PORT_ENABLE); |
1377 | } | ||
1354 | } | 1378 | } |
1355 | 1379 | ||
1356 | /* Disable any ports connected to this transcoder */ | 1380 | /* Disable any ports connected to this transcoder */ |
@@ -1362,9 +1386,9 @@ static void intel_disable_pch_ports(struct drm_i915_private *dev_priv, | |||
1362 | val = I915_READ(PCH_PP_CONTROL); | 1386 | val = I915_READ(PCH_PP_CONTROL); |
1363 | I915_WRITE(PCH_PP_CONTROL, val | PANEL_UNLOCK_REGS); | 1387 | I915_WRITE(PCH_PP_CONTROL, val | PANEL_UNLOCK_REGS); |
1364 | 1388 | ||
1365 | disable_pch_dp(dev_priv, pipe, PCH_DP_B); | 1389 | disable_pch_dp(dev_priv, pipe, PCH_DP_B, TRANS_DP_PORT_SEL_B); |
1366 | disable_pch_dp(dev_priv, pipe, PCH_DP_C); | 1390 | disable_pch_dp(dev_priv, pipe, PCH_DP_C, TRANS_DP_PORT_SEL_C); |
1367 | disable_pch_dp(dev_priv, pipe, PCH_DP_D); | 1391 | disable_pch_dp(dev_priv, pipe, PCH_DP_D, TRANS_DP_PORT_SEL_D); |
1368 | 1392 | ||
1369 | reg = PCH_ADPA; | 1393 | reg = PCH_ADPA; |
1370 | val = I915_READ(reg); | 1394 | val = I915_READ(reg); |
@@ -2096,7 +2120,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2096 | 2120 | ||
2097 | /* no fb bound */ | 2121 | /* no fb bound */ |
2098 | if (!crtc->fb) { | 2122 | if (!crtc->fb) { |
2099 | DRM_DEBUG_KMS("No FB bound\n"); | 2123 | DRM_ERROR("No FB bound\n"); |
2100 | return 0; | 2124 | return 0; |
2101 | } | 2125 | } |
2102 | 2126 | ||
@@ -2105,6 +2129,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2105 | case 1: | 2129 | case 1: |
2106 | break; | 2130 | break; |
2107 | default: | 2131 | default: |
2132 | DRM_ERROR("no plane for crtc\n"); | ||
2108 | return -EINVAL; | 2133 | return -EINVAL; |
2109 | } | 2134 | } |
2110 | 2135 | ||
@@ -2114,6 +2139,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2114 | NULL); | 2139 | NULL); |
2115 | if (ret != 0) { | 2140 | if (ret != 0) { |
2116 | mutex_unlock(&dev->struct_mutex); | 2141 | mutex_unlock(&dev->struct_mutex); |
2142 | DRM_ERROR("pin & fence failed\n"); | ||
2117 | return ret; | 2143 | return ret; |
2118 | } | 2144 | } |
2119 | 2145 | ||
@@ -2142,6 +2168,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2142 | if (ret) { | 2168 | if (ret) { |
2143 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | 2169 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); |
2144 | mutex_unlock(&dev->struct_mutex); | 2170 | mutex_unlock(&dev->struct_mutex); |
2171 | DRM_ERROR("failed to update base address\n"); | ||
2145 | return ret; | 2172 | return ret; |
2146 | } | 2173 | } |
2147 | 2174 | ||
@@ -2248,6 +2275,18 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) | |||
2248 | FDI_FE_ERRC_ENABLE); | 2275 | FDI_FE_ERRC_ENABLE); |
2249 | } | 2276 | } |
2250 | 2277 | ||
2278 | static void cpt_phase_pointer_enable(struct drm_device *dev, int pipe) | ||
2279 | { | ||
2280 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2281 | u32 flags = I915_READ(SOUTH_CHICKEN1); | ||
2282 | |||
2283 | flags |= FDI_PHASE_SYNC_OVR(pipe); | ||
2284 | I915_WRITE(SOUTH_CHICKEN1, flags); /* once to unlock... */ | ||
2285 | flags |= FDI_PHASE_SYNC_EN(pipe); | ||
2286 | I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to enable */ | ||
2287 | POSTING_READ(SOUTH_CHICKEN1); | ||
2288 | } | ||
2289 | |||
2251 | /* The FDI link training functions for ILK/Ibexpeak. */ | 2290 | /* The FDI link training functions for ILK/Ibexpeak. */ |
2252 | static void ironlake_fdi_link_train(struct drm_crtc *crtc) | 2291 | static void ironlake_fdi_link_train(struct drm_crtc *crtc) |
2253 | { | 2292 | { |
@@ -2398,6 +2437,9 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc) | |||
2398 | POSTING_READ(reg); | 2437 | POSTING_READ(reg); |
2399 | udelay(150); | 2438 | udelay(150); |
2400 | 2439 | ||
2440 | if (HAS_PCH_CPT(dev)) | ||
2441 | cpt_phase_pointer_enable(dev, pipe); | ||
2442 | |||
2401 | for (i = 0; i < 4; i++ ) { | 2443 | for (i = 0; i < 4; i++ ) { |
2402 | reg = FDI_TX_CTL(pipe); | 2444 | reg = FDI_TX_CTL(pipe); |
2403 | temp = I915_READ(reg); | 2445 | temp = I915_READ(reg); |
@@ -2514,6 +2556,9 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc) | |||
2514 | POSTING_READ(reg); | 2556 | POSTING_READ(reg); |
2515 | udelay(150); | 2557 | udelay(150); |
2516 | 2558 | ||
2559 | if (HAS_PCH_CPT(dev)) | ||
2560 | cpt_phase_pointer_enable(dev, pipe); | ||
2561 | |||
2517 | for (i = 0; i < 4; i++ ) { | 2562 | for (i = 0; i < 4; i++ ) { |
2518 | reg = FDI_TX_CTL(pipe); | 2563 | reg = FDI_TX_CTL(pipe); |
2519 | temp = I915_READ(reg); | 2564 | temp = I915_READ(reg); |
@@ -2623,6 +2668,17 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc) | |||
2623 | } | 2668 | } |
2624 | } | 2669 | } |
2625 | 2670 | ||
2671 | static void cpt_phase_pointer_disable(struct drm_device *dev, int pipe) | ||
2672 | { | ||
2673 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2674 | u32 flags = I915_READ(SOUTH_CHICKEN1); | ||
2675 | |||
2676 | flags &= ~(FDI_PHASE_SYNC_EN(pipe)); | ||
2677 | I915_WRITE(SOUTH_CHICKEN1, flags); /* once to disable... */ | ||
2678 | flags &= ~(FDI_PHASE_SYNC_OVR(pipe)); | ||
2679 | I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to lock */ | ||
2680 | POSTING_READ(SOUTH_CHICKEN1); | ||
2681 | } | ||
2626 | static void ironlake_fdi_disable(struct drm_crtc *crtc) | 2682 | static void ironlake_fdi_disable(struct drm_crtc *crtc) |
2627 | { | 2683 | { |
2628 | struct drm_device *dev = crtc->dev; | 2684 | struct drm_device *dev = crtc->dev; |
@@ -2652,6 +2708,8 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) | |||
2652 | I915_WRITE(FDI_RX_CHICKEN(pipe), | 2708 | I915_WRITE(FDI_RX_CHICKEN(pipe), |
2653 | I915_READ(FDI_RX_CHICKEN(pipe) & | 2709 | I915_READ(FDI_RX_CHICKEN(pipe) & |
2654 | ~FDI_RX_PHASE_SYNC_POINTER_EN)); | 2710 | ~FDI_RX_PHASE_SYNC_POINTER_EN)); |
2711 | } else if (HAS_PCH_CPT(dev)) { | ||
2712 | cpt_phase_pointer_disable(dev, pipe); | ||
2655 | } | 2713 | } |
2656 | 2714 | ||
2657 | /* still set train pattern 1 */ | 2715 | /* still set train pattern 1 */ |
@@ -2862,14 +2920,18 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2862 | I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size); | 2920 | I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size); |
2863 | } | 2921 | } |
2864 | 2922 | ||
2923 | /* | ||
2924 | * On ILK+ LUT must be loaded before the pipe is running but with | ||
2925 | * clocks enabled | ||
2926 | */ | ||
2927 | intel_crtc_load_lut(crtc); | ||
2928 | |||
2865 | intel_enable_pipe(dev_priv, pipe, is_pch_port); | 2929 | intel_enable_pipe(dev_priv, pipe, is_pch_port); |
2866 | intel_enable_plane(dev_priv, plane, pipe); | 2930 | intel_enable_plane(dev_priv, plane, pipe); |
2867 | 2931 | ||
2868 | if (is_pch_port) | 2932 | if (is_pch_port) |
2869 | ironlake_pch_enable(crtc); | 2933 | ironlake_pch_enable(crtc); |
2870 | 2934 | ||
2871 | intel_crtc_load_lut(crtc); | ||
2872 | |||
2873 | mutex_lock(&dev->struct_mutex); | 2935 | mutex_lock(&dev->struct_mutex); |
2874 | intel_update_fbc(dev); | 2936 | intel_update_fbc(dev); |
2875 | mutex_unlock(&dev->struct_mutex); | 2937 | mutex_unlock(&dev->struct_mutex); |
@@ -4538,7 +4600,9 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
4538 | if (connector->encoder != encoder) | 4600 | if (connector->encoder != encoder) |
4539 | continue; | 4601 | continue; |
4540 | 4602 | ||
4541 | if (connector->display_info.bpc < display_bpc) { | 4603 | /* Don't use an invalid EDID bpc value */ |
4604 | if (connector->display_info.bpc && | ||
4605 | connector->display_info.bpc < display_bpc) { | ||
4542 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); | 4606 | DRM_DEBUG_DRIVER("clamping display bpc (was %d) to EDID reported max of %d\n", display_bpc, connector->display_info.bpc); |
4543 | display_bpc = connector->display_info.bpc; | 4607 | display_bpc = connector->display_info.bpc; |
4544 | } | 4608 | } |
@@ -5153,7 +5217,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5153 | temp |= PIPE_12BPC; | 5217 | temp |= PIPE_12BPC; |
5154 | break; | 5218 | break; |
5155 | default: | 5219 | default: |
5156 | WARN(1, "intel_choose_pipe_bpp returned invalid value\n"); | 5220 | WARN(1, "intel_choose_pipe_bpp returned invalid value %d\n", |
5221 | pipe_bpp); | ||
5157 | temp |= PIPE_8BPC; | 5222 | temp |= PIPE_8BPC; |
5158 | pipe_bpp = 24; | 5223 | pipe_bpp = 24; |
5159 | break; | 5224 | break; |
@@ -5238,7 +5303,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5238 | } else if (is_sdvo && is_tv) | 5303 | } else if (is_sdvo && is_tv) |
5239 | factor = 20; | 5304 | factor = 20; |
5240 | 5305 | ||
5241 | if (clock.m1 < factor * clock.n) | 5306 | if (clock.m < factor * clock.n) |
5242 | fp |= FP_CB_TUNE; | 5307 | fp |= FP_CB_TUNE; |
5243 | 5308 | ||
5244 | dpll = 0; | 5309 | dpll = 0; |
@@ -5516,6 +5581,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
5516 | 5581 | ||
5517 | drm_vblank_post_modeset(dev, pipe); | 5582 | drm_vblank_post_modeset(dev, pipe); |
5518 | 5583 | ||
5584 | intel_crtc->dpms_mode = DRM_MODE_DPMS_ON; | ||
5585 | |||
5519 | return ret; | 5586 | return ret; |
5520 | } | 5587 | } |
5521 | 5588 | ||
@@ -7714,10 +7781,12 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
7714 | ILK_DPARB_CLK_GATE | | 7781 | ILK_DPARB_CLK_GATE | |
7715 | ILK_DPFD_CLK_GATE); | 7782 | ILK_DPFD_CLK_GATE); |
7716 | 7783 | ||
7717 | for_each_pipe(pipe) | 7784 | for_each_pipe(pipe) { |
7718 | I915_WRITE(DSPCNTR(pipe), | 7785 | I915_WRITE(DSPCNTR(pipe), |
7719 | I915_READ(DSPCNTR(pipe)) | | 7786 | I915_READ(DSPCNTR(pipe)) | |
7720 | DISPPLANE_TRICKLE_FEED_DISABLE); | 7787 | DISPPLANE_TRICKLE_FEED_DISABLE); |
7788 | intel_flush_display_plane(dev_priv, pipe); | ||
7789 | } | ||
7721 | } | 7790 | } |
7722 | 7791 | ||
7723 | static void ivybridge_init_clock_gating(struct drm_device *dev) | 7792 | static void ivybridge_init_clock_gating(struct drm_device *dev) |
@@ -7734,10 +7803,12 @@ static void ivybridge_init_clock_gating(struct drm_device *dev) | |||
7734 | 7803 | ||
7735 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); | 7804 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); |
7736 | 7805 | ||
7737 | for_each_pipe(pipe) | 7806 | for_each_pipe(pipe) { |
7738 | I915_WRITE(DSPCNTR(pipe), | 7807 | I915_WRITE(DSPCNTR(pipe), |
7739 | I915_READ(DSPCNTR(pipe)) | | 7808 | I915_READ(DSPCNTR(pipe)) | |
7740 | DISPPLANE_TRICKLE_FEED_DISABLE); | 7809 | DISPPLANE_TRICKLE_FEED_DISABLE); |
7810 | intel_flush_display_plane(dev_priv, pipe); | ||
7811 | } | ||
7741 | } | 7812 | } |
7742 | 7813 | ||
7743 | static void g4x_init_clock_gating(struct drm_device *dev) | 7814 | static void g4x_init_clock_gating(struct drm_device *dev) |
@@ -7820,6 +7891,7 @@ static void ibx_init_clock_gating(struct drm_device *dev) | |||
7820 | static void cpt_init_clock_gating(struct drm_device *dev) | 7891 | static void cpt_init_clock_gating(struct drm_device *dev) |
7821 | { | 7892 | { |
7822 | struct drm_i915_private *dev_priv = dev->dev_private; | 7893 | struct drm_i915_private *dev_priv = dev->dev_private; |
7894 | int pipe; | ||
7823 | 7895 | ||
7824 | /* | 7896 | /* |
7825 | * On Ibex Peak and Cougar Point, we need to disable clock | 7897 | * On Ibex Peak and Cougar Point, we need to disable clock |
@@ -7829,6 +7901,9 @@ static void cpt_init_clock_gating(struct drm_device *dev) | |||
7829 | I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE); | 7901 | I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE); |
7830 | I915_WRITE(SOUTH_CHICKEN2, I915_READ(SOUTH_CHICKEN2) | | 7902 | I915_WRITE(SOUTH_CHICKEN2, I915_READ(SOUTH_CHICKEN2) | |
7831 | DPLS_EDP_PPS_FIX_DIS); | 7903 | DPLS_EDP_PPS_FIX_DIS); |
7904 | /* Without this, mode sets may fail silently on FDI */ | ||
7905 | for_each_pipe(pipe) | ||
7906 | I915_WRITE(TRANS_CHICKEN2(pipe), TRANS_AUTOTRAIN_GEN_STALL_DIS); | ||
7832 | } | 7907 | } |
7833 | 7908 | ||
7834 | static void ironlake_teardown_rc6(struct drm_device *dev) | 7909 | static void ironlake_teardown_rc6(struct drm_device *dev) |
@@ -8178,6 +8253,9 @@ struct intel_quirk intel_quirks[] = { | |||
8178 | 8253 | ||
8179 | /* Lenovo U160 cannot use SSC on LVDS */ | 8254 | /* Lenovo U160 cannot use SSC on LVDS */ |
8180 | { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable }, | 8255 | { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable }, |
8256 | |||
8257 | /* Sony Vaio Y cannot use SSC on LVDS */ | ||
8258 | { 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable }, | ||
8181 | }; | 8259 | }; |
8182 | 8260 | ||
8183 | static void intel_init_quirks(struct drm_device *dev) | 8261 | static void intel_init_quirks(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f797fb58ba9c..0feae908bb37 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -50,9 +50,10 @@ struct intel_dp { | |||
50 | bool has_audio; | 50 | bool has_audio; |
51 | int force_audio; | 51 | int force_audio; |
52 | uint32_t color_range; | 52 | uint32_t color_range; |
53 | int dpms_mode; | ||
53 | uint8_t link_bw; | 54 | uint8_t link_bw; |
54 | uint8_t lane_count; | 55 | uint8_t lane_count; |
55 | uint8_t dpcd[4]; | 56 | uint8_t dpcd[8]; |
56 | struct i2c_adapter adapter; | 57 | struct i2c_adapter adapter; |
57 | struct i2c_algo_dp_aux_data algo; | 58 | struct i2c_algo_dp_aux_data algo; |
58 | bool is_pch_edp; | 59 | bool is_pch_edp; |
@@ -316,9 +317,17 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
316 | else | 317 | else |
317 | precharge = 5; | 318 | precharge = 5; |
318 | 319 | ||
319 | if (I915_READ(ch_ctl) & DP_AUX_CH_CTL_SEND_BUSY) { | 320 | /* Try to wait for any previous AUX channel activity */ |
320 | DRM_ERROR("dp_aux_ch not started status 0x%08x\n", | 321 | for (try = 0; try < 3; try++) { |
321 | I915_READ(ch_ctl)); | 322 | status = I915_READ(ch_ctl); |
323 | if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) | ||
324 | break; | ||
325 | msleep(1); | ||
326 | } | ||
327 | |||
328 | if (try == 3) { | ||
329 | WARN(1, "dp_aux_ch not started status 0x%08x\n", | ||
330 | I915_READ(ch_ctl)); | ||
322 | return -EBUSY; | 331 | return -EBUSY; |
323 | } | 332 | } |
324 | 333 | ||
@@ -770,6 +779,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
770 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); | 779 | memset(intel_dp->link_configuration, 0, DP_LINK_CONFIGURATION_SIZE); |
771 | intel_dp->link_configuration[0] = intel_dp->link_bw; | 780 | intel_dp->link_configuration[0] = intel_dp->link_bw; |
772 | intel_dp->link_configuration[1] = intel_dp->lane_count; | 781 | intel_dp->link_configuration[1] = intel_dp->lane_count; |
782 | intel_dp->link_configuration[8] = DP_SET_ANSI_8B10B; | ||
773 | 783 | ||
774 | /* | 784 | /* |
775 | * Check for DPCD version > 1.1 and enhanced framing support | 785 | * Check for DPCD version > 1.1 and enhanced framing support |
@@ -1011,6 +1021,8 @@ static void intel_dp_commit(struct drm_encoder *encoder) | |||
1011 | 1021 | ||
1012 | if (is_edp(intel_dp)) | 1022 | if (is_edp(intel_dp)) |
1013 | ironlake_edp_backlight_on(dev); | 1023 | ironlake_edp_backlight_on(dev); |
1024 | |||
1025 | intel_dp->dpms_mode = DRM_MODE_DPMS_ON; | ||
1014 | } | 1026 | } |
1015 | 1027 | ||
1016 | static void | 1028 | static void |
@@ -1045,6 +1057,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode) | |||
1045 | if (is_edp(intel_dp)) | 1057 | if (is_edp(intel_dp)) |
1046 | ironlake_edp_backlight_on(dev); | 1058 | ironlake_edp_backlight_on(dev); |
1047 | } | 1059 | } |
1060 | intel_dp->dpms_mode = mode; | ||
1048 | } | 1061 | } |
1049 | 1062 | ||
1050 | /* | 1063 | /* |
@@ -1334,10 +1347,16 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1334 | u32 reg; | 1347 | u32 reg; |
1335 | uint32_t DP = intel_dp->DP; | 1348 | uint32_t DP = intel_dp->DP; |
1336 | 1349 | ||
1337 | /* Enable output, wait for it to become active */ | 1350 | /* |
1338 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | 1351 | * On CPT we have to enable the port in training pattern 1, which |
1339 | POSTING_READ(intel_dp->output_reg); | 1352 | * will happen below in intel_dp_set_link_train. Otherwise, enable |
1340 | intel_wait_for_vblank(dev, intel_crtc->pipe); | 1353 | * the port and wait for it to become active. |
1354 | */ | ||
1355 | if (!HAS_PCH_CPT(dev)) { | ||
1356 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | ||
1357 | POSTING_READ(intel_dp->output_reg); | ||
1358 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
1359 | } | ||
1341 | 1360 | ||
1342 | /* Write the link configuration data */ | 1361 | /* Write the link configuration data */ |
1343 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, | 1362 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, |
@@ -1370,7 +1389,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1370 | reg = DP | DP_LINK_TRAIN_PAT_1; | 1389 | reg = DP | DP_LINK_TRAIN_PAT_1; |
1371 | 1390 | ||
1372 | if (!intel_dp_set_link_train(intel_dp, reg, | 1391 | if (!intel_dp_set_link_train(intel_dp, reg, |
1373 | DP_TRAINING_PATTERN_1)) | 1392 | DP_TRAINING_PATTERN_1 | |
1393 | DP_LINK_SCRAMBLING_DISABLE)) | ||
1374 | break; | 1394 | break; |
1375 | /* Set training pattern 1 */ | 1395 | /* Set training pattern 1 */ |
1376 | 1396 | ||
@@ -1445,7 +1465,8 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
1445 | 1465 | ||
1446 | /* channel eq pattern */ | 1466 | /* channel eq pattern */ |
1447 | if (!intel_dp_set_link_train(intel_dp, reg, | 1467 | if (!intel_dp_set_link_train(intel_dp, reg, |
1448 | DP_TRAINING_PATTERN_2)) | 1468 | DP_TRAINING_PATTERN_2 | |
1469 | DP_LINK_SCRAMBLING_DISABLE)) | ||
1449 | break; | 1470 | break; |
1450 | 1471 | ||
1451 | udelay(400); | 1472 | udelay(400); |
@@ -1559,6 +1580,18 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1559 | POSTING_READ(intel_dp->output_reg); | 1580 | POSTING_READ(intel_dp->output_reg); |
1560 | } | 1581 | } |
1561 | 1582 | ||
1583 | static bool | ||
1584 | intel_dp_get_dpcd(struct intel_dp *intel_dp) | ||
1585 | { | ||
1586 | if (intel_dp_aux_native_read_retry(intel_dp, 0x000, intel_dp->dpcd, | ||
1587 | sizeof (intel_dp->dpcd)) && | ||
1588 | (intel_dp->dpcd[DP_DPCD_REV] != 0)) { | ||
1589 | return true; | ||
1590 | } | ||
1591 | |||
1592 | return false; | ||
1593 | } | ||
1594 | |||
1562 | /* | 1595 | /* |
1563 | * According to DP spec | 1596 | * According to DP spec |
1564 | * 5.1.2: | 1597 | * 5.1.2: |
@@ -1571,36 +1604,44 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1571 | static void | 1604 | static void |
1572 | intel_dp_check_link_status(struct intel_dp *intel_dp) | 1605 | intel_dp_check_link_status(struct intel_dp *intel_dp) |
1573 | { | 1606 | { |
1574 | int ret; | 1607 | if (intel_dp->dpms_mode != DRM_MODE_DPMS_ON) |
1608 | return; | ||
1575 | 1609 | ||
1576 | if (!intel_dp->base.base.crtc) | 1610 | if (!intel_dp->base.base.crtc) |
1577 | return; | 1611 | return; |
1578 | 1612 | ||
1613 | /* Try to read receiver status if the link appears to be up */ | ||
1579 | if (!intel_dp_get_link_status(intel_dp)) { | 1614 | if (!intel_dp_get_link_status(intel_dp)) { |
1580 | intel_dp_link_down(intel_dp); | 1615 | intel_dp_link_down(intel_dp); |
1581 | return; | 1616 | return; |
1582 | } | 1617 | } |
1583 | 1618 | ||
1584 | /* Try to read receiver status if the link appears to be up */ | 1619 | /* Now read the DPCD to see if it's actually running */ |
1585 | ret = intel_dp_aux_native_read(intel_dp, | 1620 | if (!intel_dp_get_dpcd(intel_dp)) { |
1586 | 0x000, intel_dp->dpcd, | ||
1587 | sizeof (intel_dp->dpcd)); | ||
1588 | if (ret != sizeof(intel_dp->dpcd)) { | ||
1589 | intel_dp_link_down(intel_dp); | 1621 | intel_dp_link_down(intel_dp); |
1590 | return; | 1622 | return; |
1591 | } | 1623 | } |
1592 | 1624 | ||
1593 | if (!intel_channel_eq_ok(intel_dp)) { | 1625 | if (!intel_channel_eq_ok(intel_dp)) { |
1626 | DRM_DEBUG_KMS("%s: channel EQ not ok, retraining\n", | ||
1627 | drm_get_encoder_name(&intel_dp->base.base)); | ||
1594 | intel_dp_start_link_train(intel_dp); | 1628 | intel_dp_start_link_train(intel_dp); |
1595 | intel_dp_complete_link_train(intel_dp); | 1629 | intel_dp_complete_link_train(intel_dp); |
1596 | } | 1630 | } |
1597 | } | 1631 | } |
1598 | 1632 | ||
1599 | static enum drm_connector_status | 1633 | static enum drm_connector_status |
1634 | intel_dp_detect_dpcd(struct intel_dp *intel_dp) | ||
1635 | { | ||
1636 | if (intel_dp_get_dpcd(intel_dp)) | ||
1637 | return connector_status_connected; | ||
1638 | return connector_status_disconnected; | ||
1639 | } | ||
1640 | |||
1641 | static enum drm_connector_status | ||
1600 | ironlake_dp_detect(struct intel_dp *intel_dp) | 1642 | ironlake_dp_detect(struct intel_dp *intel_dp) |
1601 | { | 1643 | { |
1602 | enum drm_connector_status status; | 1644 | enum drm_connector_status status; |
1603 | bool ret; | ||
1604 | 1645 | ||
1605 | /* Can't disconnect eDP, but you can close the lid... */ | 1646 | /* Can't disconnect eDP, but you can close the lid... */ |
1606 | if (is_edp(intel_dp)) { | 1647 | if (is_edp(intel_dp)) { |
@@ -1610,15 +1651,7 @@ ironlake_dp_detect(struct intel_dp *intel_dp) | |||
1610 | return status; | 1651 | return status; |
1611 | } | 1652 | } |
1612 | 1653 | ||
1613 | status = connector_status_disconnected; | 1654 | return intel_dp_detect_dpcd(intel_dp); |
1614 | ret = intel_dp_aux_native_read_retry(intel_dp, | ||
1615 | 0x000, intel_dp->dpcd, | ||
1616 | sizeof (intel_dp->dpcd)); | ||
1617 | if (ret && intel_dp->dpcd[DP_DPCD_REV] != 0) | ||
1618 | status = connector_status_connected; | ||
1619 | DRM_DEBUG_KMS("DPCD: %hx%hx%hx%hx\n", intel_dp->dpcd[0], | ||
1620 | intel_dp->dpcd[1], intel_dp->dpcd[2], intel_dp->dpcd[3]); | ||
1621 | return status; | ||
1622 | } | 1655 | } |
1623 | 1656 | ||
1624 | static enum drm_connector_status | 1657 | static enum drm_connector_status |
@@ -1626,7 +1659,6 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
1626 | { | 1659 | { |
1627 | struct drm_device *dev = intel_dp->base.base.dev; | 1660 | struct drm_device *dev = intel_dp->base.base.dev; |
1628 | struct drm_i915_private *dev_priv = dev->dev_private; | 1661 | struct drm_i915_private *dev_priv = dev->dev_private; |
1629 | enum drm_connector_status status; | ||
1630 | uint32_t temp, bit; | 1662 | uint32_t temp, bit; |
1631 | 1663 | ||
1632 | switch (intel_dp->output_reg) { | 1664 | switch (intel_dp->output_reg) { |
@@ -1648,15 +1680,7 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
1648 | if ((temp & bit) == 0) | 1680 | if ((temp & bit) == 0) |
1649 | return connector_status_disconnected; | 1681 | return connector_status_disconnected; |
1650 | 1682 | ||
1651 | status = connector_status_disconnected; | 1683 | return intel_dp_detect_dpcd(intel_dp); |
1652 | if (intel_dp_aux_native_read(intel_dp, 0x000, intel_dp->dpcd, | ||
1653 | sizeof (intel_dp->dpcd)) == sizeof (intel_dp->dpcd)) | ||
1654 | { | ||
1655 | if (intel_dp->dpcd[DP_DPCD_REV] != 0) | ||
1656 | status = connector_status_connected; | ||
1657 | } | ||
1658 | |||
1659 | return status; | ||
1660 | } | 1684 | } |
1661 | 1685 | ||
1662 | /** | 1686 | /** |
@@ -1679,6 +1703,12 @@ intel_dp_detect(struct drm_connector *connector, bool force) | |||
1679 | status = ironlake_dp_detect(intel_dp); | 1703 | status = ironlake_dp_detect(intel_dp); |
1680 | else | 1704 | else |
1681 | status = g4x_dp_detect(intel_dp); | 1705 | status = g4x_dp_detect(intel_dp); |
1706 | |||
1707 | DRM_DEBUG_KMS("DPCD: %02hx%02hx%02hx%02hx%02hx%02hx%02hx%02hx\n", | ||
1708 | intel_dp->dpcd[0], intel_dp->dpcd[1], intel_dp->dpcd[2], | ||
1709 | intel_dp->dpcd[3], intel_dp->dpcd[4], intel_dp->dpcd[5], | ||
1710 | intel_dp->dpcd[6], intel_dp->dpcd[7]); | ||
1711 | |||
1682 | if (status != connector_status_connected) | 1712 | if (status != connector_status_connected) |
1683 | return status; | 1713 | return status; |
1684 | 1714 | ||
@@ -1924,6 +1954,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
1924 | return; | 1954 | return; |
1925 | 1955 | ||
1926 | intel_dp->output_reg = output_reg; | 1956 | intel_dp->output_reg = output_reg; |
1957 | intel_dp->dpms_mode = -1; | ||
1927 | 1958 | ||
1928 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); | 1959 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
1929 | if (!intel_connector) { | 1960 | if (!intel_connector) { |
@@ -2000,7 +2031,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
2000 | 2031 | ||
2001 | /* Cache some DPCD data in the eDP case */ | 2032 | /* Cache some DPCD data in the eDP case */ |
2002 | if (is_edp(intel_dp)) { | 2033 | if (is_edp(intel_dp)) { |
2003 | int ret; | 2034 | bool ret; |
2004 | u32 pp_on, pp_div; | 2035 | u32 pp_on, pp_div; |
2005 | 2036 | ||
2006 | pp_on = I915_READ(PCH_PP_ON_DELAYS); | 2037 | pp_on = I915_READ(PCH_PP_ON_DELAYS); |
@@ -2013,11 +2044,9 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
2013 | dev_priv->panel_t12 *= 100; /* t12 in 100ms units */ | 2044 | dev_priv->panel_t12 *= 100; /* t12 in 100ms units */ |
2014 | 2045 | ||
2015 | ironlake_edp_panel_vdd_on(intel_dp); | 2046 | ironlake_edp_panel_vdd_on(intel_dp); |
2016 | ret = intel_dp_aux_native_read(intel_dp, DP_DPCD_REV, | 2047 | ret = intel_dp_get_dpcd(intel_dp); |
2017 | intel_dp->dpcd, | ||
2018 | sizeof(intel_dp->dpcd)); | ||
2019 | ironlake_edp_panel_vdd_off(intel_dp); | 2048 | ironlake_edp_panel_vdd_off(intel_dp); |
2020 | if (ret == sizeof(intel_dp->dpcd)) { | 2049 | if (ret) { |
2021 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) | 2050 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) |
2022 | dev_priv->no_aux_handshake = | 2051 | dev_priv->no_aux_handshake = |
2023 | intel_dp->dpcd[DP_MAX_DOWNSPREAD] & | 2052 | intel_dp->dpcd[DP_MAX_DOWNSPREAD] & |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 6e990f9760ef..7b330e76a435 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -178,10 +178,28 @@ struct intel_crtc { | |||
178 | #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) | 178 | #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) |
179 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) | 179 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) |
180 | 180 | ||
181 | #define DIP_HEADER_SIZE 5 | ||
182 | |||
181 | #define DIP_TYPE_AVI 0x82 | 183 | #define DIP_TYPE_AVI 0x82 |
182 | #define DIP_VERSION_AVI 0x2 | 184 | #define DIP_VERSION_AVI 0x2 |
183 | #define DIP_LEN_AVI 13 | 185 | #define DIP_LEN_AVI 13 |
184 | 186 | ||
187 | #define DIP_TYPE_SPD 0x3 | ||
188 | #define DIP_VERSION_SPD 0x1 | ||
189 | #define DIP_LEN_SPD 25 | ||
190 | #define DIP_SPD_UNKNOWN 0 | ||
191 | #define DIP_SPD_DSTB 0x1 | ||
192 | #define DIP_SPD_DVDP 0x2 | ||
193 | #define DIP_SPD_DVHS 0x3 | ||
194 | #define DIP_SPD_HDDVR 0x4 | ||
195 | #define DIP_SPD_DVC 0x5 | ||
196 | #define DIP_SPD_DSC 0x6 | ||
197 | #define DIP_SPD_VCD 0x7 | ||
198 | #define DIP_SPD_GAME 0x8 | ||
199 | #define DIP_SPD_PC 0x9 | ||
200 | #define DIP_SPD_BD 0xa | ||
201 | #define DIP_SPD_SCD 0xb | ||
202 | |||
185 | struct dip_infoframe { | 203 | struct dip_infoframe { |
186 | uint8_t type; /* HB0 */ | 204 | uint8_t type; /* HB0 */ |
187 | uint8_t ver; /* HB1 */ | 205 | uint8_t ver; /* HB1 */ |
@@ -206,6 +224,11 @@ struct dip_infoframe { | |||
206 | uint16_t left_bar_end; | 224 | uint16_t left_bar_end; |
207 | uint16_t right_bar_start; | 225 | uint16_t right_bar_start; |
208 | } avi; | 226 | } avi; |
227 | struct { | ||
228 | uint8_t vn[8]; | ||
229 | uint8_t pd[16]; | ||
230 | uint8_t sdi; | ||
231 | } spd; | ||
209 | uint8_t payload[27]; | 232 | uint8_t payload[27]; |
210 | } __attribute__ ((packed)) body; | 233 | } __attribute__ ((packed)) body; |
211 | } __attribute__((packed)); | 234 | } __attribute__((packed)); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 1ed8e6903915..226ba830f383 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -45,6 +45,8 @@ struct intel_hdmi { | |||
45 | bool has_hdmi_sink; | 45 | bool has_hdmi_sink; |
46 | bool has_audio; | 46 | bool has_audio; |
47 | int force_audio; | 47 | int force_audio; |
48 | void (*write_infoframe)(struct drm_encoder *encoder, | ||
49 | struct dip_infoframe *frame); | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) | 52 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) |
@@ -58,37 +60,70 @@ static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector) | |||
58 | struct intel_hdmi, base); | 60 | struct intel_hdmi, base); |
59 | } | 61 | } |
60 | 62 | ||
61 | void intel_dip_infoframe_csum(struct dip_infoframe *avi_if) | 63 | void intel_dip_infoframe_csum(struct dip_infoframe *frame) |
62 | { | 64 | { |
63 | uint8_t *data = (uint8_t *)avi_if; | 65 | uint8_t *data = (uint8_t *)frame; |
64 | uint8_t sum = 0; | 66 | uint8_t sum = 0; |
65 | unsigned i; | 67 | unsigned i; |
66 | 68 | ||
67 | avi_if->checksum = 0; | 69 | frame->checksum = 0; |
68 | avi_if->ecc = 0; | 70 | frame->ecc = 0; |
69 | 71 | ||
70 | for (i = 0; i < sizeof(*avi_if); i++) | 72 | /* Header isn't part of the checksum */ |
73 | for (i = 5; i < frame->len; i++) | ||
71 | sum += data[i]; | 74 | sum += data[i]; |
72 | 75 | ||
73 | avi_if->checksum = 0x100 - sum; | 76 | frame->checksum = 0x100 - sum; |
74 | } | 77 | } |
75 | 78 | ||
76 | static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder) | 79 | static u32 intel_infoframe_index(struct dip_infoframe *frame) |
77 | { | 80 | { |
78 | struct dip_infoframe avi_if = { | 81 | u32 flags = 0; |
79 | .type = DIP_TYPE_AVI, | 82 | |
80 | .ver = DIP_VERSION_AVI, | 83 | switch (frame->type) { |
81 | .len = DIP_LEN_AVI, | 84 | case DIP_TYPE_AVI: |
82 | }; | 85 | flags |= VIDEO_DIP_SELECT_AVI; |
83 | uint32_t *data = (uint32_t *)&avi_if; | 86 | break; |
87 | case DIP_TYPE_SPD: | ||
88 | flags |= VIDEO_DIP_SELECT_SPD; | ||
89 | break; | ||
90 | default: | ||
91 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type); | ||
92 | break; | ||
93 | } | ||
94 | |||
95 | return flags; | ||
96 | } | ||
97 | |||
98 | static u32 intel_infoframe_flags(struct dip_infoframe *frame) | ||
99 | { | ||
100 | u32 flags = 0; | ||
101 | |||
102 | switch (frame->type) { | ||
103 | case DIP_TYPE_AVI: | ||
104 | flags |= VIDEO_DIP_ENABLE_AVI | VIDEO_DIP_FREQ_VSYNC; | ||
105 | break; | ||
106 | case DIP_TYPE_SPD: | ||
107 | flags |= VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_FREQ_2VSYNC; | ||
108 | break; | ||
109 | default: | ||
110 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type); | ||
111 | break; | ||
112 | } | ||
113 | |||
114 | return flags; | ||
115 | } | ||
116 | |||
117 | static void i9xx_write_infoframe(struct drm_encoder *encoder, | ||
118 | struct dip_infoframe *frame) | ||
119 | { | ||
120 | uint32_t *data = (uint32_t *)frame; | ||
84 | struct drm_device *dev = encoder->dev; | 121 | struct drm_device *dev = encoder->dev; |
85 | struct drm_i915_private *dev_priv = dev->dev_private; | 122 | struct drm_i915_private *dev_priv = dev->dev_private; |
86 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); | 123 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
87 | u32 port; | 124 | u32 port, flags, val = I915_READ(VIDEO_DIP_CTL); |
88 | unsigned i; | 125 | unsigned i, len = DIP_HEADER_SIZE + frame->len; |
89 | 126 | ||
90 | if (!intel_hdmi->has_hdmi_sink) | ||
91 | return; | ||
92 | 127 | ||
93 | /* XXX first guess at handling video port, is this corrent? */ | 128 | /* XXX first guess at handling video port, is this corrent? */ |
94 | if (intel_hdmi->sdvox_reg == SDVOB) | 129 | if (intel_hdmi->sdvox_reg == SDVOB) |
@@ -98,18 +133,87 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder) | |||
98 | else | 133 | else |
99 | return; | 134 | return; |
100 | 135 | ||
101 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | port | | 136 | flags = intel_infoframe_index(frame); |
102 | VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC); | 137 | |
138 | val &= ~VIDEO_DIP_SELECT_MASK; | ||
103 | 139 | ||
104 | intel_dip_infoframe_csum(&avi_if); | 140 | I915_WRITE(VIDEO_DIP_CTL, val | port | flags); |
105 | for (i = 0; i < sizeof(avi_if); i += 4) { | 141 | |
142 | for (i = 0; i < len; i += 4) { | ||
106 | I915_WRITE(VIDEO_DIP_DATA, *data); | 143 | I915_WRITE(VIDEO_DIP_DATA, *data); |
107 | data++; | 144 | data++; |
108 | } | 145 | } |
109 | 146 | ||
110 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | port | | 147 | flags |= intel_infoframe_flags(frame); |
111 | VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC | | 148 | |
112 | VIDEO_DIP_ENABLE_AVI); | 149 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
150 | } | ||
151 | |||
152 | static void ironlake_write_infoframe(struct drm_encoder *encoder, | ||
153 | struct dip_infoframe *frame) | ||
154 | { | ||
155 | uint32_t *data = (uint32_t *)frame; | ||
156 | struct drm_device *dev = encoder->dev; | ||
157 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
158 | struct drm_crtc *crtc = encoder->crtc; | ||
159 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
160 | int reg = TVIDEO_DIP_CTL(intel_crtc->pipe); | ||
161 | unsigned i, len = DIP_HEADER_SIZE + frame->len; | ||
162 | u32 flags, val = I915_READ(reg); | ||
163 | |||
164 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
165 | |||
166 | flags = intel_infoframe_index(frame); | ||
167 | |||
168 | val &= ~VIDEO_DIP_SELECT_MASK; | ||
169 | |||
170 | I915_WRITE(reg, val | flags); | ||
171 | |||
172 | for (i = 0; i < len; i += 4) { | ||
173 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data); | ||
174 | data++; | ||
175 | } | ||
176 | |||
177 | flags |= intel_infoframe_flags(frame); | ||
178 | |||
179 | I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); | ||
180 | } | ||
181 | static void intel_set_infoframe(struct drm_encoder *encoder, | ||
182 | struct dip_infoframe *frame) | ||
183 | { | ||
184 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); | ||
185 | |||
186 | if (!intel_hdmi->has_hdmi_sink) | ||
187 | return; | ||
188 | |||
189 | intel_dip_infoframe_csum(frame); | ||
190 | intel_hdmi->write_infoframe(encoder, frame); | ||
191 | } | ||
192 | |||
193 | static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder) | ||
194 | { | ||
195 | struct dip_infoframe avi_if = { | ||
196 | .type = DIP_TYPE_AVI, | ||
197 | .ver = DIP_VERSION_AVI, | ||
198 | .len = DIP_LEN_AVI, | ||
199 | }; | ||
200 | |||
201 | intel_set_infoframe(encoder, &avi_if); | ||
202 | } | ||
203 | |||
204 | static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder) | ||
205 | { | ||
206 | struct dip_infoframe spd_if; | ||
207 | |||
208 | memset(&spd_if, 0, sizeof(spd_if)); | ||
209 | spd_if.type = DIP_TYPE_SPD; | ||
210 | spd_if.ver = DIP_VERSION_SPD; | ||
211 | spd_if.len = DIP_LEN_SPD; | ||
212 | strcpy(spd_if.body.spd.vn, "Intel"); | ||
213 | strcpy(spd_if.body.spd.pd, "Integrated gfx"); | ||
214 | spd_if.body.spd.sdi = DIP_SPD_PC; | ||
215 | |||
216 | intel_set_infoframe(encoder, &spd_if); | ||
113 | } | 217 | } |
114 | 218 | ||
115 | static void intel_hdmi_mode_set(struct drm_encoder *encoder, | 219 | static void intel_hdmi_mode_set(struct drm_encoder *encoder, |
@@ -156,6 +260,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder, | |||
156 | POSTING_READ(intel_hdmi->sdvox_reg); | 260 | POSTING_READ(intel_hdmi->sdvox_reg); |
157 | 261 | ||
158 | intel_hdmi_set_avi_infoframe(encoder); | 262 | intel_hdmi_set_avi_infoframe(encoder); |
263 | intel_hdmi_set_spd_infoframe(encoder); | ||
159 | } | 264 | } |
160 | 265 | ||
161 | static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) | 266 | static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) |
@@ -433,6 +538,11 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
433 | 538 | ||
434 | intel_hdmi->sdvox_reg = sdvox_reg; | 539 | intel_hdmi->sdvox_reg = sdvox_reg; |
435 | 540 | ||
541 | if (!HAS_PCH_SPLIT(dev)) | ||
542 | intel_hdmi->write_infoframe = i9xx_write_infoframe; | ||
543 | else | ||
544 | intel_hdmi->write_infoframe = ironlake_write_infoframe; | ||
545 | |||
436 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); | 546 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); |
437 | 547 | ||
438 | intel_hdmi_add_properties(intel_hdmi, connector); | 548 | intel_hdmi_add_properties(intel_hdmi, connector); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index b28f7bd9f88a..2e8ddfcba40c 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -690,6 +690,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
690 | }, | 690 | }, |
691 | { | 691 | { |
692 | .callback = intel_no_lvds_dmi_callback, | 692 | .callback = intel_no_lvds_dmi_callback, |
693 | .ident = "Dell OptiPlex FX170", | ||
694 | .matches = { | ||
695 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
696 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex FX170"), | ||
697 | }, | ||
698 | }, | ||
699 | { | ||
700 | .callback = intel_no_lvds_dmi_callback, | ||
693 | .ident = "AOpen Mini PC", | 701 | .ident = "AOpen Mini PC", |
694 | .matches = { | 702 | .matches = { |
695 | DMI_MATCH(DMI_SYS_VENDOR, "AOpen"), | 703 | DMI_MATCH(DMI_SYS_VENDOR, "AOpen"), |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index a06ff07a4d3b..05f500cd9c24 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -83,11 +83,15 @@ intel_pch_panel_fitting(struct drm_device *dev, | |||
83 | u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; | 83 | u32 scaled_height = mode->hdisplay * adjusted_mode->vdisplay; |
84 | if (scaled_width > scaled_height) { /* pillar */ | 84 | if (scaled_width > scaled_height) { /* pillar */ |
85 | width = scaled_height / mode->vdisplay; | 85 | width = scaled_height / mode->vdisplay; |
86 | if (width & 1) | ||
87 | width++; | ||
86 | x = (adjusted_mode->hdisplay - width + 1) / 2; | 88 | x = (adjusted_mode->hdisplay - width + 1) / 2; |
87 | y = 0; | 89 | y = 0; |
88 | height = adjusted_mode->vdisplay; | 90 | height = adjusted_mode->vdisplay; |
89 | } else if (scaled_width < scaled_height) { /* letter */ | 91 | } else if (scaled_width < scaled_height) { /* letter */ |
90 | height = scaled_width / mode->hdisplay; | 92 | height = scaled_width / mode->hdisplay; |
93 | if (height & 1) | ||
94 | height++; | ||
91 | y = (adjusted_mode->vdisplay - height + 1) / 2; | 95 | y = (adjusted_mode->vdisplay - height + 1) / 2; |
92 | x = 0; | 96 | x = 0; |
93 | width = adjusted_mode->hdisplay; | 97 | width = adjusted_mode->hdisplay; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index e9615685a39c..47b9b2777038 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1321,6 +1321,9 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) | |||
1321 | ring->get_seqno = pc_render_get_seqno; | 1321 | ring->get_seqno = pc_render_get_seqno; |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | if (!I915_NEED_GFX_HWS(dev)) | ||
1325 | ring->status_page.page_addr = dev_priv->status_page_dmah->vaddr; | ||
1326 | |||
1324 | ring->dev = dev; | 1327 | ring->dev = dev; |
1325 | INIT_LIST_HEAD(&ring->active_list); | 1328 | INIT_LIST_HEAD(&ring->active_list); |
1326 | INIT_LIST_HEAD(&ring->request_list); | 1329 | INIT_LIST_HEAD(&ring->request_list); |