aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-07-21 02:59:16 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-07-21 03:01:16 -0400
commitd0d5864676dbccfb1337864a0ae6ce97e6342678 (patch)
tree7caa674ec05a1797054cd4304f0a047b6dacddd6 /drivers/gpu/drm/i915
parent6534e6809e6c9d48114b537afe03bee3fd33bf01 (diff)
parent9a3c4145af32125c5ee39c0272662b47307a8323 (diff)
Merge tag 'v3.16-rc6' into MTD development branch
Linux 3.16-rc6
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c48
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h3
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c8
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c9
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c44
-rw-r--r--drivers/gpu/drm/i915/i915_gpu_error.c3
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c18
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h3
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c58
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c46
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h6
-rw-r--r--drivers/gpu/drm/i915/intel_dsi.c29
-rw-r--r--drivers/gpu/drm/i915/intel_dsi_cmd.c6
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c7
-rw-r--r--drivers/gpu/drm/i915/intel_opregion.c9
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c21
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c89
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h2
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c4
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c8
-rw-r--r--drivers/gpu/drm/i915/intel_uncore.c3
23 files changed, 337 insertions, 95 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 601caa88c092..b8c689202c40 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -446,7 +446,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data)
446 446
447 memset(&stats, 0, sizeof(stats)); 447 memset(&stats, 0, sizeof(stats));
448 stats.file_priv = file->driver_priv; 448 stats.file_priv = file->driver_priv;
449 spin_lock(&file->table_lock);
449 idr_for_each(&file->object_idr, per_file_stats, &stats); 450 idr_for_each(&file->object_idr, per_file_stats, &stats);
451 spin_unlock(&file->table_lock);
450 /* 452 /*
451 * Although we have a valid reference on file->pid, that does 453 * Although we have a valid reference on file->pid, that does
452 * not guarantee that the task_struct who called get_pid() is 454 * not guarantee that the task_struct who called get_pid() is
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 4c22a5b7f4c5..d44344140627 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -36,6 +36,8 @@
36#include "i915_drv.h" 36#include "i915_drv.h"
37#include "i915_trace.h" 37#include "i915_trace.h"
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/console.h>
40#include <linux/vt.h>
39#include <linux/vgaarb.h> 41#include <linux/vgaarb.h>
40#include <linux/acpi.h> 42#include <linux/acpi.h>
41#include <linux/pnp.h> 43#include <linux/pnp.h>
@@ -1386,7 +1388,6 @@ cleanup_gem:
1386 i915_gem_context_fini(dev); 1388 i915_gem_context_fini(dev);
1387 mutex_unlock(&dev->struct_mutex); 1389 mutex_unlock(&dev->struct_mutex);
1388 WARN_ON(dev_priv->mm.aliasing_ppgtt); 1390 WARN_ON(dev_priv->mm.aliasing_ppgtt);
1389 drm_mm_takedown(&dev_priv->gtt.base.mm);
1390cleanup_irq: 1391cleanup_irq:
1391 drm_irq_uninstall(dev); 1392 drm_irq_uninstall(dev);
1392cleanup_gem_stolen: 1393cleanup_gem_stolen:
@@ -1450,6 +1451,39 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
1450} 1451}
1451#endif 1452#endif
1452 1453
1454#if !defined(CONFIG_VGA_CONSOLE)
1455static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1456{
1457 return 0;
1458}
1459#elif !defined(CONFIG_DUMMY_CONSOLE)
1460static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1461{
1462 return -ENODEV;
1463}
1464#else
1465static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
1466{
1467 int ret = 0;
1468
1469 DRM_INFO("Replacing VGA console driver\n");
1470
1471 console_lock();
1472 if (con_is_bound(&vga_con))
1473 ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
1474 if (ret == 0) {
1475 ret = do_unregister_con_driver(&vga_con);
1476
1477 /* Ignore "already unregistered". */
1478 if (ret == -ENODEV)
1479 ret = 0;
1480 }
1481 console_unlock();
1482
1483 return ret;
1484}
1485#endif
1486
1453static void i915_dump_device_info(struct drm_i915_private *dev_priv) 1487static void i915_dump_device_info(struct drm_i915_private *dev_priv)
1454{ 1488{
1455 const struct intel_device_info *info = &dev_priv->info; 1489 const struct intel_device_info *info = &dev_priv->info;
@@ -1623,8 +1657,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1623 if (ret) 1657 if (ret)
1624 goto out_regs; 1658 goto out_regs;
1625 1659
1626 if (drm_core_check_feature(dev, DRIVER_MODESET)) 1660 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1661 ret = i915_kick_out_vgacon(dev_priv);
1662 if (ret) {
1663 DRM_ERROR("failed to remove conflicting VGA console\n");
1664 goto out_gtt;
1665 }
1666
1627 i915_kick_out_firmware_fb(dev_priv); 1667 i915_kick_out_firmware_fb(dev_priv);
1668 }
1628 1669
1629 pci_set_master(dev->pdev); 1670 pci_set_master(dev->pdev);
1630 1671
@@ -1756,8 +1797,6 @@ out_mtrrfree:
1756 arch_phys_wc_del(dev_priv->gtt.mtrr); 1797 arch_phys_wc_del(dev_priv->gtt.mtrr);
1757 io_mapping_free(dev_priv->gtt.mappable); 1798 io_mapping_free(dev_priv->gtt.mappable);
1758out_gtt: 1799out_gtt:
1759 list_del(&dev_priv->gtt.base.global_link);
1760 drm_mm_takedown(&dev_priv->gtt.base.mm);
1761 dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); 1800 dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
1762out_regs: 1801out_regs:
1763 intel_uncore_fini(dev); 1802 intel_uncore_fini(dev);
@@ -1846,7 +1885,6 @@ int i915_driver_unload(struct drm_device *dev)
1846 i915_free_hws(dev); 1885 i915_free_hws(dev);
1847 } 1886 }
1848 1887
1849 list_del(&dev_priv->gtt.base.global_link);
1850 WARN_ON(!list_empty(&dev_priv->vm_list)); 1888 WARN_ON(!list_empty(&dev_priv->vm_list));
1851 1889
1852 drm_vblank_cleanup(dev); 1890 drm_vblank_cleanup(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 49414d30e8d4..374f964323ad 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -656,6 +656,7 @@ enum intel_sbi_destination {
656#define QUIRK_PIPEA_FORCE (1<<0) 656#define QUIRK_PIPEA_FORCE (1<<0)
657#define QUIRK_LVDS_SSC_DISABLE (1<<1) 657#define QUIRK_LVDS_SSC_DISABLE (1<<1)
658#define QUIRK_INVERT_BRIGHTNESS (1<<2) 658#define QUIRK_INVERT_BRIGHTNESS (1<<2)
659#define QUIRK_BACKLIGHT_PRESENT (1<<3)
659 660
660struct intel_fbdev; 661struct intel_fbdev;
661struct intel_fbc_work; 662struct intel_fbc_work;
@@ -977,6 +978,8 @@ struct i915_power_well {
977 bool always_on; 978 bool always_on;
978 /* power well enable/disable usage count */ 979 /* power well enable/disable usage count */
979 int count; 980 int count;
981 /* cached hw enabled state */
982 bool hw_enabled;
980 unsigned long domains; 983 unsigned long domains;
981 unsigned long data; 984 unsigned long data;
982 const struct i915_power_well_ops *ops; 985 const struct i915_power_well_ops *ops;
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 3ffe308d5893..a5ddf3bce9c3 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring,
598 struct intel_context *from = ring->last_context; 598 struct intel_context *from = ring->last_context;
599 struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); 599 struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to);
600 u32 hw_flags = 0; 600 u32 hw_flags = 0;
601 bool uninitialized = false;
601 int ret, i; 602 int ret, i;
602 603
603 if (from != NULL && ring == &dev_priv->ring[RCS]) { 604 if (from != NULL && ring == &dev_priv->ring[RCS]) {
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring,
696 i915_gem_context_unreference(from); 697 i915_gem_context_unreference(from);
697 } 698 }
698 699
700 uninitialized = !to->is_initialized && from == NULL;
701 to->is_initialized = true;
702
699done: 703done:
700 i915_gem_context_reference(to); 704 i915_gem_context_reference(to);
701 ring->last_context = to; 705 ring->last_context = to;
702 to->last_ring = ring; 706 to->last_ring = ring;
703 707
704 if (ring->id == RCS && !to->is_initialized && from == NULL) { 708 if (uninitialized) {
705 ret = i915_gem_render_state_init(ring); 709 ret = i915_gem_render_state_init(ring);
706 if (ret) 710 if (ret)
707 DRM_ERROR("init render state: %d\n", ret); 711 DRM_ERROR("init render state: %d\n", ret);
708 } 712 }
709 713
710 to->is_initialized = true;
711
712 return 0; 714 return 0;
713 715
714unpin_out: 716unpin_out:
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index eec820aec022..8b3cde703364 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1992,7 +1992,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
1992 1992
1993 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); 1993 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
1994 1994
1995 drm_mm_takedown(&vm->mm); 1995 if (drm_mm_initialized(&vm->mm)) {
1996 drm_mm_takedown(&vm->mm);
1997 list_del(&vm->global_link);
1998 }
1996 iounmap(gtt->gsm); 1999 iounmap(gtt->gsm);
1997 teardown_scratch_page(vm->dev); 2000 teardown_scratch_page(vm->dev);
1998} 2001}
@@ -2025,6 +2028,10 @@ static int i915_gmch_probe(struct drm_device *dev,
2025 2028
2026static void i915_gmch_remove(struct i915_address_space *vm) 2029static void i915_gmch_remove(struct i915_address_space *vm)
2027{ 2030{
2031 if (drm_mm_initialized(&vm->mm)) {
2032 drm_mm_takedown(&vm->mm);
2033 list_del(&vm->global_link);
2034 }
2028 intel_gmch_remove(); 2035 intel_gmch_remove();
2029} 2036}
2030 2037
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 62ef55ba061c..7465ab0fd396 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -74,6 +74,50 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
74 if (base == 0) 74 if (base == 0)
75 return 0; 75 return 0;
76 76
77 /* make sure we don't clobber the GTT if it's within stolen memory */
78 if (INTEL_INFO(dev)->gen <= 4 && !IS_G33(dev) && !IS_G4X(dev)) {
79 struct {
80 u32 start, end;
81 } stolen[2] = {
82 { .start = base, .end = base + dev_priv->gtt.stolen_size, },
83 { .start = base, .end = base + dev_priv->gtt.stolen_size, },
84 };
85 u64 gtt_start, gtt_end;
86
87 gtt_start = I915_READ(PGTBL_CTL);
88 if (IS_GEN4(dev))
89 gtt_start = (gtt_start & PGTBL_ADDRESS_LO_MASK) |
90 (gtt_start & PGTBL_ADDRESS_HI_MASK) << 28;
91 else
92 gtt_start &= PGTBL_ADDRESS_LO_MASK;
93 gtt_end = gtt_start + gtt_total_entries(dev_priv->gtt) * 4;
94
95 if (gtt_start >= stolen[0].start && gtt_start < stolen[0].end)
96 stolen[0].end = gtt_start;
97 if (gtt_end > stolen[1].start && gtt_end <= stolen[1].end)
98 stolen[1].start = gtt_end;
99
100 /* pick the larger of the two chunks */
101 if (stolen[0].end - stolen[0].start >
102 stolen[1].end - stolen[1].start) {
103 base = stolen[0].start;
104 dev_priv->gtt.stolen_size = stolen[0].end - stolen[0].start;
105 } else {
106 base = stolen[1].start;
107 dev_priv->gtt.stolen_size = stolen[1].end - stolen[1].start;
108 }
109
110 if (stolen[0].start != stolen[1].start ||
111 stolen[0].end != stolen[1].end) {
112 DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n",
113 (unsigned long long) gtt_start,
114 (unsigned long long) gtt_end - 1);
115 DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n",
116 base, base + (u32) dev_priv->gtt.stolen_size - 1);
117 }
118 }
119
120
77 /* Verify that nothing else uses this physical address. Stolen 121 /* Verify that nothing else uses this physical address. Stolen
78 * memory should be reserved by the BIOS and hidden from the 122 * memory should be reserved by the BIOS and hidden from the
79 * kernel. So if the region is already marked as busy, something 123 * kernel. So if the region is already marked as busy, something
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 87ec60e181a7..66cf41765bf9 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -888,6 +888,8 @@ static void i915_gem_record_rings(struct drm_device *dev,
888 for (i = 0; i < I915_NUM_RINGS; i++) { 888 for (i = 0; i < I915_NUM_RINGS; i++) {
889 struct intel_engine_cs *ring = &dev_priv->ring[i]; 889 struct intel_engine_cs *ring = &dev_priv->ring[i];
890 890
891 error->ring[i].pid = -1;
892
891 if (ring->dev == NULL) 893 if (ring->dev == NULL)
892 continue; 894 continue;
893 895
@@ -895,7 +897,6 @@ static void i915_gem_record_rings(struct drm_device *dev,
895 897
896 i915_record_ring_state(dev, ring, &error->ring[i]); 898 i915_record_ring_state(dev, ring, &error->ring[i]);
897 899
898 error->ring[i].pid = -1;
899 request = i915_gem_find_active_request(ring); 900 request = i915_gem_find_active_request(ring);
900 if (request) { 901 if (request) {
901 /* We need to copy these to an anonymous buffer 902 /* We need to copy these to an anonymous buffer
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 6f8017a7e937..267f069765ad 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2847,10 +2847,14 @@ static int semaphore_passed(struct intel_engine_cs *ring)
2847 struct intel_engine_cs *signaller; 2847 struct intel_engine_cs *signaller;
2848 u32 seqno, ctl; 2848 u32 seqno, ctl;
2849 2849
2850 ring->hangcheck.deadlock = true; 2850 ring->hangcheck.deadlock++;
2851 2851
2852 signaller = semaphore_waits_for(ring, &seqno); 2852 signaller = semaphore_waits_for(ring, &seqno);
2853 if (signaller == NULL || signaller->hangcheck.deadlock) 2853 if (signaller == NULL)
2854 return -1;
2855
2856 /* Prevent pathological recursion due to driver bugs */
2857 if (signaller->hangcheck.deadlock >= I915_NUM_RINGS)
2854 return -1; 2858 return -1;
2855 2859
2856 /* cursory check for an unkickable deadlock */ 2860 /* cursory check for an unkickable deadlock */
@@ -2858,7 +2862,13 @@ static int semaphore_passed(struct intel_engine_cs *ring)
2858 if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) 2862 if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0)
2859 return -1; 2863 return -1;
2860 2864
2861 return i915_seqno_passed(signaller->get_seqno(signaller, false), seqno); 2865 if (i915_seqno_passed(signaller->get_seqno(signaller, false), seqno))
2866 return 1;
2867
2868 if (signaller->hangcheck.deadlock)
2869 return -1;
2870
2871 return 0;
2862} 2872}
2863 2873
2864static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) 2874static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv)
@@ -2867,7 +2877,7 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv)
2867 int i; 2877 int i;
2868 2878
2869 for_each_ring(ring, dev_priv, i) 2879 for_each_ring(ring, dev_priv, i)
2870 ring->hangcheck.deadlock = false; 2880 ring->hangcheck.deadlock = 0;
2871} 2881}
2872 2882
2873static enum intel_ring_hangcheck_action 2883static enum intel_ring_hangcheck_action
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index e691b30b2817..a5bab61bfc00 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -942,6 +942,9 @@ enum punit_power_well {
942/* 942/*
943 * Instruction and interrupt control regs 943 * Instruction and interrupt control regs
944 */ 944 */
945#define PGTBL_CTL 0x02020
946#define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */
947#define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */
945#define PGTBL_ER 0x02024 948#define PGTBL_ER 0x02024
946#define RENDER_RING_BASE 0x02000 949#define RENDER_RING_BASE 0x02000
947#define BSD_RING_BASE 0x04000 950#define BSD_RING_BASE 0x04000
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 1ee98f121a00..827498e081df 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -315,9 +315,6 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
315 const struct bdb_lfp_backlight_data *backlight_data; 315 const struct bdb_lfp_backlight_data *backlight_data;
316 const struct bdb_lfp_backlight_data_entry *entry; 316 const struct bdb_lfp_backlight_data_entry *entry;
317 317
318 /* Err to enabling backlight if no backlight block. */
319 dev_priv->vbt.backlight.present = true;
320
321 backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); 318 backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT);
322 if (!backlight_data) 319 if (!backlight_data)
323 return; 320 return;
@@ -1088,6 +1085,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
1088 1085
1089 dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; 1086 dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC;
1090 1087
1088 /* Default to having backlight */
1089 dev_priv->vbt.backlight.present = true;
1090
1091 /* LFP panel data */ 1091 /* LFP panel data */
1092 dev_priv->vbt.lvds_dither = 1; 1092 dev_priv->vbt.lvds_dither = 1;
1093 dev_priv->vbt.lvds_vbt = 0; 1093 dev_priv->vbt.lvds_vbt = 0;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index efd3cf50cb0f..f0be855ddf45 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2087,6 +2087,7 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv,
2087static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, 2087static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
2088 enum plane plane, enum pipe pipe) 2088 enum plane plane, enum pipe pipe)
2089{ 2089{
2090 struct drm_device *dev = dev_priv->dev;
2090 struct intel_crtc *intel_crtc = 2091 struct intel_crtc *intel_crtc =
2091 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); 2092 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
2092 int reg; 2093 int reg;
@@ -2106,6 +2107,14 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv,
2106 2107
2107 I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); 2108 I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
2108 intel_flush_primary_plane(dev_priv, plane); 2109 intel_flush_primary_plane(dev_priv, plane);
2110
2111 /*
2112 * BDW signals flip done immediately if the plane
2113 * is disabled, even if the plane enable is already
2114 * armed to occur at the next vblank :(
2115 */
2116 if (IS_BROADWELL(dev))
2117 intel_wait_for_vblank(dev, intel_crtc->pipe);
2109} 2118}
2110 2119
2111/** 2120/**
@@ -4564,7 +4573,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
4564 if (intel_crtc->active) 4573 if (intel_crtc->active)
4565 return; 4574 return;
4566 4575
4567 vlv_prepare_pll(intel_crtc); 4576 is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI);
4577
4578 if (!is_dsi && !IS_CHERRYVIEW(dev))
4579 vlv_prepare_pll(intel_crtc);
4568 4580
4569 /* Set up the display plane register */ 4581 /* Set up the display plane register */
4570 dspcntr = DISPPLANE_GAMMA_ENABLE; 4582 dspcntr = DISPPLANE_GAMMA_ENABLE;
@@ -4598,8 +4610,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
4598 if (encoder->pre_pll_enable) 4610 if (encoder->pre_pll_enable)
4599 encoder->pre_pll_enable(encoder); 4611 encoder->pre_pll_enable(encoder);
4600 4612
4601 is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI);
4602
4603 if (!is_dsi) { 4613 if (!is_dsi) {
4604 if (IS_CHERRYVIEW(dev)) 4614 if (IS_CHERRYVIEW(dev))
4605 chv_enable_pll(intel_crtc); 4615 chv_enable_pll(intel_crtc);
@@ -11087,6 +11097,22 @@ const char *intel_output_name(int output)
11087 return names[output]; 11097 return names[output];
11088} 11098}
11089 11099
11100static bool intel_crt_present(struct drm_device *dev)
11101{
11102 struct drm_i915_private *dev_priv = dev->dev_private;
11103
11104 if (IS_ULT(dev))
11105 return false;
11106
11107 if (IS_CHERRYVIEW(dev))
11108 return false;
11109
11110 if (IS_VALLEYVIEW(dev) && !dev_priv->vbt.int_crt_support)
11111 return false;
11112
11113 return true;
11114}
11115
11090static void intel_setup_outputs(struct drm_device *dev) 11116static void intel_setup_outputs(struct drm_device *dev)
11091{ 11117{
11092 struct drm_i915_private *dev_priv = dev->dev_private; 11118 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -11095,7 +11121,7 @@ static void intel_setup_outputs(struct drm_device *dev)
11095 11121
11096 intel_lvds_init(dev); 11122 intel_lvds_init(dev);
11097 11123
11098 if (!IS_ULT(dev) && !IS_CHERRYVIEW(dev) && dev_priv->vbt.int_crt_support) 11124 if (intel_crt_present(dev))
11099 intel_crt_init(dev); 11125 intel_crt_init(dev);
11100 11126
11101 if (HAS_DDI(dev)) { 11127 if (HAS_DDI(dev)) {
@@ -11565,6 +11591,14 @@ static void quirk_invert_brightness(struct drm_device *dev)
11565 DRM_INFO("applying inverted panel brightness quirk\n"); 11591 DRM_INFO("applying inverted panel brightness quirk\n");
11566} 11592}
11567 11593
11594/* Some VBT's incorrectly indicate no backlight is present */
11595static void quirk_backlight_present(struct drm_device *dev)
11596{
11597 struct drm_i915_private *dev_priv = dev->dev_private;
11598 dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT;
11599 DRM_INFO("applying backlight present quirk\n");
11600}
11601
11568struct intel_quirk { 11602struct intel_quirk {
11569 int device; 11603 int device;
11570 int subsystem_vendor; 11604 int subsystem_vendor;
@@ -11633,6 +11667,15 @@ static struct intel_quirk intel_quirks[] = {
11633 11667
11634 /* Acer Aspire 5336 */ 11668 /* Acer Aspire 5336 */
11635 { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, 11669 { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness },
11670
11671 /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */
11672 { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present },
11673
11674 /* Toshiba CB35 Chromebook (Celeron 2955U) */
11675 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
11676
11677 /* HP Chromebook 14 (Celeron 2955U) */
11678 { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present },
11636}; 11679};
11637 11680
11638static void intel_init_quirks(struct drm_device *dev) 11681static void intel_init_quirks(struct drm_device *dev)
@@ -11871,6 +11914,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
11871 * ... */ 11914 * ... */
11872 plane = crtc->plane; 11915 plane = crtc->plane;
11873 crtc->plane = !plane; 11916 crtc->plane = !plane;
11917 crtc->primary_enabled = true;
11874 dev_priv->display.crtc_disable(&crtc->base); 11918 dev_priv->display.crtc_disable(&crtc->base);
11875 crtc->plane = plane; 11919 crtc->plane = plane;
11876 11920
@@ -12411,8 +12455,8 @@ intel_display_capture_error_state(struct drm_device *dev)
12411 12455
12412 for_each_pipe(i) { 12456 for_each_pipe(i) {
12413 error->pipe[i].power_domain_on = 12457 error->pipe[i].power_domain_on =
12414 intel_display_power_enabled_sw(dev_priv, 12458 intel_display_power_enabled_unlocked(dev_priv,
12415 POWER_DOMAIN_PIPE(i)); 12459 POWER_DOMAIN_PIPE(i));
12416 if (!error->pipe[i].power_domain_on) 12460 if (!error->pipe[i].power_domain_on)
12417 continue; 12461 continue;
12418 12462
@@ -12447,7 +12491,7 @@ intel_display_capture_error_state(struct drm_device *dev)
12447 enum transcoder cpu_transcoder = transcoders[i]; 12491 enum transcoder cpu_transcoder = transcoders[i];
12448 12492
12449 error->transcoder[i].power_domain_on = 12493 error->transcoder[i].power_domain_on =
12450 intel_display_power_enabled_sw(dev_priv, 12494 intel_display_power_enabled_unlocked(dev_priv,
12451 POWER_DOMAIN_TRANSCODER(cpu_transcoder)); 12495 POWER_DOMAIN_TRANSCODER(cpu_transcoder));
12452 if (!error->transcoder[i].power_domain_on) 12496 if (!error->transcoder[i].power_domain_on)
12453 continue; 12497 continue;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 52fda950fd2a..8a1a4fbc06ac 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -28,6 +28,8 @@
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/export.h> 30#include <linux/export.h>
31#include <linux/notifier.h>
32#include <linux/reboot.h>
31#include <drm/drmP.h> 33#include <drm/drmP.h>
32#include <drm/drm_crtc.h> 34#include <drm/drm_crtc.h>
33#include <drm/drm_crtc_helper.h> 35#include <drm/drm_crtc_helper.h>
@@ -336,6 +338,37 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)
336 return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); 338 return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp));
337} 339}
338 340
341/* Reboot notifier handler to shutdown panel power to guarantee T12 timing
342 This function only applicable when panel PM state is not to be tracked */
343static int edp_notify_handler(struct notifier_block *this, unsigned long code,
344 void *unused)
345{
346 struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp),
347 edp_notifier);
348 struct drm_device *dev = intel_dp_to_dev(intel_dp);
349 struct drm_i915_private *dev_priv = dev->dev_private;
350 u32 pp_div;
351 u32 pp_ctrl_reg, pp_div_reg;
352 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
353
354 if (!is_edp(intel_dp) || code != SYS_RESTART)
355 return 0;
356
357 if (IS_VALLEYVIEW(dev)) {
358 pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe);
359 pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe);
360 pp_div = I915_READ(pp_div_reg);
361 pp_div &= PP_REFERENCE_DIVIDER_MASK;
362
363 /* 0x1F write to PP_DIV_REG sets max cycle delay */
364 I915_WRITE(pp_div_reg, pp_div | 0x1F);
365 I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF);
366 msleep(intel_dp->panel_power_cycle_delay);
367 }
368
369 return 0;
370}
371
339static bool edp_have_panel_power(struct intel_dp *intel_dp) 372static bool edp_have_panel_power(struct intel_dp *intel_dp)
340{ 373{
341 struct drm_device *dev = intel_dp_to_dev(intel_dp); 374 struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -873,8 +906,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
873 mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, 906 mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
874 bpp); 907 bpp);
875 908
876 for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) { 909 for (clock = min_clock; clock <= max_clock; clock++) {
877 for (clock = min_clock; clock <= max_clock; clock++) { 910 for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) {
878 link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); 911 link_clock = drm_dp_bw_code_to_link_rate(bws[clock]);
879 link_avail = intel_dp_max_data_rate(link_clock, 912 link_avail = intel_dp_max_data_rate(link_clock,
880 lane_count); 913 lane_count);
@@ -3707,6 +3740,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
3707 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); 3740 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
3708 edp_panel_vdd_off_sync(intel_dp); 3741 edp_panel_vdd_off_sync(intel_dp);
3709 drm_modeset_unlock(&dev->mode_config.connection_mutex); 3742 drm_modeset_unlock(&dev->mode_config.connection_mutex);
3743 if (intel_dp->edp_notifier.notifier_call) {
3744 unregister_reboot_notifier(&intel_dp->edp_notifier);
3745 intel_dp->edp_notifier.notifier_call = NULL;
3746 }
3710 } 3747 }
3711 kfree(intel_dig_port); 3748 kfree(intel_dig_port);
3712} 3749}
@@ -4184,6 +4221,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
4184 } 4221 }
4185 mutex_unlock(&dev->mode_config.mutex); 4222 mutex_unlock(&dev->mode_config.mutex);
4186 4223
4224 if (IS_VALLEYVIEW(dev)) {
4225 intel_dp->edp_notifier.notifier_call = edp_notify_handler;
4226 register_reboot_notifier(&intel_dp->edp_notifier);
4227 }
4228
4187 intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); 4229 intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode);
4188 intel_panel_setup_backlight(connector); 4230 intel_panel_setup_backlight(connector);
4189 4231
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index bda0ae3d80cc..f67340ed2c12 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -538,6 +538,8 @@ struct intel_dp {
538 unsigned long last_power_on; 538 unsigned long last_power_on;
539 unsigned long last_backlight_off; 539 unsigned long last_backlight_off;
540 bool psr_setup_done; 540 bool psr_setup_done;
541 struct notifier_block edp_notifier;
542
541 bool use_tps3; 543 bool use_tps3;
542 struct intel_connector *attached_connector; 544 struct intel_connector *attached_connector;
543 545
@@ -950,8 +952,8 @@ int intel_power_domains_init(struct drm_i915_private *);
950void intel_power_domains_remove(struct drm_i915_private *); 952void intel_power_domains_remove(struct drm_i915_private *);
951bool intel_display_power_enabled(struct drm_i915_private *dev_priv, 953bool intel_display_power_enabled(struct drm_i915_private *dev_priv,
952 enum intel_display_power_domain domain); 954 enum intel_display_power_domain domain);
953bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, 955bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv,
954 enum intel_display_power_domain domain); 956 enum intel_display_power_domain domain);
955void intel_display_power_get(struct drm_i915_private *dev_priv, 957void intel_display_power_get(struct drm_i915_private *dev_priv,
956 enum intel_display_power_domain domain); 958 enum intel_display_power_domain domain);
957void intel_display_power_put(struct drm_i915_private *dev_priv, 959void intel_display_power_put(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 02f99d768d49..3fd082933c87 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -117,17 +117,18 @@ static void intel_dsi_device_ready(struct intel_encoder *encoder)
117 /* bandgap reset is needed after everytime we do power gate */ 117 /* bandgap reset is needed after everytime we do power gate */
118 band_gap_reset(dev_priv); 118 band_gap_reset(dev_priv);
119 119
120 I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER);
121 usleep_range(2500, 3000);
122
120 val = I915_READ(MIPI_PORT_CTRL(pipe)); 123 val = I915_READ(MIPI_PORT_CTRL(pipe));
121 I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); 124 I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD);
122 usleep_range(1000, 1500); 125 usleep_range(1000, 1500);
123 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); 126
124 usleep_range(2000, 2500); 127 I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT);
125 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); 128 usleep_range(2500, 3000);
126 usleep_range(2000, 2500); 129
127 I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00);
128 usleep_range(2000, 2500);
129 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); 130 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY);
130 usleep_range(2000, 2500); 131 usleep_range(2500, 3000);
131} 132}
132 133
133static void intel_dsi_enable(struct intel_encoder *encoder) 134static void intel_dsi_enable(struct intel_encoder *encoder)
@@ -271,23 +272,23 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
271 272
272 DRM_DEBUG_KMS("\n"); 273 DRM_DEBUG_KMS("\n");
273 274
274 I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); 275 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER);
275 usleep_range(2000, 2500); 276 usleep_range(2000, 2500);
276 277
277 I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); 278 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT);
278 usleep_range(2000, 2500); 279 usleep_range(2000, 2500);
279 280
280 I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); 281 I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER);
281 usleep_range(2000, 2500); 282 usleep_range(2000, 2500);
282 283
283 val = I915_READ(MIPI_PORT_CTRL(pipe));
284 I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD);
285 usleep_range(1000, 1500);
286
287 if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) 284 if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT)
288 == 0x00000), 30)) 285 == 0x00000), 30))
289 DRM_ERROR("DSI LP not going Low\n"); 286 DRM_ERROR("DSI LP not going Low\n");
290 287
288 val = I915_READ(MIPI_PORT_CTRL(pipe));
289 I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD);
290 usleep_range(1000, 1500);
291
291 I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); 292 I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00);
292 usleep_range(2000, 2500); 293 usleep_range(2000, 2500);
293 294
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index 3eeb21b9fddf..933c86305237 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -404,12 +404,6 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs)
404 else 404 else
405 cmd |= DPI_LP_MODE; 405 cmd |= DPI_LP_MODE;
406 406
407 /* DPI virtual channel?! */
408
409 mask = DPI_FIFO_EMPTY;
410 if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 50))
411 DRM_ERROR("Timeout waiting for DPI FIFO empty.\n");
412
413 /* clear bit */ 407 /* clear bit */
414 I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); 408 I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT);
415 409
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 23126023aeba..5e5a72fca5fb 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -111,6 +111,13 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
111 111
112 pipe_config->adjusted_mode.flags |= flags; 112 pipe_config->adjusted_mode.flags |= flags;
113 113
114 /* gen2/3 store dither state in pfit control, needs to match */
115 if (INTEL_INFO(dev)->gen < 4) {
116 tmp = I915_READ(PFIT_CONTROL);
117
118 pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE;
119 }
120
114 dotclock = pipe_config->port_clock; 121 dotclock = pipe_config->port_clock;
115 122
116 if (HAS_PCH_SPLIT(dev_priv->dev)) 123 if (HAS_PCH_SPLIT(dev_priv->dev))
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 2e2c71fcc9ed..4f6b53998d79 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -403,6 +403,15 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
403 403
404 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); 404 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
405 405
406 /*
407 * If the acpi_video interface is not supposed to be used, don't
408 * bother processing backlight level change requests from firmware.
409 */
410 if (!acpi_video_verify_backlight_support()) {
411 DRM_DEBUG_KMS("opregion backlight request ignored\n");
412 return 0;
413 }
414
406 if (!(bclp & ASLE_BCLP_VALID)) 415 if (!(bclp & ASLE_BCLP_VALID))
407 return ASLC_BACKLIGHT_FAILED; 416 return ASLC_BACKLIGHT_FAILED;
408 417
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 5e6c888b4928..12b02fe1d0ae 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -361,16 +361,16 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc,
361 pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | 361 pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) |
362 PFIT_FILTER_FUZZY); 362 PFIT_FILTER_FUZZY);
363 363
364 /* Make sure pre-965 set dither correctly for 18bpp panels. */
365 if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18)
366 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
367
368out: 364out:
369 if ((pfit_control & PFIT_ENABLE) == 0) { 365 if ((pfit_control & PFIT_ENABLE) == 0) {
370 pfit_control = 0; 366 pfit_control = 0;
371 pfit_pgm_ratios = 0; 367 pfit_pgm_ratios = 0;
372 } 368 }
373 369
370 /* Make sure pre-965 set dither correctly for 18bpp panels. */
371 if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18)
372 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
373
374 pipe_config->gmch_pfit.control = pfit_control; 374 pipe_config->gmch_pfit.control = pfit_control;
375 pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; 375 pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios;
376 pipe_config->gmch_pfit.lvds_border_bits = border; 376 pipe_config->gmch_pfit.lvds_border_bits = border;
@@ -798,9 +798,6 @@ static void i965_enable_backlight(struct intel_connector *connector)
798 ctl = freq << 16; 798 ctl = freq << 16;
799 I915_WRITE(BLC_PWM_CTL, ctl); 799 I915_WRITE(BLC_PWM_CTL, ctl);
800 800
801 /* XXX: combine this into above write? */
802 intel_panel_actually_set_backlight(connector, panel->backlight.level);
803
804 ctl2 = BLM_PIPE(pipe); 801 ctl2 = BLM_PIPE(pipe);
805 if (panel->backlight.combination_mode) 802 if (panel->backlight.combination_mode)
806 ctl2 |= BLM_COMBINATION_MODE; 803 ctl2 |= BLM_COMBINATION_MODE;
@@ -809,6 +806,8 @@ static void i965_enable_backlight(struct intel_connector *connector)
809 I915_WRITE(BLC_PWM_CTL2, ctl2); 806 I915_WRITE(BLC_PWM_CTL2, ctl2);
810 POSTING_READ(BLC_PWM_CTL2); 807 POSTING_READ(BLC_PWM_CTL2);
811 I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); 808 I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE);
809
810 intel_panel_actually_set_backlight(connector, panel->backlight.level);
812} 811}
813 812
814static void vlv_enable_backlight(struct intel_connector *connector) 813static void vlv_enable_backlight(struct intel_connector *connector)
@@ -1119,8 +1118,12 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
1119 int ret; 1118 int ret;
1120 1119
1121 if (!dev_priv->vbt.backlight.present) { 1120 if (!dev_priv->vbt.backlight.present) {
1122 DRM_DEBUG_KMS("native backlight control not available per VBT\n"); 1121 if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) {
1123 return 0; 1122 DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n");
1123 } else {
1124 DRM_DEBUG_KMS("no backlight present per VBT\n");
1125 return 0;
1126 }
1124 } 1127 }
1125 1128
1126 /* set level and max in panel struct */ 1129 /* set level and max in panel struct */
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d1e53abec1b5..ee72807069e4 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -511,8 +511,7 @@ void intel_update_fbc(struct drm_device *dev)
511 obj = intel_fb->obj; 511 obj = intel_fb->obj;
512 adjusted_mode = &intel_crtc->config.adjusted_mode; 512 adjusted_mode = &intel_crtc->config.adjusted_mode;
513 513
514 if (i915.enable_fbc < 0 && 514 if (i915.enable_fbc < 0) {
515 INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) {
516 if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) 515 if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT))
517 DRM_DEBUG_KMS("disabled per chip default\n"); 516 DRM_DEBUG_KMS("disabled per chip default\n");
518 goto out_disable; 517 goto out_disable;
@@ -3210,6 +3209,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val)
3210*/ 3209*/
3211static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) 3210static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
3212{ 3211{
3212 struct drm_device *dev = dev_priv->dev;
3213
3214 /* Latest VLV doesn't need to force the gfx clock */
3215 if (dev->pdev->revision >= 0xd) {
3216 valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit);
3217 return;
3218 }
3219
3213 /* 3220 /*
3214 * When we are idle. Drop to min voltage state. 3221 * When we are idle. Drop to min voltage state.
3215 */ 3222 */
@@ -3506,15 +3513,11 @@ static void gen8_enable_rps(struct drm_device *dev)
3506 3513
3507 I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); 3514 I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10);
3508 3515
3509 /* WaDisablePwrmtrEvent:chv (pre-production hw) */
3510 I915_WRITE(0xA80C, I915_READ(0xA80C) & 0x00ffffff);
3511 I915_WRITE(0xA810, I915_READ(0xA810) & 0xffffff00);
3512
3513 /* 5: Enable RPS */ 3516 /* 5: Enable RPS */
3514 I915_WRITE(GEN6_RP_CONTROL, 3517 I915_WRITE(GEN6_RP_CONTROL,
3515 GEN6_RP_MEDIA_TURBO | 3518 GEN6_RP_MEDIA_TURBO |
3516 GEN6_RP_MEDIA_HW_NORMAL_MODE | 3519 GEN6_RP_MEDIA_HW_NORMAL_MODE |
3517 GEN6_RP_MEDIA_IS_GFX | /* WaSetMaskForGfxBusyness:chv (pre-production hw ?) */ 3520 GEN6_RP_MEDIA_IS_GFX |
3518 GEN6_RP_ENABLE | 3521 GEN6_RP_ENABLE |
3519 GEN6_RP_UP_BUSY_AVG | 3522 GEN6_RP_UP_BUSY_AVG |
3520 GEN6_RP_DOWN_IDLE_AVG); 3523 GEN6_RP_DOWN_IDLE_AVG);
@@ -5608,8 +5611,8 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv,
5608 (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); 5611 (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED);
5609} 5612}
5610 5613
5611bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, 5614bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv,
5612 enum intel_display_power_domain domain) 5615 enum intel_display_power_domain domain)
5613{ 5616{
5614 struct i915_power_domains *power_domains; 5617 struct i915_power_domains *power_domains;
5615 struct i915_power_well *power_well; 5618 struct i915_power_well *power_well;
@@ -5620,16 +5623,19 @@ bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv,
5620 return false; 5623 return false;
5621 5624
5622 power_domains = &dev_priv->power_domains; 5625 power_domains = &dev_priv->power_domains;
5626
5623 is_enabled = true; 5627 is_enabled = true;
5628
5624 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { 5629 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) {
5625 if (power_well->always_on) 5630 if (power_well->always_on)
5626 continue; 5631 continue;
5627 5632
5628 if (!power_well->count) { 5633 if (!power_well->hw_enabled) {
5629 is_enabled = false; 5634 is_enabled = false;
5630 break; 5635 break;
5631 } 5636 }
5632 } 5637 }
5638
5633 return is_enabled; 5639 return is_enabled;
5634} 5640}
5635 5641
@@ -5637,30 +5643,15 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv,
5637 enum intel_display_power_domain domain) 5643 enum intel_display_power_domain domain)
5638{ 5644{
5639 struct i915_power_domains *power_domains; 5645 struct i915_power_domains *power_domains;
5640 struct i915_power_well *power_well; 5646 bool ret;
5641 bool is_enabled;
5642 int i;
5643
5644 if (dev_priv->pm.suspended)
5645 return false;
5646 5647
5647 power_domains = &dev_priv->power_domains; 5648 power_domains = &dev_priv->power_domains;
5648 5649
5649 is_enabled = true;
5650
5651 mutex_lock(&power_domains->lock); 5650 mutex_lock(&power_domains->lock);
5652 for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { 5651 ret = intel_display_power_enabled_unlocked(dev_priv, domain);
5653 if (power_well->always_on)
5654 continue;
5655
5656 if (!power_well->ops->is_enabled(dev_priv, power_well)) {
5657 is_enabled = false;
5658 break;
5659 }
5660 }
5661 mutex_unlock(&power_domains->lock); 5652 mutex_unlock(&power_domains->lock);
5662 5653
5663 return is_enabled; 5654 return ret;
5664} 5655}
5665 5656
5666/* 5657/*
@@ -5981,6 +5972,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv,
5981 if (!power_well->count++) { 5972 if (!power_well->count++) {
5982 DRM_DEBUG_KMS("enabling %s\n", power_well->name); 5973 DRM_DEBUG_KMS("enabling %s\n", power_well->name);
5983 power_well->ops->enable(dev_priv, power_well); 5974 power_well->ops->enable(dev_priv, power_well);
5975 power_well->hw_enabled = true;
5984 } 5976 }
5985 5977
5986 check_power_well_state(dev_priv, power_well); 5978 check_power_well_state(dev_priv, power_well);
@@ -6010,6 +6002,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
6010 6002
6011 if (!--power_well->count && i915.disable_power_well) { 6003 if (!--power_well->count && i915.disable_power_well) {
6012 DRM_DEBUG_KMS("disabling %s\n", power_well->name); 6004 DRM_DEBUG_KMS("disabling %s\n", power_well->name);
6005 power_well->hw_enabled = false;
6013 power_well->ops->disable(dev_priv, power_well); 6006 power_well->ops->disable(dev_priv, power_well);
6014 } 6007 }
6015 6008
@@ -6024,33 +6017,56 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
6024static struct i915_power_domains *hsw_pwr; 6017static struct i915_power_domains *hsw_pwr;
6025 6018
6026/* Display audio driver power well request */ 6019/* Display audio driver power well request */
6027void i915_request_power_well(void) 6020int i915_request_power_well(void)
6028{ 6021{
6029 struct drm_i915_private *dev_priv; 6022 struct drm_i915_private *dev_priv;
6030 6023
6031 if (WARN_ON(!hsw_pwr)) 6024 if (!hsw_pwr)
6032 return; 6025 return -ENODEV;
6033 6026
6034 dev_priv = container_of(hsw_pwr, struct drm_i915_private, 6027 dev_priv = container_of(hsw_pwr, struct drm_i915_private,
6035 power_domains); 6028 power_domains);
6036 intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); 6029 intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
6030 return 0;
6037} 6031}
6038EXPORT_SYMBOL_GPL(i915_request_power_well); 6032EXPORT_SYMBOL_GPL(i915_request_power_well);
6039 6033
6040/* Display audio driver power well release */ 6034/* Display audio driver power well release */
6041void i915_release_power_well(void) 6035int i915_release_power_well(void)
6042{ 6036{
6043 struct drm_i915_private *dev_priv; 6037 struct drm_i915_private *dev_priv;
6044 6038
6045 if (WARN_ON(!hsw_pwr)) 6039 if (!hsw_pwr)
6046 return; 6040 return -ENODEV;
6047 6041
6048 dev_priv = container_of(hsw_pwr, struct drm_i915_private, 6042 dev_priv = container_of(hsw_pwr, struct drm_i915_private,
6049 power_domains); 6043 power_domains);
6050 intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); 6044 intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
6045 return 0;
6051} 6046}
6052EXPORT_SYMBOL_GPL(i915_release_power_well); 6047EXPORT_SYMBOL_GPL(i915_release_power_well);
6053 6048
6049/*
6050 * Private interface for the audio driver to get CDCLK in kHz.
6051 *
6052 * Caller must request power well using i915_request_power_well() prior to
6053 * making the call.
6054 */
6055int i915_get_cdclk_freq(void)
6056{
6057 struct drm_i915_private *dev_priv;
6058
6059 if (!hsw_pwr)
6060 return -ENODEV;
6061
6062 dev_priv = container_of(hsw_pwr, struct drm_i915_private,
6063 power_domains);
6064
6065 return intel_ddi_get_cdclk_freq(dev_priv);
6066}
6067EXPORT_SYMBOL_GPL(i915_get_cdclk_freq);
6068
6069
6054#define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) 6070#define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1)
6055 6071
6056#define HSW_ALWAYS_ON_POWER_DOMAINS ( \ 6072#define HSW_ALWAYS_ON_POWER_DOMAINS ( \
@@ -6270,8 +6286,11 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv)
6270 int i; 6286 int i;
6271 6287
6272 mutex_lock(&power_domains->lock); 6288 mutex_lock(&power_domains->lock);
6273 for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) 6289 for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) {
6274 power_well->ops->sync_hw(dev_priv, power_well); 6290 power_well->ops->sync_hw(dev_priv, power_well);
6291 power_well->hw_enabled = power_well->ops->is_enabled(dev_priv,
6292 power_well);
6293 }
6275 mutex_unlock(&power_domains->lock); 6294 mutex_unlock(&power_domains->lock);
6276} 6295}
6277 6296
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 910c83cf7d44..e72017bdcd7f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -55,7 +55,7 @@ struct intel_ring_hangcheck {
55 u32 seqno; 55 u32 seqno;
56 int score; 56 int score;
57 enum intel_ring_hangcheck_action action; 57 enum intel_ring_hangcheck_action action;
58 bool deadlock; 58 int deadlock;
59}; 59};
60 60
61struct intel_ringbuffer { 61struct intel_ringbuffer {
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 6a4d5bc17697..20375cc7f82d 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1385,7 +1385,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
1385 >> SDVO_PORT_MULTIPLY_SHIFT) + 1; 1385 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
1386 } 1386 }
1387 1387
1388 dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier; 1388 dotclock = pipe_config->port_clock;
1389 if (pipe_config->pixel_multiplier)
1390 dotclock /= pipe_config->pixel_multiplier;
1389 1391
1390 if (HAS_PCH_SPLIT(dev)) 1392 if (HAS_PCH_SPLIT(dev))
1391 ironlake_check_encoder_dotclock(pipe_config, dotclock); 1393 ironlake_check_encoder_dotclock(pipe_config, dotclock);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 1b66ddcdfb33..9a17b4e92ef4 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -691,6 +691,14 @@ intel_post_enable_primary(struct drm_crtc *crtc)
691 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 691 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
692 692
693 /* 693 /*
694 * BDW signals flip done immediately if the plane
695 * is disabled, even if the plane enable is already
696 * armed to occur at the next vblank :(
697 */
698 if (IS_BROADWELL(dev))
699 intel_wait_for_vblank(dev, intel_crtc->pipe);
700
701 /*
694 * FIXME IPS should be fine as long as one plane is 702 * FIXME IPS should be fine as long as one plane is
695 * enabled, but in practice it seems to have problems 703 * enabled, but in practice it seems to have problems
696 * when going from primary only to sprite only and vice 704 * when going from primary only to sprite only and vice
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 79cba593df0d..4f6fef7ac069 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -320,7 +320,8 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
320 struct drm_i915_private *dev_priv = dev->dev_private; 320 struct drm_i915_private *dev_priv = dev->dev_private;
321 unsigned long irqflags; 321 unsigned long irqflags;
322 322
323 del_timer_sync(&dev_priv->uncore.force_wake_timer); 323 if (del_timer_sync(&dev_priv->uncore.force_wake_timer))
324 gen6_force_wake_timer((unsigned long)dev_priv);
324 325
325 /* Hold uncore.lock across reset to prevent any register access 326 /* Hold uncore.lock across reset to prevent any register access
326 * with forcewake not set correctly 327 * with forcewake not set correctly