aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-04-19 21:32:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-19 21:32:57 -0400
commit2f666bcf757cb72549f360ef6da02f03620a48b6 (patch)
tree6981f5c7eda9fbc1cb4328e9756c5d89890ebf11 /drivers
parent6cf544377fd7ecc87561d8ef77f4bea10259f184 (diff)
parent5785e53ffa73f77fb19e378c899027afc07272bc (diff)
Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm/radeon/kms: pll tweaks for r7xx drm/nouveau: fix allocation of notifier object drm/nouveau: fix notifier memory corruption bug drm/nouveau: fix pinning of notifier block drm/nouveau: populate ttm_alloced with false, when it's not drm/nouveau: fix nv30 pcie boards drm/nouveau: split ramin_lock into two locks, one hardirq safe drm/radeon/kms: adjust evergreen display watermark setup drm/radeon/kms: add connectors even if i2c fails drm/radeon/kms: fix bad shift in atom iio table parser
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_notifier.c11
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c10
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sgdma.c5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c10
-rw-r--r--drivers/gpu/drm/nouveau/nv50_vm.c5
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_vm.c5
-rw-r--r--drivers/gpu/drm/radeon/atom.c6
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c89
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c29
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c6
16 files changed, 102 insertions, 92 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c
index ce38e97b9428..568caedd7216 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.c
@@ -83,7 +83,7 @@ nouveau_dma_init(struct nouveau_channel *chan)
83 return ret; 83 return ret;
84 84
85 /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ 85 /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */
86 ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfd0, 0x1000, 86 ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000,
87 &chan->m2mf_ntfy); 87 &chan->m2mf_ntfy);
88 if (ret) 88 if (ret)
89 return ret; 89 return ret;
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 856d56a98d1e..a76514a209b3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -682,6 +682,9 @@ struct drm_nouveau_private {
682 /* For PFIFO and PGRAPH. */ 682 /* For PFIFO and PGRAPH. */
683 spinlock_t context_switch_lock; 683 spinlock_t context_switch_lock;
684 684
685 /* VM/PRAMIN flush, legacy PRAMIN aperture */
686 spinlock_t vm_lock;
687
685 /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ 688 /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */
686 struct nouveau_ramht *ramht; 689 struct nouveau_ramht *ramht;
687 struct nouveau_gpuobj *ramfc; 690 struct nouveau_gpuobj *ramfc;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 889c4454682e..39aee6d4daf8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -181,13 +181,13 @@ nouveau_fbcon_sync(struct fb_info *info)
181 OUT_RING (chan, 0); 181 OUT_RING (chan, 0);
182 } 182 }
183 183
184 nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff); 184 nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3, 0xffffffff);
185 FIRE_RING(chan); 185 FIRE_RING(chan);
186 mutex_unlock(&chan->mutex); 186 mutex_unlock(&chan->mutex);
187 187
188 ret = -EBUSY; 188 ret = -EBUSY;
189 for (i = 0; i < 100000; i++) { 189 for (i = 0; i < 100000; i++) {
190 if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3)) { 190 if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3)) {
191 ret = 0; 191 ret = 0;
192 break; 192 break;
193 } 193 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 78f467fe30be..5045f8b921d6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -398,7 +398,7 @@ nouveau_mem_vram_init(struct drm_device *dev)
398 dma_bits = 40; 398 dma_bits = 40;
399 } else 399 } else
400 if (drm_pci_device_is_pcie(dev) && 400 if (drm_pci_device_is_pcie(dev) &&
401 dev_priv->chipset != 0x40 && 401 dev_priv->chipset > 0x40 &&
402 dev_priv->chipset != 0x45) { 402 dev_priv->chipset != 0x45) {
403 if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) 403 if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39)))
404 dma_bits = 39; 404 dma_bits = 39;
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c
index 7ba3fc0b30c1..5b39718ae1f8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_notifier.c
+++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c
@@ -35,19 +35,22 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan)
35{ 35{
36 struct drm_device *dev = chan->dev; 36 struct drm_device *dev = chan->dev;
37 struct nouveau_bo *ntfy = NULL; 37 struct nouveau_bo *ntfy = NULL;
38 uint32_t flags; 38 uint32_t flags, ttmpl;
39 int ret; 39 int ret;
40 40
41 if (nouveau_vram_notify) 41 if (nouveau_vram_notify) {
42 flags = NOUVEAU_GEM_DOMAIN_VRAM; 42 flags = NOUVEAU_GEM_DOMAIN_VRAM;
43 else 43 ttmpl = TTM_PL_FLAG_VRAM;
44 } else {
44 flags = NOUVEAU_GEM_DOMAIN_GART; 45 flags = NOUVEAU_GEM_DOMAIN_GART;
46 ttmpl = TTM_PL_FLAG_TT;
47 }
45 48
46 ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); 49 ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy);
47 if (ret) 50 if (ret)
48 return ret; 51 return ret;
49 52
50 ret = nouveau_bo_pin(ntfy, flags); 53 ret = nouveau_bo_pin(ntfy, ttmpl);
51 if (ret) 54 if (ret)
52 goto out_err; 55 goto out_err;
53 56
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index 4f00c87ed86e..67a16e01ffa6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -1039,19 +1039,20 @@ nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset)
1039{ 1039{
1040 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; 1040 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private;
1041 struct drm_device *dev = gpuobj->dev; 1041 struct drm_device *dev = gpuobj->dev;
1042 unsigned long flags;
1042 1043
1043 if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { 1044 if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) {
1044 u64 ptr = gpuobj->vinst + offset; 1045 u64 ptr = gpuobj->vinst + offset;
1045 u32 base = ptr >> 16; 1046 u32 base = ptr >> 16;
1046 u32 val; 1047 u32 val;
1047 1048
1048 spin_lock(&dev_priv->ramin_lock); 1049 spin_lock_irqsave(&dev_priv->vm_lock, flags);
1049 if (dev_priv->ramin_base != base) { 1050 if (dev_priv->ramin_base != base) {
1050 dev_priv->ramin_base = base; 1051 dev_priv->ramin_base = base;
1051 nv_wr32(dev, 0x001700, dev_priv->ramin_base); 1052 nv_wr32(dev, 0x001700, dev_priv->ramin_base);
1052 } 1053 }
1053 val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); 1054 val = nv_rd32(dev, 0x700000 + (ptr & 0xffff));
1054 spin_unlock(&dev_priv->ramin_lock); 1055 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
1055 return val; 1056 return val;
1056 } 1057 }
1057 1058
@@ -1063,18 +1064,19 @@ nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val)
1063{ 1064{
1064 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; 1065 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private;
1065 struct drm_device *dev = gpuobj->dev; 1066 struct drm_device *dev = gpuobj->dev;
1067 unsigned long flags;
1066 1068
1067 if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { 1069 if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) {
1068 u64 ptr = gpuobj->vinst + offset; 1070 u64 ptr = gpuobj->vinst + offset;
1069 u32 base = ptr >> 16; 1071 u32 base = ptr >> 16;
1070 1072
1071 spin_lock(&dev_priv->ramin_lock); 1073 spin_lock_irqsave(&dev_priv->vm_lock, flags);
1072 if (dev_priv->ramin_base != base) { 1074 if (dev_priv->ramin_base != base) {
1073 dev_priv->ramin_base = base; 1075 dev_priv->ramin_base = base;
1074 nv_wr32(dev, 0x001700, dev_priv->ramin_base); 1076 nv_wr32(dev, 0x001700, dev_priv->ramin_base);
1075 } 1077 }
1076 nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); 1078 nv_wr32(dev, 0x700000 + (ptr & 0xffff), val);
1077 spin_unlock(&dev_priv->ramin_lock); 1079 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
1078 return; 1080 return;
1079 } 1081 }
1080 1082
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index a33fe4019286..4bce801bc588 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -55,6 +55,7 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
55 be->func->clear(be); 55 be->func->clear(be);
56 return -EFAULT; 56 return -EFAULT;
57 } 57 }
58 nvbe->ttm_alloced[nvbe->nr_pages] = false;
58 } 59 }
59 60
60 nvbe->nr_pages++; 61 nvbe->nr_pages++;
@@ -427,7 +428,7 @@ nouveau_sgdma_init(struct drm_device *dev)
427 u32 aper_size, align; 428 u32 aper_size, align;
428 int ret; 429 int ret;
429 430
430 if (dev_priv->card_type >= NV_50 || drm_pci_device_is_pcie(dev)) 431 if (dev_priv->card_type >= NV_40 && drm_pci_device_is_pcie(dev))
431 aper_size = 512 * 1024 * 1024; 432 aper_size = 512 * 1024 * 1024;
432 else 433 else
433 aper_size = 64 * 1024 * 1024; 434 aper_size = 64 * 1024 * 1024;
@@ -457,7 +458,7 @@ nouveau_sgdma_init(struct drm_device *dev)
457 dev_priv->gart_info.func = &nv50_sgdma_backend; 458 dev_priv->gart_info.func = &nv50_sgdma_backend;
458 } else 459 } else
459 if (drm_pci_device_is_pcie(dev) && 460 if (drm_pci_device_is_pcie(dev) &&
460 dev_priv->chipset != 0x40 && dev_priv->chipset != 0x45) { 461 dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) {
461 if (nv44_graph_class(dev)) { 462 if (nv44_graph_class(dev)) {
462 dev_priv->gart_info.func = &nv44_sgdma_backend; 463 dev_priv->gart_info.func = &nv44_sgdma_backend;
463 align = 512 * 1024; 464 align = 512 * 1024;
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 6e2b1a6caa2d..a30adec5beaa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -608,6 +608,7 @@ nouveau_card_init(struct drm_device *dev)
608 spin_lock_init(&dev_priv->channels.lock); 608 spin_lock_init(&dev_priv->channels.lock);
609 spin_lock_init(&dev_priv->tile.lock); 609 spin_lock_init(&dev_priv->tile.lock);
610 spin_lock_init(&dev_priv->context_switch_lock); 610 spin_lock_init(&dev_priv->context_switch_lock);
611 spin_lock_init(&dev_priv->vm_lock);
611 612
612 /* Make the CRTCs and I2C buses accessible */ 613 /* Make the CRTCs and I2C buses accessible */
613 ret = engine->display.early_init(dev); 614 ret = engine->display.early_init(dev);
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index a6f8aa651fc6..4f95a1e5822e 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -404,23 +404,25 @@ void
404nv50_instmem_flush(struct drm_device *dev) 404nv50_instmem_flush(struct drm_device *dev)
405{ 405{
406 struct drm_nouveau_private *dev_priv = dev->dev_private; 406 struct drm_nouveau_private *dev_priv = dev->dev_private;
407 unsigned long flags;
407 408
408 spin_lock(&dev_priv->ramin_lock); 409 spin_lock_irqsave(&dev_priv->vm_lock, flags);
409 nv_wr32(dev, 0x00330c, 0x00000001); 410 nv_wr32(dev, 0x00330c, 0x00000001);
410 if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) 411 if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000))
411 NV_ERROR(dev, "PRAMIN flush timeout\n"); 412 NV_ERROR(dev, "PRAMIN flush timeout\n");
412 spin_unlock(&dev_priv->ramin_lock); 413 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
413} 414}
414 415
415void 416void
416nv84_instmem_flush(struct drm_device *dev) 417nv84_instmem_flush(struct drm_device *dev)
417{ 418{
418 struct drm_nouveau_private *dev_priv = dev->dev_private; 419 struct drm_nouveau_private *dev_priv = dev->dev_private;
420 unsigned long flags;
419 421
420 spin_lock(&dev_priv->ramin_lock); 422 spin_lock_irqsave(&dev_priv->vm_lock, flags);
421 nv_wr32(dev, 0x070000, 0x00000001); 423 nv_wr32(dev, 0x070000, 0x00000001);
422 if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) 424 if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000))
423 NV_ERROR(dev, "PRAMIN flush timeout\n"); 425 NV_ERROR(dev, "PRAMIN flush timeout\n");
424 spin_unlock(&dev_priv->ramin_lock); 426 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
425} 427}
426 428
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c
index 4fd3432b5b8d..6c2694490741 100644
--- a/drivers/gpu/drm/nouveau/nv50_vm.c
+++ b/drivers/gpu/drm/nouveau/nv50_vm.c
@@ -174,10 +174,11 @@ void
174nv50_vm_flush_engine(struct drm_device *dev, int engine) 174nv50_vm_flush_engine(struct drm_device *dev, int engine)
175{ 175{
176 struct drm_nouveau_private *dev_priv = dev->dev_private; 176 struct drm_nouveau_private *dev_priv = dev->dev_private;
177 unsigned long flags;
177 178
178 spin_lock(&dev_priv->ramin_lock); 179 spin_lock_irqsave(&dev_priv->vm_lock, flags);
179 nv_wr32(dev, 0x100c80, (engine << 16) | 1); 180 nv_wr32(dev, 0x100c80, (engine << 16) | 1);
180 if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) 181 if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000))
181 NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); 182 NV_ERROR(dev, "vm flush timeout: engine %d\n", engine);
182 spin_unlock(&dev_priv->ramin_lock); 183 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
183} 184}
diff --git a/drivers/gpu/drm/nouveau/nvc0_vm.c b/drivers/gpu/drm/nouveau/nvc0_vm.c
index a0a2a0277f73..a179e6c55afb 100644
--- a/drivers/gpu/drm/nouveau/nvc0_vm.c
+++ b/drivers/gpu/drm/nouveau/nvc0_vm.c
@@ -104,11 +104,12 @@ nvc0_vm_flush(struct nouveau_vm *vm)
104 struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; 104 struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem;
105 struct drm_device *dev = vm->dev; 105 struct drm_device *dev = vm->dev;
106 struct nouveau_vm_pgd *vpgd; 106 struct nouveau_vm_pgd *vpgd;
107 unsigned long flags;
107 u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5; 108 u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5;
108 109
109 pinstmem->flush(vm->dev); 110 pinstmem->flush(vm->dev);
110 111
111 spin_lock(&dev_priv->ramin_lock); 112 spin_lock_irqsave(&dev_priv->vm_lock, flags);
112 list_for_each_entry(vpgd, &vm->pgd_list, head) { 113 list_for_each_entry(vpgd, &vm->pgd_list, head) {
113 /* looks like maybe a "free flush slots" counter, the 114 /* looks like maybe a "free flush slots" counter, the
114 * faster you write to 0x100cbc to more it decreases 115 * faster you write to 0x100cbc to more it decreases
@@ -125,5 +126,5 @@ nvc0_vm_flush(struct nouveau_vm *vm)
125 nv_rd32(dev, 0x100c80), engine); 126 nv_rd32(dev, 0x100c80), engine);
126 } 127 }
127 } 128 }
128 spin_unlock(&dev_priv->ramin_lock); 129 spin_unlock_irqrestore(&dev_priv->vm_lock, flags);
129} 130}
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index d71d375149f8..7bd745689097 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -135,7 +135,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
135 case ATOM_IIO_MOVE_INDEX: 135 case ATOM_IIO_MOVE_INDEX:
136 temp &= 136 temp &=
137 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 137 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
138 CU8(base + 2)); 138 CU8(base + 3));
139 temp |= 139 temp |=
140 ((index >> CU8(base + 2)) & 140 ((index >> CU8(base + 2)) &
141 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 141 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
@@ -145,7 +145,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
145 case ATOM_IIO_MOVE_DATA: 145 case ATOM_IIO_MOVE_DATA:
146 temp &= 146 temp &=
147 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 147 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
148 CU8(base + 2)); 148 CU8(base + 3));
149 temp |= 149 temp |=
150 ((data >> CU8(base + 2)) & 150 ((data >> CU8(base + 2)) &
151 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 151 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
@@ -155,7 +155,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
155 case ATOM_IIO_MOVE_ATTR: 155 case ATOM_IIO_MOVE_ATTR:
156 temp &= 156 temp &=
157 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 157 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
158 CU8(base + 2)); 158 CU8(base + 3));
159 temp |= 159 temp |=
160 ((ctx-> 160 ((ctx->
161 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - 161 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 -
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 9d516a8c4dfa..529a3a704731 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -532,10 +532,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
532 else 532 else
533 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; 533 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
534 534
535 if ((rdev->family == CHIP_R600) || 535 if (rdev->family < CHIP_RV770)
536 (rdev->family == CHIP_RV610) ||
537 (rdev->family == CHIP_RV630) ||
538 (rdev->family == CHIP_RV670))
539 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; 536 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
540 } else { 537 } else {
541 pll->flags |= RADEON_PLL_LEGACY; 538 pll->flags |= RADEON_PLL_LEGACY;
@@ -565,7 +562,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
565 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 562 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
566 if (ss_enabled) { 563 if (ss_enabled) {
567 if (ss->refdiv) { 564 if (ss->refdiv) {
568 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
569 pll->flags |= RADEON_PLL_USE_REF_DIV; 565 pll->flags |= RADEON_PLL_USE_REF_DIV;
570 pll->reference_div = ss->refdiv; 566 pll->reference_div = ss->refdiv;
571 if (ASIC_IS_AVIVO(rdev)) 567 if (ASIC_IS_AVIVO(rdev))
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 3453910ee0f3..43fd01674489 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -353,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
353 struct drm_display_mode *mode, 353 struct drm_display_mode *mode,
354 struct drm_display_mode *other_mode) 354 struct drm_display_mode *other_mode)
355{ 355{
356 u32 tmp = 0; 356 u32 tmp;
357 /* 357 /*
358 * Line Buffer Setup 358 * Line Buffer Setup
359 * There are 3 line buffers, each one shared by 2 display controllers. 359 * There are 3 line buffers, each one shared by 2 display controllers.
@@ -363,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
363 * first display controller 363 * first display controller
364 * 0 - first half of lb (3840 * 2) 364 * 0 - first half of lb (3840 * 2)
365 * 1 - first 3/4 of lb (5760 * 2) 365 * 1 - first 3/4 of lb (5760 * 2)
366 * 2 - whole lb (7680 * 2) 366 * 2 - whole lb (7680 * 2), other crtc must be disabled
367 * 3 - first 1/4 of lb (1920 * 2) 367 * 3 - first 1/4 of lb (1920 * 2)
368 * second display controller 368 * second display controller
369 * 4 - second half of lb (3840 * 2) 369 * 4 - second half of lb (3840 * 2)
370 * 5 - second 3/4 of lb (5760 * 2) 370 * 5 - second 3/4 of lb (5760 * 2)
371 * 6 - whole lb (7680 * 2) 371 * 6 - whole lb (7680 * 2), other crtc must be disabled
372 * 7 - last 1/4 of lb (1920 * 2) 372 * 7 - last 1/4 of lb (1920 * 2)
373 */ 373 */
374 if (mode && other_mode) { 374 /* this can get tricky if we have two large displays on a paired group
375 if (mode->hdisplay > other_mode->hdisplay) { 375 * of crtcs. Ideally for multiple large displays we'd assign them to
376 if (mode->hdisplay > 2560) 376 * non-linked crtcs for maximum line buffer allocation.
377 tmp = 1; /* 3/4 */ 377 */
378 else 378 if (radeon_crtc->base.enabled && mode) {
379 tmp = 0; /* 1/2 */ 379 if (other_mode)
380 } else if (other_mode->hdisplay > mode->hdisplay) {
381 if (other_mode->hdisplay > 2560)
382 tmp = 3; /* 1/4 */
383 else
384 tmp = 0; /* 1/2 */
385 } else
386 tmp = 0; /* 1/2 */ 380 tmp = 0; /* 1/2 */
387 } else if (mode) 381 else
388 tmp = 2; /* whole */ 382 tmp = 2; /* whole */
389 else if (other_mode) 383 } else
390 tmp = 3; /* 1/4 */ 384 tmp = 0;
391 385
392 /* second controller of the pair uses second half of the lb */ 386 /* second controller of the pair uses second half of the lb */
393 if (radeon_crtc->crtc_id % 2) 387 if (radeon_crtc->crtc_id % 2)
394 tmp += 4; 388 tmp += 4;
395 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); 389 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp);
396 390
397 switch (tmp) { 391 if (radeon_crtc->base.enabled && mode) {
398 case 0: 392 switch (tmp) {
399 case 4: 393 case 0:
400 default: 394 case 4:
401 if (ASIC_IS_DCE5(rdev)) 395 default:
402 return 4096 * 2; 396 if (ASIC_IS_DCE5(rdev))
403 else 397 return 4096 * 2;
404 return 3840 * 2; 398 else
405 case 1: 399 return 3840 * 2;
406 case 5: 400 case 1:
407 if (ASIC_IS_DCE5(rdev)) 401 case 5:
408 return 6144 * 2; 402 if (ASIC_IS_DCE5(rdev))
409 else 403 return 6144 * 2;
410 return 5760 * 2; 404 else
411 case 2: 405 return 5760 * 2;
412 case 6: 406 case 2:
413 if (ASIC_IS_DCE5(rdev)) 407 case 6:
414 return 8192 * 2; 408 if (ASIC_IS_DCE5(rdev))
415 else 409 return 8192 * 2;
416 return 7680 * 2; 410 else
417 case 3: 411 return 7680 * 2;
418 case 7: 412 case 3:
419 if (ASIC_IS_DCE5(rdev)) 413 case 7:
420 return 2048 * 2; 414 if (ASIC_IS_DCE5(rdev))
421 else 415 return 2048 * 2;
422 return 1920 * 2; 416 else
417 return 1920 * 2;
418 }
423 } 419 }
420
421 /* controller not enabled, so no lb used */
422 return 0;
424} 423}
425 424
426static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) 425static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2ef6d5135064..5f45fa12bb8b 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1199,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1199 if (router->ddc_valid || router->cd_valid) { 1199 if (router->ddc_valid || router->cd_valid) {
1200 radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); 1200 radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info);
1201 if (!radeon_connector->router_bus) 1201 if (!radeon_connector->router_bus)
1202 goto failed; 1202 DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
1203 } 1203 }
1204 switch (connector_type) { 1204 switch (connector_type) {
1205 case DRM_MODE_CONNECTOR_VGA: 1205 case DRM_MODE_CONNECTOR_VGA:
@@ -1208,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1208 if (i2c_bus->valid) { 1208 if (i2c_bus->valid) {
1209 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1209 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1210 if (!radeon_connector->ddc_bus) 1210 if (!radeon_connector->ddc_bus)
1211 goto failed; 1211 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1212 } 1212 }
1213 radeon_connector->dac_load_detect = true; 1213 radeon_connector->dac_load_detect = true;
1214 drm_connector_attach_property(&radeon_connector->base, 1214 drm_connector_attach_property(&radeon_connector->base,
@@ -1226,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1226 if (i2c_bus->valid) { 1226 if (i2c_bus->valid) {
1227 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1227 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1228 if (!radeon_connector->ddc_bus) 1228 if (!radeon_connector->ddc_bus)
1229 goto failed; 1229 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1230 } 1230 }
1231 radeon_connector->dac_load_detect = true; 1231 radeon_connector->dac_load_detect = true;
1232 drm_connector_attach_property(&radeon_connector->base, 1232 drm_connector_attach_property(&radeon_connector->base,
@@ -1249,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1249 if (i2c_bus->valid) { 1249 if (i2c_bus->valid) {
1250 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1250 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1251 if (!radeon_connector->ddc_bus) 1251 if (!radeon_connector->ddc_bus)
1252 goto failed; 1252 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1253 } 1253 }
1254 subpixel_order = SubPixelHorizontalRGB; 1254 subpixel_order = SubPixelHorizontalRGB;
1255 drm_connector_attach_property(&radeon_connector->base, 1255 drm_connector_attach_property(&radeon_connector->base,
@@ -1290,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1290 if (i2c_bus->valid) { 1290 if (i2c_bus->valid) {
1291 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1291 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1292 if (!radeon_connector->ddc_bus) 1292 if (!radeon_connector->ddc_bus)
1293 goto failed; 1293 DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1294 } 1294 }
1295 drm_connector_attach_property(&radeon_connector->base, 1295 drm_connector_attach_property(&radeon_connector->base,
1296 rdev->mode_info.coherent_mode_property, 1296 rdev->mode_info.coherent_mode_property,
@@ -1329,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev,
1329 else 1329 else
1330 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1330 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch");
1331 if (!radeon_dig_connector->dp_i2c_bus) 1331 if (!radeon_dig_connector->dp_i2c_bus)
1332 goto failed; 1332 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
1333 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1333 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1334 if (!radeon_connector->ddc_bus) 1334 if (!radeon_connector->ddc_bus)
1335 goto failed; 1335 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1336 } 1336 }
1337 subpixel_order = SubPixelHorizontalRGB; 1337 subpixel_order = SubPixelHorizontalRGB;
1338 drm_connector_attach_property(&radeon_connector->base, 1338 drm_connector_attach_property(&radeon_connector->base,
@@ -1381,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1381 if (i2c_bus->valid) { 1381 if (i2c_bus->valid) {
1382 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1382 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1383 if (!radeon_connector->ddc_bus) 1383 if (!radeon_connector->ddc_bus)
1384 goto failed; 1384 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1385 } 1385 }
1386 drm_connector_attach_property(&radeon_connector->base, 1386 drm_connector_attach_property(&radeon_connector->base,
1387 dev->mode_config.scaling_mode_property, 1387 dev->mode_config.scaling_mode_property,
@@ -1457,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1457 if (i2c_bus->valid) { 1457 if (i2c_bus->valid) {
1458 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1458 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1459 if (!radeon_connector->ddc_bus) 1459 if (!radeon_connector->ddc_bus)
1460 goto failed; 1460 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1461 } 1461 }
1462 radeon_connector->dac_load_detect = true; 1462 radeon_connector->dac_load_detect = true;
1463 drm_connector_attach_property(&radeon_connector->base, 1463 drm_connector_attach_property(&radeon_connector->base,
@@ -1475,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1475 if (i2c_bus->valid) { 1475 if (i2c_bus->valid) {
1476 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1476 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1477 if (!radeon_connector->ddc_bus) 1477 if (!radeon_connector->ddc_bus)
1478 goto failed; 1478 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1479 } 1479 }
1480 radeon_connector->dac_load_detect = true; 1480 radeon_connector->dac_load_detect = true;
1481 drm_connector_attach_property(&radeon_connector->base, 1481 drm_connector_attach_property(&radeon_connector->base,
@@ -1493,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1493 if (i2c_bus->valid) { 1493 if (i2c_bus->valid) {
1494 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1494 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1495 if (!radeon_connector->ddc_bus) 1495 if (!radeon_connector->ddc_bus)
1496 goto failed; 1496 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1497 } 1497 }
1498 if (connector_type == DRM_MODE_CONNECTOR_DVII) { 1498 if (connector_type == DRM_MODE_CONNECTOR_DVII) {
1499 radeon_connector->dac_load_detect = true; 1499 radeon_connector->dac_load_detect = true;
@@ -1538,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1538 if (i2c_bus->valid) { 1538 if (i2c_bus->valid) {
1539 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1539 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1540 if (!radeon_connector->ddc_bus) 1540 if (!radeon_connector->ddc_bus)
1541 goto failed; 1541 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1542 } 1542 }
1543 drm_connector_attach_property(&radeon_connector->base, 1543 drm_connector_attach_property(&radeon_connector->base,
1544 dev->mode_config.scaling_mode_property, 1544 dev->mode_config.scaling_mode_property,
@@ -1567,9 +1567,4 @@ radeon_add_legacy_connector(struct drm_device *dev,
1567 radeon_legacy_backlight_init(radeon_encoder, connector); 1567 radeon_legacy_backlight_init(radeon_encoder, connector);
1568 } 1568 }
1569 } 1569 }
1570 return;
1571
1572failed:
1573 drm_connector_cleanup(connector);
1574 kfree(connector);
1575} 1570}
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index ccbabf734a61..983cbac75af0 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector)
1096 if (!radeon_connector->router.ddc_valid) 1096 if (!radeon_connector->router.ddc_valid)
1097 return; 1097 return;
1098 1098
1099 if (!radeon_connector->router_bus)
1100 return;
1101
1099 radeon_i2c_get_byte(radeon_connector->router_bus, 1102 radeon_i2c_get_byte(radeon_connector->router_bus,
1100 radeon_connector->router.i2c_addr, 1103 radeon_connector->router.i2c_addr,
1101 0x3, &val); 1104 0x3, &val);
@@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector)
1121 if (!radeon_connector->router.cd_valid) 1124 if (!radeon_connector->router.cd_valid)
1122 return; 1125 return;
1123 1126
1127 if (!radeon_connector->router_bus)
1128 return;
1129
1124 radeon_i2c_get_byte(radeon_connector->router_bus, 1130 radeon_i2c_get_byte(radeon_connector->router_bus,
1125 radeon_connector->router.i2c_addr, 1131 radeon_connector->router.i2c_addr,
1126 0x3, &val); 1132 0x3, &val);