aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2014-04-11 13:24:45 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2014-04-11 13:24:45 -0400
commit438145c7ef5c9445f25bb8fc4d52e2c9d11fdc7c (patch)
tree76941991e36f4a32bf1be0db3854959053f24619 /drivers/gpu
parent9ddd1b8ad8abd321964b8add5581910de6d67c2a (diff)
Update from 2.6.36 to 2.6.36.4wip-dissipation-jerickso
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/Kconfig3
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c5
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c36
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c10
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c21
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h17
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c4
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c11
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c60
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c8
-rw-r--r--drivers/gpu/drm/i915/intel_overlay.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_irq.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c35
-rw-r--r--drivers/gpu/drm/radeon/atom.c1
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c3
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c4
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c25
-rw-r--r--drivers/gpu/drm/radeon/r100.c6
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h1
-rw-r--r--drivers/gpu/drm/radeon/r200.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c32
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c8
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c53
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c34
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c36
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c9
-rw-r--r--drivers/gpu/vga/vgaarb.c2
41 files changed, 395 insertions, 120 deletions
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 4cab0c6397e3..aa17594a674a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -97,7 +97,10 @@ config DRM_I830
97config DRM_I915 97config DRM_I915
98 tristate "i915 driver" 98 tristate "i915 driver"
99 depends on AGP_INTEL 99 depends on AGP_INTEL
100 # we need shmfs for the swappable backing store, and in particular
101 # the shmem_readpage() which depends upon tmpfs
100 select SHMEM 102 select SHMEM
103 select TMPFS
101 select DRM_KMS_HELPER 104 select DRM_KMS_HELPER
102 select FB_CFB_FILLRECT 105 select FB_CFB_FILLRECT
103 select FB_CFB_COPYAREA 106 select FB_CFB_COPYAREA
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 37e0b4fa482a..dfc635884619 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -156,12 +156,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] =
156 { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, 156 { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 },
157 { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, 157 { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 },
158 { DRM_MODE_CONNECTOR_Component, "Component", 0 }, 158 { DRM_MODE_CONNECTOR_Component, "Component", 0 },
159 { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, 159 { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 },
160 { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, 160 { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },
161 { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, 161 { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 },
162 { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, 162 { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 },
163 { DRM_MODE_CONNECTOR_TV, "TV", 0 }, 163 { DRM_MODE_CONNECTOR_TV, "TV", 0 },
164 { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, 164 { DRM_MODE_CONNECTOR_eDP, "eDP", 0 },
165}; 165};
166 166
167static struct drm_prop_enum_list drm_encoder_enum_list[] = 167static struct drm_prop_enum_list drm_encoder_enum_list[] =
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index dcbeb98f195a..ae9fb7a3afd6 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -649,6 +649,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
649 old_fb)) { 649 old_fb)) {
650 DRM_ERROR("failed to set mode on [CRTC:%d]\n", 650 DRM_ERROR("failed to set mode on [CRTC:%d]\n",
651 set->crtc->base.id); 651 set->crtc->base.id);
652 set->crtc->fb = old_fb;
652 ret = -EINVAL; 653 ret = -EINVAL;
653 goto fail; 654 goto fail;
654 } 655 }
@@ -663,8 +664,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
663 set->crtc->fb = set->fb; 664 set->crtc->fb = set->fb;
664 ret = crtc_funcs->mode_set_base(set->crtc, 665 ret = crtc_funcs->mode_set_base(set->crtc,
665 set->x, set->y, old_fb); 666 set->x, set->y, old_fb);
666 if (ret != 0) 667 if (ret != 0) {
668 set->crtc->fb = old_fb;
667 goto fail; 669 goto fail;
670 }
668 } 671 }
669 672
670 kfree(save_connectors); 673 kfree(save_connectors);
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 2dd2c93ebfa3..e6fc48ea55a9 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -34,6 +34,7 @@
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_trace.h" 36#include "i915_trace.h"
37#include "../../../platform/x86/intel_ips.h"
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/vgaarb.h> 39#include <linux/vgaarb.h>
39#include <linux/acpi.h> 40#include <linux/acpi.h>
@@ -1418,9 +1419,15 @@ static int i915_load_modeset_init(struct drm_device *dev,
1418 if (ret) 1419 if (ret)
1419 DRM_INFO("failed to find VBIOS tables\n"); 1420 DRM_INFO("failed to find VBIOS tables\n");
1420 1421
1421 /* if we have > 1 VGA cards, then disable the radeon VGA resources */ 1422 /* If we have > 1 VGA cards, then we need to arbitrate access
1423 * to the common VGA resources.
1424 *
1425 * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA),
1426 * then we do not take part in VGA arbitration and the
1427 * vga_client_register() fails with -ENODEV.
1428 */
1422 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); 1429 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
1423 if (ret) 1430 if (ret && ret != -ENODEV)
1424 goto cleanup_ringbuffer; 1431 goto cleanup_ringbuffer;
1425 1432
1426 ret = vga_switcheroo_register_client(dev->pdev, 1433 ret = vga_switcheroo_register_client(dev->pdev,
@@ -2047,6 +2054,26 @@ out_unlock:
2047EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); 2054EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
2048 2055
2049/** 2056/**
2057 * Tells the intel_ips driver that the i915 driver is now loaded, if
2058 * IPS got loaded first.
2059 *
2060 * This awkward dance is so that neither module has to depend on the
2061 * other in order for IPS to do the appropriate communication of
2062 * GPU turbo limits to i915.
2063 */
2064static void
2065ips_ping_for_i915_load(void)
2066{
2067 void (*link)(void);
2068
2069 link = symbol_get(ips_link_to_i915_driver);
2070 if (link) {
2071 link();
2072 symbol_put(ips_link_to_i915_driver);
2073 }
2074}
2075
2076/**
2050 * i915_driver_load - setup chip and create an initial config 2077 * i915_driver_load - setup chip and create an initial config
2051 * @dev: DRM device 2078 * @dev: DRM device
2052 * @flags: startup flags 2079 * @flags: startup flags
@@ -2234,6 +2261,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2234 /* XXX Prevent module unload due to memory corruption bugs. */ 2261 /* XXX Prevent module unload due to memory corruption bugs. */
2235 __module_get(THIS_MODULE); 2262 __module_get(THIS_MODULE);
2236 2263
2264 ips_ping_for_i915_load();
2265
2237 return 0; 2266 return 0;
2238 2267
2239out_workqueue_free: 2268out_workqueue_free:
@@ -2306,6 +2335,9 @@ int i915_driver_unload(struct drm_device *dev)
2306 i915_gem_lastclose(dev); 2335 i915_gem_lastclose(dev);
2307 2336
2308 intel_cleanup_overlay(dev); 2337 intel_cleanup_overlay(dev);
2338
2339 if (!I915_NEED_GFX_HWS(dev))
2340 i915_free_hws(dev);
2309 } 2341 }
2310 2342
2311 intel_teardown_mchbar(dev); 2343 intel_teardown_mchbar(dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 6dbe14cc4f74..7792c8f7c6dd 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -53,7 +53,7 @@ extern int intel_agp_enabled;
53 53
54#define INTEL_VGA_DEVICE(id, info) { \ 54#define INTEL_VGA_DEVICE(id, info) { \
55 .class = PCI_CLASS_DISPLAY_VGA << 8, \ 55 .class = PCI_CLASS_DISPLAY_VGA << 8, \
56 .class_mask = 0xffff00, \ 56 .class_mask = 0xff0000, \
57 .vendor = 0x8086, \ 57 .vendor = 0x8086, \
58 .device = id, \ 58 .device = id, \
59 .subvendor = PCI_ANY_ID, \ 59 .subvendor = PCI_ANY_ID, \
@@ -414,6 +414,14 @@ int i965_reset(struct drm_device *dev, u8 flags)
414static int __devinit 414static int __devinit
415i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 415i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
416{ 416{
417 /* Only bind to function 0 of the device. Early generations
418 * used function 1 as a placeholder for multi-head. This causes
419 * us confusion instead, especially on the systems where both
420 * functions have the same PCI-ID!
421 */
422 if (PCI_FUNC(pdev->devfn))
423 return -ENODEV;
424
417 return drm_get_pci_dev(pdev, ent, &driver); 425 return drm_get_pci_dev(pdev, ent, &driver);
418} 426}
419 427
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 744225ebb4b2..477e4ac66639 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -310,6 +310,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
310 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 310 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
311 int ret = IRQ_NONE; 311 int ret = IRQ_NONE;
312 u32 de_iir, gt_iir, de_ier, pch_iir; 312 u32 de_iir, gt_iir, de_ier, pch_iir;
313 u32 hotplug_mask;
313 struct drm_i915_master_private *master_priv; 314 struct drm_i915_master_private *master_priv;
314 struct intel_ring_buffer *render_ring = &dev_priv->render_ring; 315 struct intel_ring_buffer *render_ring = &dev_priv->render_ring;
315 316
@@ -325,6 +326,11 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
325 if (de_iir == 0 && gt_iir == 0 && pch_iir == 0) 326 if (de_iir == 0 && gt_iir == 0 && pch_iir == 0)
326 goto done; 327 goto done;
327 328
329 if (HAS_PCH_CPT(dev))
330 hotplug_mask = SDE_HOTPLUG_MASK_CPT;
331 else
332 hotplug_mask = SDE_HOTPLUG_MASK;
333
328 ret = IRQ_HANDLED; 334 ret = IRQ_HANDLED;
329 335
330 if (dev->primary->master) { 336 if (dev->primary->master) {
@@ -366,10 +372,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev)
366 drm_handle_vblank(dev, 1); 372 drm_handle_vblank(dev, 1);
367 373
368 /* check event from PCH */ 374 /* check event from PCH */
369 if ((de_iir & DE_PCH_EVENT) && 375 if ((de_iir & DE_PCH_EVENT) && (pch_iir & hotplug_mask))
370 (pch_iir & SDE_HOTPLUG_MASK)) {
371 queue_work(dev_priv->wq, &dev_priv->hotplug_work); 376 queue_work(dev_priv->wq, &dev_priv->hotplug_work);
372 }
373 377
374 if (de_iir & DE_PCU_EVENT) { 378 if (de_iir & DE_PCU_EVENT) {
375 I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); 379 I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS));
@@ -1424,8 +1428,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1424 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | 1428 u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
1425 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; 1429 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE;
1426 u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT; 1430 u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT;
1427 u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | 1431 u32 hotplug_mask;
1428 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1429 1432
1430 dev_priv->irq_mask_reg = ~display_mask; 1433 dev_priv->irq_mask_reg = ~display_mask;
1431 dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK; 1434 dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK;
@@ -1450,6 +1453,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1450 I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg); 1453 I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg);
1451 (void) I915_READ(GTIER); 1454 (void) I915_READ(GTIER);
1452 1455
1456 if (HAS_PCH_CPT(dev)) {
1457 hotplug_mask = SDE_CRT_HOTPLUG_CPT | SDE_PORTB_HOTPLUG_CPT |
1458 SDE_PORTC_HOTPLUG_CPT | SDE_PORTD_HOTPLUG_CPT ;
1459 } else {
1460 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
1461 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1462 }
1463
1453 dev_priv->pch_irq_mask_reg = ~hotplug_mask; 1464 dev_priv->pch_irq_mask_reg = ~hotplug_mask;
1454 dev_priv->pch_irq_enable_reg = hotplug_mask; 1465 dev_priv->pch_irq_enable_reg = hotplug_mask;
1455 1466
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 4f5e15577e89..7103d24c8213 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2551,6 +2551,10 @@
2551#define SDE_PORTD_HOTPLUG_CPT (1 << 23) 2551#define SDE_PORTD_HOTPLUG_CPT (1 << 23)
2552#define SDE_PORTC_HOTPLUG_CPT (1 << 22) 2552#define SDE_PORTC_HOTPLUG_CPT (1 << 22)
2553#define SDE_PORTB_HOTPLUG_CPT (1 << 21) 2553#define SDE_PORTB_HOTPLUG_CPT (1 << 21)
2554#define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \
2555 SDE_PORTD_HOTPLUG_CPT | \
2556 SDE_PORTC_HOTPLUG_CPT | \
2557 SDE_PORTB_HOTPLUG_CPT)
2554 2558
2555#define SDEISR 0xc4000 2559#define SDEISR 0xc4000
2556#define SDEIMR 0xc4004 2560#define SDEIMR 0xc4004
@@ -2722,6 +2726,9 @@
2722#define FDI_RXB_CHICKEN 0xc2010 2726#define FDI_RXB_CHICKEN 0xc2010
2723#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) 2727#define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1)
2724 2728
2729#define SOUTH_DSPCLK_GATE_D 0xc2020
2730#define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29)
2731
2725/* CPU: FDI_TX */ 2732/* CPU: FDI_TX */
2726#define FDI_TXA_CTL 0x60100 2733#define FDI_TXA_CTL 0x60100
2727#define FDI_TXB_CTL 0x61100 2734#define FDI_TXB_CTL 0x61100
@@ -2946,6 +2953,7 @@
2946#define TRANS_DP_10BPC (1<<9) 2953#define TRANS_DP_10BPC (1<<9)
2947#define TRANS_DP_6BPC (2<<9) 2954#define TRANS_DP_6BPC (2<<9)
2948#define TRANS_DP_12BPC (3<<9) 2955#define TRANS_DP_12BPC (3<<9)
2956#define TRANS_DP_BPC_MASK (3<<9)
2949#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) 2957#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
2950#define TRANS_DP_VSYNC_ACTIVE_LOW 0 2958#define TRANS_DP_VSYNC_ACTIVE_LOW 0
2951#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) 2959#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
@@ -2959,10 +2967,11 @@
2959#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) 2967#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
2960#define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) 2968#define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
2961/* SNB B-stepping */ 2969/* SNB B-stepping */
2962#define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22) 2970#define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22)
2963#define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22) 2971#define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22)
2964#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22) 2972#define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22)
2965#define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22) 2973#define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22)
2974#define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22)
2966#define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) 2975#define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
2967 2976
2968#endif /* _I915_REG_H_ */ 2977#endif /* _I915_REG_H_ */
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 31f08581e93a..2df5b9aadd5b 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -862,8 +862,10 @@ int i915_restore_state(struct drm_device *dev)
862 /* Clock gating state */ 862 /* Clock gating state */
863 intel_init_clock_gating(dev); 863 intel_init_clock_gating(dev);
864 864
865 if (HAS_PCH_SPLIT(dev)) 865 if (HAS_PCH_SPLIT(dev)) {
866 ironlake_enable_drps(dev); 866 ironlake_enable_drps(dev);
867 intel_init_emon(dev);
868 }
867 869
868 /* Cache mode state */ 870 /* Cache mode state */
869 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); 871 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000);
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 197d4f32585a..0f950e74db3c 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -191,7 +191,8 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
191 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); 191 DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
192 192
193 if (turn_off_dac) { 193 if (turn_off_dac) {
194 I915_WRITE(PCH_ADPA, temp); 194 /* Make sure hotplug is enabled */
195 I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE);
195 (void)I915_READ(PCH_ADPA); 196 (void)I915_READ(PCH_ADPA);
196 } 197 }
197 198
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 979228594599..932a061f28d0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2044,9 +2044,11 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
2044 2044
2045 reg = I915_READ(trans_dp_ctl); 2045 reg = I915_READ(trans_dp_ctl);
2046 reg &= ~(TRANS_DP_PORT_SEL_MASK | 2046 reg &= ~(TRANS_DP_PORT_SEL_MASK |
2047 TRANS_DP_SYNC_MASK); 2047 TRANS_DP_SYNC_MASK |
2048 TRANS_DP_BPC_MASK);
2048 reg |= (TRANS_DP_OUTPUT_ENABLE | 2049 reg |= (TRANS_DP_OUTPUT_ENABLE |
2049 TRANS_DP_ENH_FRAMING); 2050 TRANS_DP_ENH_FRAMING);
2051 reg |= TRANS_DP_8BPC;
2050 2052
2051 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) 2053 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
2052 reg |= TRANS_DP_HSYNC_ACTIVE_HIGH; 2054 reg |= TRANS_DP_HSYNC_ACTIVE_HIGH;
@@ -5674,6 +5676,13 @@ void intel_init_clock_gating(struct drm_device *dev)
5674 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); 5676 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate);
5675 5677
5676 /* 5678 /*
5679 * On Ibex Peak and Cougar Point, we need to disable clock
5680 * gating for the panel power sequencer or it will fail to
5681 * start up when no ports are active.
5682 */
5683 I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE);
5684
5685 /*
5677 * According to the spec the following bits should be set in 5686 * According to the spec the following bits should be set in
5678 * order to enable memory self-refresh 5687 * order to enable memory self-refresh
5679 * The bit 22/21 of 0x42004 5688 * The bit 22/21 of 0x42004
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 9ab8708ac6ba..0aa77f318790 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -425,6 +425,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
425 uint16_t address = algo_data->address; 425 uint16_t address = algo_data->address;
426 uint8_t msg[5]; 426 uint8_t msg[5];
427 uint8_t reply[2]; 427 uint8_t reply[2];
428 unsigned retry;
428 int msg_bytes; 429 int msg_bytes;
429 int reply_bytes; 430 int reply_bytes;
430 int ret; 431 int ret;
@@ -459,14 +460,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
459 break; 460 break;
460 } 461 }
461 462
462 for (;;) { 463 for (retry = 0; retry < 5; retry++) {
463 ret = intel_dp_aux_ch(intel_dp, 464 ret = intel_dp_aux_ch(intel_dp,
464 msg, msg_bytes, 465 msg, msg_bytes,
465 reply, reply_bytes); 466 reply, reply_bytes);
466 if (ret < 0) { 467 if (ret < 0) {
467 DRM_DEBUG_KMS("aux_ch failed %d\n", ret); 468 DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
468 return ret; 469 return ret;
469 } 470 }
471
472 switch (reply[0] & AUX_NATIVE_REPLY_MASK) {
473 case AUX_NATIVE_REPLY_ACK:
474 /* I2C-over-AUX Reply field is only valid
475 * when paired with AUX ACK.
476 */
477 break;
478 case AUX_NATIVE_REPLY_NACK:
479 DRM_DEBUG_KMS("aux_ch native nack\n");
480 return -EREMOTEIO;
481 case AUX_NATIVE_REPLY_DEFER:
482 udelay(100);
483 continue;
484 default:
485 DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
486 reply[0]);
487 return -EREMOTEIO;
488 }
489
470 switch (reply[0] & AUX_I2C_REPLY_MASK) { 490 switch (reply[0] & AUX_I2C_REPLY_MASK) {
471 case AUX_I2C_REPLY_ACK: 491 case AUX_I2C_REPLY_ACK:
472 if (mode == MODE_I2C_READ) { 492 if (mode == MODE_I2C_READ) {
@@ -474,17 +494,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
474 } 494 }
475 return reply_bytes - 1; 495 return reply_bytes - 1;
476 case AUX_I2C_REPLY_NACK: 496 case AUX_I2C_REPLY_NACK:
477 DRM_DEBUG_KMS("aux_ch nack\n"); 497 DRM_DEBUG_KMS("aux_i2c nack\n");
478 return -EREMOTEIO; 498 return -EREMOTEIO;
479 case AUX_I2C_REPLY_DEFER: 499 case AUX_I2C_REPLY_DEFER:
480 DRM_DEBUG_KMS("aux_ch defer\n"); 500 DRM_DEBUG_KMS("aux_i2c defer\n");
481 udelay(100); 501 udelay(100);
482 break; 502 break;
483 default: 503 default:
484 DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); 504 DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
485 return -EREMOTEIO; 505 return -EREMOTEIO;
486 } 506 }
487 } 507 }
508
509 DRM_ERROR("too many retries, giving up\n");
510 return -EREMOTEIO;
488} 511}
489 512
490static int 513static int
@@ -1070,18 +1093,27 @@ intel_dp_signal_levels(uint8_t train_set, int lane_count)
1070static uint32_t 1093static uint32_t
1071intel_gen6_edp_signal_levels(uint8_t train_set) 1094intel_gen6_edp_signal_levels(uint8_t train_set)
1072{ 1095{
1073 switch (train_set & (DP_TRAIN_VOLTAGE_SWING_MASK|DP_TRAIN_PRE_EMPHASIS_MASK)) { 1096 int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK |
1097 DP_TRAIN_PRE_EMPHASIS_MASK);
1098 switch (signal_levels) {
1074 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: 1099 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0:
1075 return EDP_LINK_TRAIN_400MV_0DB_SNB_B; 1100 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0:
1101 return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
1102 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5:
1103 return EDP_LINK_TRAIN_400MV_3_5DB_SNB_B;
1076 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: 1104 case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6:
1077 return EDP_LINK_TRAIN_400MV_6DB_SNB_B; 1105 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6:
1106 return EDP_LINK_TRAIN_400_600MV_6DB_SNB_B;
1078 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: 1107 case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5:
1079 return EDP_LINK_TRAIN_600MV_3_5DB_SNB_B; 1108 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5:
1109 return EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B;
1080 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: 1110 case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0:
1081 return EDP_LINK_TRAIN_800MV_0DB_SNB_B; 1111 case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0:
1112 return EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B;
1082 default: 1113 default:
1083 DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level\n"); 1114 DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:"
1084 return EDP_LINK_TRAIN_400MV_0DB_SNB_B; 1115 "0x%x\n", signal_levels);
1116 return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
1085 } 1117 }
1086} 1118}
1087 1119
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8828b3ac6414..2b161375a38d 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -250,6 +250,7 @@ extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
250extern void intel_init_clock_gating(struct drm_device *dev); 250extern void intel_init_clock_gating(struct drm_device *dev);
251extern void ironlake_enable_drps(struct drm_device *dev); 251extern void ironlake_enable_drps(struct drm_device *dev);
252extern void ironlake_disable_drps(struct drm_device *dev); 252extern void ironlake_disable_drps(struct drm_device *dev);
253extern void intel_init_emon(struct drm_device *dev);
253 254
254extern int intel_pin_and_fence_fb_obj(struct drm_device *dev, 255extern int intel_pin_and_fence_fb_obj(struct drm_device *dev,
255 struct drm_gem_object *obj); 256 struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 6ec39a86ed06..c3b2208508fb 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -701,6 +701,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
701 }, 701 },
702 { 702 {
703 .callback = intel_no_lvds_dmi_callback, 703 .callback = intel_no_lvds_dmi_callback,
704 .ident = "AOpen i915GMm-HFS",
705 .matches = {
706 DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
707 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
708 },
709 },
710 {
711 .callback = intel_no_lvds_dmi_callback,
704 .ident = "Aopen i945GTt-VFA", 712 .ident = "Aopen i945GTt-VFA",
705 .matches = { 713 .matches = {
706 DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), 714 DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 1d306a458be6..743664187fef 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -1367,6 +1367,12 @@ void intel_setup_overlay(struct drm_device *dev)
1367 goto out_free_bo; 1367 goto out_free_bo;
1368 } 1368 }
1369 overlay->flip_addr = overlay->reg_bo->gtt_offset; 1369 overlay->flip_addr = overlay->reg_bo->gtt_offset;
1370
1371 ret = i915_gem_object_set_to_gtt_domain(reg_bo, true);
1372 if (ret) {
1373 DRM_ERROR("failed to move overlay register bo into the GTT\n");
1374 goto out_unpin_bo;
1375 }
1370 } else { 1376 } else {
1371 ret = i915_gem_attach_phys_object(dev, reg_bo, 1377 ret = i915_gem_attach_phys_object(dev, reg_bo,
1372 I915_GEM_PHYS_OVERLAY_REGS, 1378 I915_GEM_PHYS_OVERLAY_REGS,
@@ -1399,6 +1405,8 @@ void intel_setup_overlay(struct drm_device *dev)
1399 DRM_INFO("initialized overlay support\n"); 1405 DRM_INFO("initialized overlay support\n");
1400 return; 1406 return;
1401 1407
1408out_unpin_bo:
1409 i915_gem_object_unpin(reg_bo);
1402out_free_bo: 1410out_free_bo:
1403 drm_gem_object_unreference(reg_bo); 1411 drm_gem_object_unreference(reg_bo);
1404out_free: 1412out_free:
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ee73e428a84a..b60652bfd1a3 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1498,10 +1498,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
1498 if (!intel_sdvo_write_cmd(intel_sdvo, 1498 if (!intel_sdvo_write_cmd(intel_sdvo,
1499 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) 1499 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0))
1500 return connector_status_unknown; 1500 return connector_status_unknown;
1501 if (intel_sdvo->is_tv) { 1501
1502 /* add 30ms delay when the output type is SDVO-TV */ 1502 /* add 30ms delay when the output type might be TV */
1503 if (intel_sdvo->caps.output_flags &
1504 (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_CVBS0))
1503 mdelay(30); 1505 mdelay(30);
1504 } 1506
1505 if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) 1507 if (!intel_sdvo_read_response(intel_sdvo, &response, 2))
1506 return connector_status_unknown; 1508 return connector_status_unknown;
1507 1509
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index b1be617373b6..c926d8891a46 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -531,6 +531,12 @@ struct drm_nouveau_private {
531 struct work_struct irq_work; 531 struct work_struct irq_work;
532 struct work_struct hpd_work; 532 struct work_struct hpd_work;
533 533
534 struct {
535 spinlock_t lock;
536 uint32_t hpd0_bits;
537 uint32_t hpd1_bits;
538 } hpd_state;
539
534 struct list_head vbl_waiting; 540 struct list_head vbl_waiting;
535 541
536 struct { 542 struct {
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 794b0ee30cf6..b62a601737a4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -52,6 +52,7 @@ nouveau_irq_preinstall(struct drm_device *dev)
52 if (dev_priv->card_type >= NV_50) { 52 if (dev_priv->card_type >= NV_50) {
53 INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); 53 INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
54 INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); 54 INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
55 spin_lock_init(&dev_priv->hpd_state.lock);
55 INIT_LIST_HEAD(&dev_priv->vbl_waiting); 56 INIT_LIST_HEAD(&dev_priv->vbl_waiting);
56 } 57 }
57} 58}
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 612fa6d6a0cb..d967cb65d641 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1012,11 +1012,18 @@ nv50_display_irq_hotplug_bh(struct work_struct *work)
1012 struct drm_connector *connector; 1012 struct drm_connector *connector;
1013 const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; 1013 const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 };
1014 uint32_t unplug_mask, plug_mask, change_mask; 1014 uint32_t unplug_mask, plug_mask, change_mask;
1015 uint32_t hpd0, hpd1 = 0; 1015 uint32_t hpd0, hpd1;
1016 1016
1017 hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); 1017 spin_lock_irq(&dev_priv->hpd_state.lock);
1018 hpd0 = dev_priv->hpd_state.hpd0_bits;
1019 dev_priv->hpd_state.hpd0_bits = 0;
1020 hpd1 = dev_priv->hpd_state.hpd1_bits;
1021 dev_priv->hpd_state.hpd1_bits = 0;
1022 spin_unlock_irq(&dev_priv->hpd_state.lock);
1023
1024 hpd0 &= nv_rd32(dev, 0xe050);
1018 if (dev_priv->chipset >= 0x90) 1025 if (dev_priv->chipset >= 0x90)
1019 hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); 1026 hpd1 &= nv_rd32(dev, 0xe070);
1020 1027
1021 plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); 1028 plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16);
1022 unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); 1029 unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000);
@@ -1058,10 +1065,6 @@ nv50_display_irq_hotplug_bh(struct work_struct *work)
1058 helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); 1065 helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF);
1059 } 1066 }
1060 1067
1061 nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054));
1062 if (dev_priv->chipset >= 0x90)
1063 nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074));
1064
1065 drm_helper_hpd_irq_event(dev); 1068 drm_helper_hpd_irq_event(dev);
1066} 1069}
1067 1070
@@ -1072,8 +1075,22 @@ nv50_display_irq_handler(struct drm_device *dev)
1072 uint32_t delayed = 0; 1075 uint32_t delayed = 0;
1073 1076
1074 if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { 1077 if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) {
1075 if (!work_pending(&dev_priv->hpd_work)) 1078 uint32_t hpd0_bits, hpd1_bits = 0;
1076 queue_work(dev_priv->wq, &dev_priv->hpd_work); 1079
1080 hpd0_bits = nv_rd32(dev, 0xe054);
1081 nv_wr32(dev, 0xe054, hpd0_bits);
1082
1083 if (dev_priv->chipset >= 0x90) {
1084 hpd1_bits = nv_rd32(dev, 0xe074);
1085 nv_wr32(dev, 0xe074, hpd1_bits);
1086 }
1087
1088 spin_lock(&dev_priv->hpd_state.lock);
1089 dev_priv->hpd_state.hpd0_bits |= hpd0_bits;
1090 dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
1091 spin_unlock(&dev_priv->hpd_state.lock);
1092
1093 queue_work(dev_priv->wq, &dev_priv->hpd_work);
1077 } 1094 }
1078 1095
1079 while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { 1096 while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 8e421f644a54..05efb5b9f13e 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
112 base += 3; 112 base += 3;
113 break; 113 break;
114 case ATOM_IIO_WRITE: 114 case ATOM_IIO_WRITE:
115 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
115 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); 116 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
116 base += 3; 117 base += 3;
117 break; 118 break;
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index cd0290f946cf..e226f47b497c 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
253 case DRM_MODE_DPMS_SUSPEND: 253 case DRM_MODE_DPMS_SUSPEND:
254 case DRM_MODE_DPMS_OFF: 254 case DRM_MODE_DPMS_OFF:
255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); 255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
256 atombios_blank_crtc(crtc, ATOM_ENABLE); 256 if (radeon_crtc->enabled)
257 atombios_blank_crtc(crtc, ATOM_ENABLE);
257 if (ASIC_IS_DCE3(rdev)) 258 if (ASIC_IS_DCE3(rdev))
258 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); 259 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
259 atombios_enable_crtc(crtc, ATOM_DISABLE); 260 atombios_enable_crtc(crtc, ATOM_DISABLE);
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 4e7778d44b8d..695de9a38506 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) 187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
188{ 188{
189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); 189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock);
190 int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); 190 int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock);
191 191
192 if ((lanes == 0) || (bw == 0)) 192 if ((lanes == 0) || (dp_clock == 0))
193 return MODE_CLOCK_HIGH; 193 return MODE_CLOCK_HIGH;
194 194
195 return MODE_OK; 195 return MODE_OK;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 2f93d46ae69a..9e3dd2fd2766 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1423,7 +1423,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev)
1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1424{ 1424{
1425 struct evergreen_mc_save save; 1425 struct evergreen_mc_save save;
1426 u32 srbm_reset = 0;
1427 u32 grbm_reset = 0; 1426 u32 grbm_reset = 0;
1428 1427
1429 dev_info(rdev->dev, "GPU softreset \n"); 1428 dev_info(rdev->dev, "GPU softreset \n");
@@ -1462,16 +1461,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1462 udelay(50); 1461 udelay(50);
1463 WREG32(GRBM_SOFT_RESET, 0); 1462 WREG32(GRBM_SOFT_RESET, 0);
1464 (void)RREG32(GRBM_SOFT_RESET); 1463 (void)RREG32(GRBM_SOFT_RESET);
1465
1466 /* reset all the system blocks */
1467 srbm_reset = SRBM_SOFT_RESET_ALL_MASK;
1468
1469 dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset);
1470 WREG32(SRBM_SOFT_RESET, srbm_reset);
1471 (void)RREG32(SRBM_SOFT_RESET);
1472 udelay(50);
1473 WREG32(SRBM_SOFT_RESET, 0);
1474 (void)RREG32(SRBM_SOFT_RESET);
1475 /* Wait a little for things to settle down */ 1464 /* Wait a little for things to settle down */
1476 udelay(50); 1465 udelay(50);
1477 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1466 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
@@ -1482,10 +1471,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1482 RREG32(GRBM_STATUS_SE1)); 1471 RREG32(GRBM_STATUS_SE1));
1483 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1472 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
1484 RREG32(SRBM_STATUS)); 1473 RREG32(SRBM_STATUS));
1485 /* After reset we need to reinit the asic as GPU often endup in an
1486 * incoherent state.
1487 */
1488 atom_asic_init(rdev->mode_info.atom_context);
1489 evergreen_mc_resume(rdev, &save); 1474 evergreen_mc_resume(rdev, &save);
1490 return 0; 1475 return 0;
1491} 1476}
@@ -2097,6 +2082,11 @@ int evergreen_resume(struct radeon_device *rdev)
2097{ 2082{
2098 int r; 2083 int r;
2099 2084
2085 /* reset the asic, the gfx blocks are often in a bad state
2086 * after the driver is unloaded or after a resume
2087 */
2088 if (radeon_asic_reset(rdev))
2089 dev_warn(rdev->dev, "GPU reset failed !\n");
2100 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 2090 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
2101 * posting will perform necessary task to bring back GPU into good 2091 * posting will perform necessary task to bring back GPU into good
2102 * shape. 2092 * shape.
@@ -2193,6 +2183,11 @@ int evergreen_init(struct radeon_device *rdev)
2193 r = radeon_atombios_init(rdev); 2183 r = radeon_atombios_init(rdev);
2194 if (r) 2184 if (r)
2195 return r; 2185 return r;
2186 /* reset the asic, the gfx blocks are often in a bad state
2187 * after the driver is unloaded or after a resume
2188 */
2189 if (radeon_asic_reset(rdev))
2190 dev_warn(rdev->dev, "GPU reset failed !\n");
2196 /* Post card if necessary */ 2191 /* Post card if necessary */
2197 if (!evergreen_card_posted(rdev)) { 2192 if (!evergreen_card_posted(rdev)) {
2198 if (!rdev->bios) { 2193 if (!rdev->bios) {
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e59422320bb6..0ba4163ee0a4 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2318,6 +2318,9 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - 2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
2319 * Novell bug 204882 + along with lots of ubuntu ones 2319 * Novell bug 204882 + along with lots of ubuntu ones
2320 */ 2320 */
2321 if (rdev->mc.aper_size > config_aper_size)
2322 config_aper_size = rdev->mc.aper_size;
2323
2321 if (config_aper_size > rdev->mc.real_vram_size) 2324 if (config_aper_size > rdev->mc.real_vram_size)
2322 rdev->mc.mc_vram_size = config_aper_size; 2325 rdev->mc.mc_vram_size = config_aper_size;
2323 else 2326 else
@@ -3225,6 +3228,8 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
3225 for (u = 0; u < track->num_texture; u++) { 3228 for (u = 0; u < track->num_texture; u++) {
3226 if (!track->textures[u].enabled) 3229 if (!track->textures[u].enabled)
3227 continue; 3230 continue;
3231 if (track->textures[u].lookup_disable)
3232 continue;
3228 robj = track->textures[u].robj; 3233 robj = track->textures[u].robj;
3229 if (robj == NULL) { 3234 if (robj == NULL) {
3230 DRM_ERROR("No texture bound to unit %u\n", u); 3235 DRM_ERROR("No texture bound to unit %u\n", u);
@@ -3459,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track
3459 track->textures[i].robj = NULL; 3464 track->textures[i].robj = NULL;
3460 /* CS IB emission code makes sure texture unit are disabled */ 3465 /* CS IB emission code makes sure texture unit are disabled */
3461 track->textures[i].enabled = false; 3466 track->textures[i].enabled = false;
3467 track->textures[i].lookup_disable = false;
3462 track->textures[i].roundup_w = true; 3468 track->textures[i].roundup_w = true;
3463 track->textures[i].roundup_h = true; 3469 track->textures[i].roundup_h = true;
3464 if (track->separate_cube) 3470 if (track->separate_cube)
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index f47cdca1c004..af65600e6564 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -46,6 +46,7 @@ struct r100_cs_track_texture {
46 unsigned height_11; 46 unsigned height_11;
47 bool use_pitch; 47 bool use_pitch;
48 bool enabled; 48 bool enabled;
49 bool lookup_disable;
49 bool roundup_w; 50 bool roundup_w;
50 bool roundup_h; 51 bool roundup_h;
51 unsigned compress_format; 52 unsigned compress_format;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 0266d72e0a4c..d2408c395619 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_parser *p,
447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); 447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK);
448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); 448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK);
449 } 449 }
450 if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE)
451 track->textures[i].lookup_disable = true;
450 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { 452 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) {
451 case R200_TXFORMAT_I8: 453 case R200_TXFORMAT_I8:
452 case R200_TXFORMAT_RGB332: 454 case R200_TXFORMAT_RGB332:
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7b65e4efe8af..74b9fb7a71df 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device *rdev)
97{ 97{
98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> 98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >>
99 ASIC_T_SHIFT; 99 ASIC_T_SHIFT;
100 u32 actual_temp = 0;
101 100
102 if ((temp >> 7) & 1) 101 return temp * 1000;
103 actual_temp = 0;
104 else
105 actual_temp = (temp >> 1) & 0xff;
106
107 return actual_temp * 1000;
108} 102}
109 103
110void r600_pm_get_dynpm_state(struct radeon_device *rdev) 104void r600_pm_get_dynpm_state(struct radeon_device *rdev)
@@ -884,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev)
884 u32 tmp; 878 u32 tmp;
885 879
886 /* flush hdp cache so updates hit vram */ 880 /* flush hdp cache so updates hit vram */
887 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { 881 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
882 !(rdev->flags & RADEON_IS_AGP)) {
888 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; 883 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr;
889 u32 tmp; 884 u32 tmp;
890 885
891 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 886 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
892 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 887 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
888 * This seems to cause problems on some AGP cards. Just use the old
889 * method for them.
893 */ 890 */
894 WREG32(HDP_DEBUG1, 0); 891 WREG32(HDP_DEBUG1, 0);
895 tmp = readl((void __iomem *)ptr); 892 tmp = readl((void __iomem *)ptr);
@@ -1201,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1201 mc->vram_end, mc->real_vram_size >> 20); 1198 mc->vram_end, mc->real_vram_size >> 20);
1202 } else { 1199 } else {
1203 u64 base = 0; 1200 u64 base = 0;
1204 if (rdev->flags & RADEON_IS_IGP) 1201 if (rdev->flags & RADEON_IS_IGP) {
1205 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; 1202 base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF;
1203 base <<= 24;
1204 }
1206 radeon_vram_location(rdev, &rdev->mc, base); 1205 radeon_vram_location(rdev, &rdev->mc, base);
1207 rdev->mc.gtt_base_align = 0; 1206 rdev->mc.gtt_base_align = 0;
1208 radeon_gtt_location(rdev, mc); 1207 radeon_gtt_location(rdev, mc);
@@ -1608,8 +1607,11 @@ void r600_gpu_init(struct radeon_device *rdev)
1608 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; 1607 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes;
1609 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1608 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1610 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1609 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1611 tiling_config |= GROUP_SIZE(0); 1610 tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
1612 rdev->config.r600.tiling_group_size = 256; 1611 if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
1612 rdev->config.r600.tiling_group_size = 512;
1613 else
1614 rdev->config.r600.tiling_group_size = 256;
1613 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; 1615 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT;
1614 if (tmp > 3) { 1616 if (tmp > 3) {
1615 tiling_config |= ROW_TILING(3); 1617 tiling_config |= ROW_TILING(3);
@@ -3528,10 +3530,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
3528void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) 3530void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
3529{ 3531{
3530 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 3532 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
3531 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 3533 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL.
3534 * This seems to cause problems on some AGP cards. Just use the old
3535 * method for them.
3532 */ 3536 */
3533 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && 3537 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
3534 rdev->vram_scratch.ptr) { 3538 rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) {
3535 void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 3539 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
3536 u32 tmp; 3540 u32 tmp;
3537 3541
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 3473c00781ff..e5d4928fd2dc 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -650,8 +650,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
650 int src_x = src_gpu_addr & 255; 650 int src_x = src_gpu_addr & 255;
651 int dst_x = dst_gpu_addr & 255; 651 int dst_x = dst_gpu_addr & 255;
652 int h = 1; 652 int h = 1;
653 src_gpu_addr = src_gpu_addr & ~255; 653 src_gpu_addr = src_gpu_addr & ~255ULL;
654 dst_gpu_addr = dst_gpu_addr & ~255; 654 dst_gpu_addr = dst_gpu_addr & ~255ULL;
655 655
656 if (!src_x && !dst_x) { 656 if (!src_x && !dst_x) {
657 h = (cur_size / max_bytes); 657 h = (cur_size / max_bytes);
@@ -744,8 +744,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
744 int src_x = (src_gpu_addr & 255); 744 int src_x = (src_gpu_addr & 255);
745 int dst_x = (dst_gpu_addr & 255); 745 int dst_x = (dst_gpu_addr & 255);
746 int h = 1; 746 int h = 1;
747 src_gpu_addr = src_gpu_addr & ~255; 747 src_gpu_addr = src_gpu_addr & ~255ULL;
748 dst_gpu_addr = dst_gpu_addr & ~255; 748 dst_gpu_addr = dst_gpu_addr & ~255ULL;
749 749
750 if (!src_x && !dst_x) { 750 if (!src_x && !dst_x) {
751 h = (cur_size / max_bytes); 751 h = (cur_size / max_bytes);
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 250a3a918193..478fddf08f9a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -228,7 +228,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
228 __func__, __LINE__, pitch); 228 __func__, __LINE__, pitch);
229 return -EINVAL; 229 return -EINVAL;
230 } 230 }
231 if (!IS_ALIGNED((height / 8), track->nbanks)) { 231 if (!IS_ALIGNED((height / 8), track->npipes)) {
232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", 232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n",
233 __func__, __LINE__, height); 233 __func__, __LINE__, height);
234 return -EINVAL; 234 return -EINVAL;
@@ -367,7 +367,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
367 __func__, __LINE__, pitch); 367 __func__, __LINE__, pitch);
368 return -EINVAL; 368 return -EINVAL;
369 } 369 }
370 if ((height / 8) & (track->nbanks - 1)) { 370 if (!IS_ALIGNED((height / 8), track->npipes)) {
371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n", 371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n",
372 __func__, __LINE__, height); 372 __func__, __LINE__, height);
373 return -EINVAL; 373 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h
index d84612ae47e0..33cda016b083 100644
--- a/drivers/gpu/drm/radeon/r600_reg.h
+++ b/drivers/gpu/drm/radeon/r600_reg.h
@@ -86,6 +86,7 @@
86#define R600_HDP_NONSURFACE_BASE 0x2c04 86#define R600_HDP_NONSURFACE_BASE 0x2c04
87 87
88#define R600_BUS_CNTL 0x5420 88#define R600_BUS_CNTL 0x5420
89# define R600_BIOS_ROM_DIS (1 << 1)
89#define R600_CONFIG_CNTL 0x5424 90#define R600_CONFIG_CNTL 0x5424
90#define R600_CONFIG_MEMSIZE 0x5428 91#define R600_CONFIG_MEMSIZE 0x5428
91#define R600_CONFIG_F0_BASE 0x542C 92#define R600_CONFIG_F0_BASE 0x542C
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 8e43ddae70cc..85a0d9f1f82b 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
98 } 98 }
99 } 99 }
100 100
101 /* some DCE3 boards have bad data for this entry */
102 if (ASIC_IS_DCE3(rdev)) {
103 if ((i == 4) &&
104 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
105 (gpio->sucI2cId.ucAccess == 0x94))
106 gpio->sucI2cId.ucAccess = 0x14;
107 }
108
101 if (gpio->sucI2cId.ucAccess == id) { 109 if (gpio->sucI2cId.ucAccess == id) {
102 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 110 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
103 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 111 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)
174 } 182 }
175 } 183 }
176 184
185 /* some DCE3 boards have bad data for this entry */
186 if (ASIC_IS_DCE3(rdev)) {
187 if ((i == 4) &&
188 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
189 (gpio->sucI2cId.ucAccess == 0x94))
190 gpio->sucI2cId.ucAccess = 0x14;
191 }
192
177 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 193 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
178 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 194 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
179 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; 195 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4;
@@ -297,7 +313,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
297 uint16_t *line_mux, 313 uint16_t *line_mux,
298 struct radeon_hpd *hpd) 314 struct radeon_hpd *hpd)
299{ 315{
300 struct radeon_device *rdev = dev->dev_private;
301 316
302 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ 317 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
303 if ((dev->pdev->device == 0x791e) && 318 if ((dev->pdev->device == 0x791e) &&
@@ -372,6 +387,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
372 *line_mux = 0x90; 387 *line_mux = 0x90;
373 } 388 }
374 389
390 /* mac rv630, rv730, others */
391 if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
392 (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
393 *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
394 *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
395 }
396
375 /* ASUS HD 3600 XT board lists the DVI port as HDMI */ 397 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
376 if ((dev->pdev->device == 0x9598) && 398 if ((dev->pdev->device == 0x9598) &&
377 (dev->pdev->subsystem_vendor == 0x1043) && 399 (dev->pdev->subsystem_vendor == 0x1043) &&
@@ -409,21 +431,23 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
409 } 431 }
410 } 432 }
411 433
412 /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ 434 /* Acer laptop (Acer TravelMate 5730G) has an HDMI port
435 * on the laptop and a DVI port on the docking station and
436 * both share the same encoder, hpd pin, and ddc line.
437 * So while the bios table is technically correct,
438 * we drop the DVI port here since xrandr has no concept of
439 * encoders and will try and drive both connectors
440 * with different crtcs which isn't possible on the hardware
441 * side and leaves no crtcs for LVDS or VGA.
442 */
413 if ((dev->pdev->device == 0x95c4) && 443 if ((dev->pdev->device == 0x95c4) &&
414 (dev->pdev->subsystem_vendor == 0x1025) && 444 (dev->pdev->subsystem_vendor == 0x1025) &&
415 (dev->pdev->subsystem_device == 0x013c)) { 445 (dev->pdev->subsystem_device == 0x013c)) {
416 struct radeon_gpio_rec gpio;
417
418 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
419 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { 447 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
420 gpio = radeon_lookup_gpio(rdev, 6); 448 /* actually it's a DVI-D port not DVI-I */
421 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
422 *connector_type = DRM_MODE_CONNECTOR_DVID; 449 *connector_type = DRM_MODE_CONNECTOR_DVID;
423 } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && 450 return false;
424 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
425 gpio = radeon_lookup_gpio(rdev, 7);
426 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
427 } 451 }
428 } 452 }
429 453
@@ -2279,7 +2303,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
2279 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; 2303 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;
2280 2304
2281 /* tell the bios not to handle mode switching */ 2305 /* tell the bios not to handle mode switching */
2282 bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); 2306 bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH;
2283 2307
2284 if (rdev->family >= CHIP_R600) { 2308 if (rdev->family >= CHIP_R600) {
2285 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); 2309 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
@@ -2330,10 +2354,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock)
2330 else 2354 else
2331 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); 2355 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
2332 2356
2333 if (lock) 2357 if (lock) {
2334 bios_6_scratch |= ATOM_S6_CRITICAL_STATE; 2358 bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
2335 else 2359 bios_6_scratch &= ~ATOM_S6_ACC_MODE;
2360 } else {
2336 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; 2361 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
2362 bios_6_scratch |= ATOM_S6_ACC_MODE;
2363 }
2337 2364
2338 if (rdev->family >= CHIP_R600) 2365 if (rdev->family >= CHIP_R600)
2339 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); 2366 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 654787ec43f4..8f2c7b50dcf5 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
130 } 130 }
131 return true; 131 return true;
132} 132}
133
133static bool r700_read_disabled_bios(struct radeon_device *rdev) 134static bool r700_read_disabled_bios(struct radeon_device *rdev)
134{ 135{
135 uint32_t viph_control; 136 uint32_t viph_control;
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
143 bool r; 144 bool r;
144 145
145 viph_control = RREG32(RADEON_VIPH_CONTROL); 146 viph_control = RREG32(RADEON_VIPH_CONTROL);
146 bus_cntl = RREG32(RADEON_BUS_CNTL); 147 bus_cntl = RREG32(R600_BUS_CNTL);
147 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 148 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
148 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 149 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
149 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 150 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
152 /* disable VIP */ 153 /* disable VIP */
153 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 154 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
154 /* enable the rom */ 155 /* enable the rom */
155 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 156 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
156 /* Disable VGA mode */ 157 /* Disable VGA mode */
157 WREG32(AVIVO_D1VGA_CONTROL, 158 WREG32(AVIVO_D1VGA_CONTROL,
158 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 159 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
191 cg_spll_status = RREG32(R600_CG_SPLL_STATUS); 192 cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
192 } 193 }
193 WREG32(RADEON_VIPH_CONTROL, viph_control); 194 WREG32(RADEON_VIPH_CONTROL, viph_control);
194 WREG32(RADEON_BUS_CNTL, bus_cntl); 195 WREG32(R600_BUS_CNTL, bus_cntl);
195 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 196 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
196 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 197 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
197 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 198 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
216 bool r; 217 bool r;
217 218
218 viph_control = RREG32(RADEON_VIPH_CONTROL); 219 viph_control = RREG32(RADEON_VIPH_CONTROL);
219 bus_cntl = RREG32(RADEON_BUS_CNTL); 220 bus_cntl = RREG32(R600_BUS_CNTL);
220 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 221 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
221 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 222 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
222 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 223 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
231 /* disable VIP */ 232 /* disable VIP */
232 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 233 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
233 /* enable the rom */ 234 /* enable the rom */
234 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 235 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
235 /* Disable VGA mode */ 236 /* Disable VGA mode */
236 WREG32(AVIVO_D1VGA_CONTROL, 237 WREG32(AVIVO_D1VGA_CONTROL,
237 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 238 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
262 263
263 /* restore regs */ 264 /* restore regs */
264 WREG32(RADEON_VIPH_CONTROL, viph_control); 265 WREG32(RADEON_VIPH_CONTROL, viph_control);
265 WREG32(RADEON_BUS_CNTL, bus_cntl); 266 WREG32(R600_BUS_CNTL, bus_cntl);
266 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 267 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
267 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 268 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
268 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 269 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 7b7ea269549c..137b8075f6e7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
571 } 571 }
572 572
573 if (clk_mask && data_mask) { 573 if (clk_mask && data_mask) {
574 /* system specific masks */
574 i2c.mask_clk_mask = clk_mask; 575 i2c.mask_clk_mask = clk_mask;
575 i2c.mask_data_mask = data_mask; 576 i2c.mask_data_mask = data_mask;
576 i2c.a_clk_mask = clk_mask; 577 i2c.a_clk_mask = clk_mask;
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
579 i2c.en_data_mask = data_mask; 580 i2c.en_data_mask = data_mask;
580 i2c.y_clk_mask = clk_mask; 581 i2c.y_clk_mask = clk_mask;
581 i2c.y_data_mask = data_mask; 582 i2c.y_data_mask = data_mask;
583 } else if ((ddc_line == RADEON_GPIOPAD_MASK) ||
584 (ddc_line == RADEON_MDGPIO_MASK)) {
585 /* default gpiopad masks */
586 i2c.mask_clk_mask = (0x20 << 8);
587 i2c.mask_data_mask = 0x80;
588 i2c.a_clk_mask = (0x20 << 8);
589 i2c.a_data_mask = 0x80;
590 i2c.en_clk_mask = (0x20 << 8);
591 i2c.en_data_mask = 0x80;
592 i2c.y_clk_mask = (0x20 << 8);
593 i2c.y_data_mask = 0x80;
582 } else { 594 } else {
595 /* default masks for ddc pads */
583 i2c.mask_clk_mask = RADEON_GPIO_EN_1; 596 i2c.mask_clk_mask = RADEON_GPIO_EN_1;
584 i2c.mask_data_mask = RADEON_GPIO_EN_0; 597 i2c.mask_data_mask = RADEON_GPIO_EN_0;
585 i2c.a_clk_mask = RADEON_GPIO_A_1; 598 i2c.a_clk_mask = RADEON_GPIO_A_1;
@@ -716,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
716 clk = RBIOS8(offset + 3 + (i * 5) + 3); 729 clk = RBIOS8(offset + 3 + (i * 5) + 3);
717 data = RBIOS8(offset + 3 + (i * 5) + 4); 730 data = RBIOS8(offset + 3 + (i * 5) + 4);
718 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 731 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
719 clk, data); 732 (1 << clk), (1 << data));
720 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); 733 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
721 break; 734 break;
722 } 735 }
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index ecc1a8fafbfd..5e222c9739c7 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1119 /* no HPD on analog connectors */ 1119 /* no HPD on analog connectors */
1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1122 connector->interlace_allowed = true;
1123 connector->doublescan_allowed = true;
1122 break; 1124 break;
1123 case DRM_MODE_CONNECTOR_DVIA: 1125 case DRM_MODE_CONNECTOR_DVIA:
1124 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1126 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1134 1); 1136 1);
1135 /* no HPD on analog connectors */ 1137 /* no HPD on analog connectors */
1136 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1138 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1139 connector->interlace_allowed = true;
1140 connector->doublescan_allowed = true;
1137 break; 1141 break;
1138 case DRM_MODE_CONNECTOR_DVII: 1142 case DRM_MODE_CONNECTOR_DVII:
1139 case DRM_MODE_CONNECTOR_DVID: 1143 case DRM_MODE_CONNECTOR_DVID:
@@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1163 rdev->mode_info.load_detect_property, 1167 rdev->mode_info.load_detect_property,
1164 1); 1168 1);
1165 } 1169 }
1170 connector->interlace_allowed = true;
1171 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1172 connector->doublescan_allowed = true;
1173 else
1174 connector->doublescan_allowed = false;
1166 break; 1175 break;
1167 case DRM_MODE_CONNECTOR_HDMIA: 1176 case DRM_MODE_CONNECTOR_HDMIA:
1168 case DRM_MODE_CONNECTOR_HDMIB: 1177 case DRM_MODE_CONNECTOR_HDMIB:
@@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1186 rdev->mode_info.underscan_property, 1195 rdev->mode_info.underscan_property,
1187 UNDERSCAN_AUTO); 1196 UNDERSCAN_AUTO);
1188 subpixel_order = SubPixelHorizontalRGB; 1197 subpixel_order = SubPixelHorizontalRGB;
1198 connector->interlace_allowed = true;
1199 if (connector_type == DRM_MODE_CONNECTOR_HDMIB)
1200 connector->doublescan_allowed = true;
1201 else
1202 connector->doublescan_allowed = false;
1189 break; 1203 break;
1190 case DRM_MODE_CONNECTOR_DisplayPort: 1204 case DRM_MODE_CONNECTOR_DisplayPort:
1191 case DRM_MODE_CONNECTOR_eDP: 1205 case DRM_MODE_CONNECTOR_eDP:
@@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1216 drm_connector_attach_property(&radeon_connector->base, 1230 drm_connector_attach_property(&radeon_connector->base,
1217 rdev->mode_info.underscan_property, 1231 rdev->mode_info.underscan_property,
1218 UNDERSCAN_AUTO); 1232 UNDERSCAN_AUTO);
1233 connector->interlace_allowed = true;
1234 /* in theory with a DP to VGA converter... */
1235 connector->doublescan_allowed = false;
1219 break; 1236 break;
1220 case DRM_MODE_CONNECTOR_SVIDEO: 1237 case DRM_MODE_CONNECTOR_SVIDEO:
1221 case DRM_MODE_CONNECTOR_Composite: 1238 case DRM_MODE_CONNECTOR_Composite:
@@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1231 radeon_atombios_get_tv_info(rdev)); 1248 radeon_atombios_get_tv_info(rdev));
1232 /* no HPD on analog connectors */ 1249 /* no HPD on analog connectors */
1233 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1250 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1251 connector->interlace_allowed = false;
1252 connector->doublescan_allowed = false;
1234 break; 1253 break;
1235 case DRM_MODE_CONNECTOR_LVDS: 1254 case DRM_MODE_CONNECTOR_LVDS:
1236 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); 1255 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
@@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1249 dev->mode_config.scaling_mode_property, 1268 dev->mode_config.scaling_mode_property,
1250 DRM_MODE_SCALE_FULLSCREEN); 1269 DRM_MODE_SCALE_FULLSCREEN);
1251 subpixel_order = SubPixelHorizontalRGB; 1270 subpixel_order = SubPixelHorizontalRGB;
1271 connector->interlace_allowed = false;
1272 connector->doublescan_allowed = false;
1252 break; 1273 break;
1253 } 1274 }
1254 1275
@@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1326 /* no HPD on analog connectors */ 1347 /* no HPD on analog connectors */
1327 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1348 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1328 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1349 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1350 connector->interlace_allowed = true;
1351 connector->doublescan_allowed = true;
1329 break; 1352 break;
1330 case DRM_MODE_CONNECTOR_DVIA: 1353 case DRM_MODE_CONNECTOR_DVIA:
1331 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1354 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1341 1); 1364 1);
1342 /* no HPD on analog connectors */ 1365 /* no HPD on analog connectors */
1343 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1366 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1367 connector->interlace_allowed = true;
1368 connector->doublescan_allowed = true;
1344 break; 1369 break;
1345 case DRM_MODE_CONNECTOR_DVII: 1370 case DRM_MODE_CONNECTOR_DVII:
1346 case DRM_MODE_CONNECTOR_DVID: 1371 case DRM_MODE_CONNECTOR_DVID:
@@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_device *dev,
1358 1); 1383 1);
1359 } 1384 }
1360 subpixel_order = SubPixelHorizontalRGB; 1385 subpixel_order = SubPixelHorizontalRGB;
1386 connector->interlace_allowed = true;
1387 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1388 connector->doublescan_allowed = true;
1389 else
1390 connector->doublescan_allowed = false;
1361 break; 1391 break;
1362 case DRM_MODE_CONNECTOR_SVIDEO: 1392 case DRM_MODE_CONNECTOR_SVIDEO:
1363 case DRM_MODE_CONNECTOR_Composite: 1393 case DRM_MODE_CONNECTOR_Composite:
@@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1380 radeon_combios_get_tv_info(rdev)); 1410 radeon_combios_get_tv_info(rdev));
1381 /* no HPD on analog connectors */ 1411 /* no HPD on analog connectors */
1382 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1412 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1413 connector->interlace_allowed = false;
1414 connector->doublescan_allowed = false;
1383 break; 1415 break;
1384 case DRM_MODE_CONNECTOR_LVDS: 1416 case DRM_MODE_CONNECTOR_LVDS:
1385 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); 1417 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type);
@@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1393 dev->mode_config.scaling_mode_property, 1425 dev->mode_config.scaling_mode_property,
1394 DRM_MODE_SCALE_FULLSCREEN); 1426 DRM_MODE_SCALE_FULLSCREEN);
1395 subpixel_order = SubPixelHorizontalRGB; 1427 subpixel_order = SubPixelHorizontalRGB;
1428 connector->interlace_allowed = false;
1429 connector->doublescan_allowed = false;
1396 break; 1430 break;
1397 } 1431 }
1398 1432
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 256d204a6d24..ed5e153384ac 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -829,11 +829,6 @@ int radeon_resume_kms(struct drm_device *dev)
829 radeon_pm_resume(rdev); 829 radeon_pm_resume(rdev);
830 radeon_restore_bios_scratch_regs(rdev); 830 radeon_restore_bios_scratch_regs(rdev);
831 831
832 /* turn on display hw */
833 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
834 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
835 }
836
837 radeon_fbdev_set_suspend(rdev, 0); 832 radeon_fbdev_set_suspend(rdev, 0);
838 release_console_sem(); 833 release_console_sem();
839 834
@@ -841,6 +836,10 @@ int radeon_resume_kms(struct drm_device *dev)
841 radeon_hpd_init(rdev); 836 radeon_hpd_init(rdev);
842 /* blat the mode back in */ 837 /* blat the mode back in */
843 drm_helper_resume_force_mode(dev); 838 drm_helper_resume_force_mode(dev);
839 /* turn on display hw */
840 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
841 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
842 }
844 return 0; 843 return 0;
845} 844}
846 845
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index b92d2f2fcbed..4da243ac79d7 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -629,6 +629,10 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll,
629 *frac_fb_div_p = best_frac_feedback_div; 629 *frac_fb_div_p = best_frac_feedback_div;
630 *ref_div_p = best_ref_div; 630 *ref_div_p = best_ref_div;
631 *post_div_p = best_post_div; 631 *post_div_p = best_post_div;
632 DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
633 freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div,
634 best_ref_div, best_post_div);
635
632} 636}
633 637
634static bool 638static bool
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 2c293e8304d6..b82015e148e6 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
595int 595int
596atombios_get_encoder_mode(struct drm_encoder *encoder) 596atombios_get_encoder_mode(struct drm_encoder *encoder)
597{ 597{
598 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
598 struct drm_device *dev = encoder->dev; 599 struct drm_device *dev = encoder->dev;
599 struct radeon_device *rdev = dev->dev_private; 600 struct radeon_device *rdev = dev->dev_private;
600 struct drm_connector *connector; 601 struct drm_connector *connector;
@@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
602 struct radeon_connector_atom_dig *dig_connector; 603 struct radeon_connector_atom_dig *dig_connector;
603 604
604 connector = radeon_get_connector_for_encoder(encoder); 605 connector = radeon_get_connector_for_encoder(encoder);
605 if (!connector) 606 if (!connector) {
606 return 0; 607 switch (radeon_encoder->encoder_id) {
607 608 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
609 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
610 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
611 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
612 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
613 return ATOM_ENCODER_MODE_DVI;
614 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
615 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
616 default:
617 return ATOM_ENCODER_MODE_CRT;
618 }
619 }
608 radeon_connector = to_radeon_connector(connector); 620 radeon_connector = to_radeon_connector(connector);
609 621
610 switch (connector->connector_type) { 622 switch (connector->connector_type) {
@@ -1547,6 +1559,23 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1547 struct radeon_device *rdev = dev->dev_private; 1559 struct radeon_device *rdev = dev->dev_private;
1548 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1560 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1549 struct radeon_encoder_atom_dig *dig; 1561 struct radeon_encoder_atom_dig *dig;
1562
1563 /* check for pre-DCE3 cards with shared encoders;
1564 * can't really use the links individually, so don't disable
1565 * the encoder if it's in use by another connector
1566 */
1567 if (!ASIC_IS_DCE3(rdev)) {
1568 struct drm_encoder *other_encoder;
1569 struct radeon_encoder *other_radeon_encoder;
1570
1571 list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) {
1572 other_radeon_encoder = to_radeon_encoder(other_encoder);
1573 if ((radeon_encoder->encoder_id == other_radeon_encoder->encoder_id) &&
1574 drm_helper_encoder_in_use(other_encoder))
1575 goto disable_done;
1576 }
1577 }
1578
1550 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1579 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1551 1580
1552 switch (radeon_encoder->encoder_id) { 1581 switch (radeon_encoder->encoder_id) {
@@ -1586,6 +1615,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1586 break; 1615 break;
1587 } 1616 }
1588 1617
1618disable_done:
1589 if (radeon_encoder_is_digital(encoder)) { 1619 if (radeon_encoder_is_digital(encoder)) {
1590 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) 1620 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI)
1591 r600_hdmi_disable(encoder); 1621 r600_hdmi_disable(encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index 6a13ee38a5b9..acae80ee91a2 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -946,6 +946,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
946 i2c->rec = *rec; 946 i2c->rec = *rec;
947 i2c->adapter.owner = THIS_MODULE; 947 i2c->adapter.owner = THIS_MODULE;
948 i2c->dev = dev; 948 i2c->dev = dev;
949 sprintf(i2c->adapter.name, "Radeon aux bus %s", name);
949 i2c_set_adapdata(&i2c->adapter, i2c); 950 i2c_set_adapdata(&i2c->adapter, i2c);
950 i2c->adapter.algo_data = &i2c->algo.dp; 951 i2c->adapter.algo_data = &i2c->algo.dp;
951 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; 952 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index b3b5306bb578..25d345ecee8e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
102 type = ttm_bo_type_device; 102 type = ttm_bo_type_device;
103 } 103 }
104 *bo_ptr = NULL; 104 *bo_ptr = NULL;
105
106retry:
105 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); 107 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
106 if (bo == NULL) 108 if (bo == NULL)
107 return -ENOMEM; 109 return -ENOMEM;
@@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
109 bo->gobj = gobj; 111 bo->gobj = gobj;
110 bo->surface_reg = -1; 112 bo->surface_reg = -1;
111 INIT_LIST_HEAD(&bo->list); 113 INIT_LIST_HEAD(&bo->list);
112
113retry:
114 radeon_ttm_placement_from_domain(bo, domain); 114 radeon_ttm_placement_from_domain(bo, domain);
115 /* Kernel allocation are uninterruptible */ 115 /* Kernel allocation are uninterruptible */
116 mutex_lock(&rdev->vram_mutex); 116 mutex_lock(&rdev->vram_mutex);
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index c332f46340d5..64928814de53 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -2836,6 +2836,7 @@
2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) 2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) 2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24 2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24
2839# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
2839# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) 2840# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
2840# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) 2841# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
2841# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) 2842# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 9490da700749..b88353d6ed2e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -643,10 +643,11 @@ static void rv770_gpu_init(struct radeon_device *rdev)
643 else 643 else
644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); 645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3);
646 646 gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
647 gb_tiling_config |= GROUP_SIZE(0); 647 if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
648 rdev->config.rv770.tiling_group_size = 256; 648 rdev->config.rv770.tiling_group_size = 512;
649 649 else
650 rdev->config.rv770.tiling_group_size = 256;
650 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { 651 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) {
651 gb_tiling_config |= ROW_TILING(3); 652 gb_tiling_config |= ROW_TILING(3);
652 gb_tiling_config |= SAMPLE_SPLIT(3); 653 gb_tiling_config |= SAMPLE_SPLIT(3);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index f366f968155a..d7def1790b41 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *pdev, void *cookie,
636 void (*irq_set_state)(void *cookie, bool state), 636 void (*irq_set_state)(void *cookie, bool state),
637 unsigned int (*set_vga_decode)(void *cookie, bool decode)) 637 unsigned int (*set_vga_decode)(void *cookie, bool decode))
638{ 638{
639 int ret = -1; 639 int ret = -ENODEV;
640 struct vga_device *vgadev; 640 struct vga_device *vgadev;
641 unsigned long flags; 641 unsigned long flags;
642 642