aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c4
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c18
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c2
-rw-r--r--drivers/gpu/drm/radeon/ni.c1
-rw-r--r--drivers/gpu/drm/radeon/r100.c12
-rw-r--r--drivers/gpu/drm/radeon/r300.c8
-rw-r--r--drivers/gpu/drm/radeon/r420.c8
-rw-r--r--drivers/gpu/drm/radeon/r520.c8
-rw-r--r--drivers/gpu/drm/radeon/r600.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c35
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_shaders.c8
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c1
-rw-r--r--drivers/gpu/drm/radeon/r600d.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c27
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c7
-rw-r--r--drivers/gpu/drm/radeon/rs400.c8
-rw-r--r--drivers/gpu/drm/radeon/rs600.c12
-rw-r--r--drivers/gpu/drm/radeon/rs690.c8
-rw-r--r--drivers/gpu/drm/radeon/rv515.c8
-rw-r--r--drivers/gpu/drm/radeon/rv770.c1
31 files changed, 205 insertions, 52 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 891935271d34..742f17f009a9 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1184,7 +1184,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1184 WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1); 1184 WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
1185 1185
1186 WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, 1186 WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
1187 crtc->mode.vdisplay); 1187 target_fb->height);
1188 x &= ~3; 1188 x &= ~3;
1189 y &= ~1; 1189 y &= ~1;
1190 WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, 1190 WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
@@ -1353,7 +1353,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1353 WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1); 1353 WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
1354 1354
1355 WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, 1355 WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
1356 crtc->mode.vdisplay); 1356 target_fb->height);
1357 x &= ~3; 1357 x &= ~3;
1358 y &= ~1; 1358 y &= ~1;
1359 WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, 1359 WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index a71557ce01dc..552b436451fd 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -564,9 +564,21 @@ int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
564 ENCODER_OBJECT_ID_NUTMEG) 564 ENCODER_OBJECT_ID_NUTMEG)
565 panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE; 565 panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
566 else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) == 566 else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) ==
567 ENCODER_OBJECT_ID_TRAVIS) 567 ENCODER_OBJECT_ID_TRAVIS) {
568 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; 568 u8 id[6];
569 else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { 569 int i;
570 for (i = 0; i < 6; i++)
571 id[i] = radeon_read_dpcd_reg(radeon_connector, 0x503 + i);
572 if (id[0] == 0x73 &&
573 id[1] == 0x69 &&
574 id[2] == 0x76 &&
575 id[3] == 0x61 &&
576 id[4] == 0x72 &&
577 id[5] == 0x54)
578 panel_mode = DP_PANEL_MODE_INTERNAL_DP1_MODE;
579 else
580 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
581 } else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
570 u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP); 582 u8 tmp = radeon_read_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_CAP);
571 if (tmp & 1) 583 if (tmp & 1)
572 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE; 584 panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index ae09fe82afbc..f58254a3fb01 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -3191,6 +3191,7 @@ static int evergreen_startup(struct radeon_device *rdev)
3191 if (r) { 3191 if (r) {
3192 DRM_ERROR("radeon: failed testing IB (%d).\n", r); 3192 DRM_ERROR("radeon: failed testing IB (%d).\n", r);
3193 rdev->accel_working = false; 3193 rdev->accel_working = false;
3194 return r;
3194 } 3195 }
3195 3196
3196 r = r600_audio_init(rdev); 3197 r = r600_audio_init(rdev);
@@ -3222,6 +3223,7 @@ int evergreen_resume(struct radeon_device *rdev)
3222 r = evergreen_startup(rdev); 3223 r = evergreen_startup(rdev);
3223 if (r) { 3224 if (r) {
3224 DRM_ERROR("evergreen startup failed on resume\n"); 3225 DRM_ERROR("evergreen startup failed on resume\n");
3226 rdev->accel_working = false;
3225 return r; 3227 return r;
3226 } 3228 }
3227 3229
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index db09065e68fd..2509c505acb8 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1547,6 +1547,7 @@ int cayman_resume(struct radeon_device *rdev)
1547 r = cayman_startup(rdev); 1547 r = cayman_startup(rdev);
1548 if (r) { 1548 if (r) {
1549 DRM_ERROR("cayman startup failed on resume\n"); 1549 DRM_ERROR("cayman startup failed on resume\n");
1550 rdev->accel_working = false;
1550 return r; 1551 return r;
1551 } 1552 }
1552 return r; 1553 return r;
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index bfd36ab643a6..333cde9d4e7b 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -789,9 +789,7 @@ int r100_irq_process(struct radeon_device *rdev)
789 WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM); 789 WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM);
790 break; 790 break;
791 default: 791 default:
792 msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; 792 WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN);
793 WREG32(RADEON_MSI_REARM_EN, msi_rearm);
794 WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN);
795 break; 793 break;
796 } 794 }
797 } 795 }
@@ -3930,6 +3928,8 @@ static int r100_startup(struct radeon_device *rdev)
3930 3928
3931int r100_resume(struct radeon_device *rdev) 3929int r100_resume(struct radeon_device *rdev)
3932{ 3930{
3931 int r;
3932
3933 /* Make sur GART are not working */ 3933 /* Make sur GART are not working */
3934 if (rdev->flags & RADEON_IS_PCI) 3934 if (rdev->flags & RADEON_IS_PCI)
3935 r100_pci_gart_disable(rdev); 3935 r100_pci_gart_disable(rdev);
@@ -3949,7 +3949,11 @@ int r100_resume(struct radeon_device *rdev)
3949 radeon_surface_init(rdev); 3949 radeon_surface_init(rdev);
3950 3950
3951 rdev->accel_working = true; 3951 rdev->accel_working = true;
3952 return r100_startup(rdev); 3952 r = r100_startup(rdev);
3953 if (r) {
3954 rdev->accel_working = false;
3955 }
3956 return r;
3953} 3957}
3954 3958
3955int r100_suspend(struct radeon_device *rdev) 3959int r100_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 3fc0d29a5f39..6829638cca40 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1431,6 +1431,8 @@ static int r300_startup(struct radeon_device *rdev)
1431 1431
1432int r300_resume(struct radeon_device *rdev) 1432int r300_resume(struct radeon_device *rdev)
1433{ 1433{
1434 int r;
1435
1434 /* Make sur GART are not working */ 1436 /* Make sur GART are not working */
1435 if (rdev->flags & RADEON_IS_PCIE) 1437 if (rdev->flags & RADEON_IS_PCIE)
1436 rv370_pcie_gart_disable(rdev); 1438 rv370_pcie_gart_disable(rdev);
@@ -1452,7 +1454,11 @@ int r300_resume(struct radeon_device *rdev)
1452 radeon_surface_init(rdev); 1454 radeon_surface_init(rdev);
1453 1455
1454 rdev->accel_working = true; 1456 rdev->accel_working = true;
1455 return r300_startup(rdev); 1457 r = r300_startup(rdev);
1458 if (r) {
1459 rdev->accel_working = false;
1460 }
1461 return r;
1456} 1462}
1457 1463
1458int r300_suspend(struct radeon_device *rdev) 1464int r300_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 666e28fe509c..b14323053bad 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -291,6 +291,8 @@ static int r420_startup(struct radeon_device *rdev)
291 291
292int r420_resume(struct radeon_device *rdev) 292int r420_resume(struct radeon_device *rdev)
293{ 293{
294 int r;
295
294 /* Make sur GART are not working */ 296 /* Make sur GART are not working */
295 if (rdev->flags & RADEON_IS_PCIE) 297 if (rdev->flags & RADEON_IS_PCIE)
296 rv370_pcie_gart_disable(rdev); 298 rv370_pcie_gart_disable(rdev);
@@ -316,7 +318,11 @@ int r420_resume(struct radeon_device *rdev)
316 radeon_surface_init(rdev); 318 radeon_surface_init(rdev);
317 319
318 rdev->accel_working = true; 320 rdev->accel_working = true;
319 return r420_startup(rdev); 321 r = r420_startup(rdev);
322 if (r) {
323 rdev->accel_working = false;
324 }
325 return r;
320} 326}
321 327
322int r420_suspend(struct radeon_device *rdev) 328int r420_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 4ae1615e752f..25084e824dbc 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -218,6 +218,8 @@ static int r520_startup(struct radeon_device *rdev)
218 218
219int r520_resume(struct radeon_device *rdev) 219int r520_resume(struct radeon_device *rdev)
220{ 220{
221 int r;
222
221 /* Make sur GART are not working */ 223 /* Make sur GART are not working */
222 if (rdev->flags & RADEON_IS_PCIE) 224 if (rdev->flags & RADEON_IS_PCIE)
223 rv370_pcie_gart_disable(rdev); 225 rv370_pcie_gart_disable(rdev);
@@ -237,7 +239,11 @@ int r520_resume(struct radeon_device *rdev)
237 radeon_surface_init(rdev); 239 radeon_surface_init(rdev);
238 240
239 rdev->accel_working = true; 241 rdev->accel_working = true;
240 return r520_startup(rdev); 242 r = r520_startup(rdev);
243 if (r) {
244 rdev->accel_working = false;
245 }
246 return r;
241} 247}
242 248
243int r520_init(struct radeon_device *rdev) 249int r520_init(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 4f08e5e6ee9d..17ca72ce3027 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2362,6 +2362,9 @@ void r600_semaphore_ring_emit(struct radeon_device *rdev,
2362 uint64_t addr = semaphore->gpu_addr; 2362 uint64_t addr = semaphore->gpu_addr;
2363 unsigned sel = emit_wait ? PACKET3_SEM_SEL_WAIT : PACKET3_SEM_SEL_SIGNAL; 2363 unsigned sel = emit_wait ? PACKET3_SEM_SEL_WAIT : PACKET3_SEM_SEL_SIGNAL;
2364 2364
2365 if (rdev->family < CHIP_CAYMAN)
2366 sel |= PACKET3_SEM_WAIT_ON_SIGNAL;
2367
2365 radeon_ring_write(ring, PACKET3(PACKET3_MEM_SEMAPHORE, 1)); 2368 radeon_ring_write(ring, PACKET3(PACKET3_MEM_SEMAPHORE, 1));
2366 radeon_ring_write(ring, addr & 0xffffffff); 2369 radeon_ring_write(ring, addr & 0xffffffff);
2367 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); 2370 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel);
@@ -2529,6 +2532,7 @@ int r600_resume(struct radeon_device *rdev)
2529 r = r600_startup(rdev); 2532 r = r600_startup(rdev);
2530 if (r) { 2533 if (r) {
2531 DRM_ERROR("r600 startup failed on resume\n"); 2534 DRM_ERROR("r600 startup failed on resume\n");
2535 rdev->accel_working = false;
2532 return r; 2536 return r;
2533 } 2537 }
2534 2538
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index d996f4381130..accc032c103f 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -468,27 +468,42 @@ set_default_state(struct radeon_device *rdev)
468 radeon_ring_write(ring, sq_stack_resource_mgmt_2); 468 radeon_ring_write(ring, sq_stack_resource_mgmt_2);
469} 469}
470 470
471#define I2F_MAX_BITS 15
472#define I2F_MAX_INPUT ((1 << I2F_MAX_BITS) - 1)
473#define I2F_SHIFT (24 - I2F_MAX_BITS)
474
475/*
476 * Converts unsigned integer into 32-bit IEEE floating point representation.
477 * Conversion is not universal and only works for the range from 0
478 * to 2^I2F_MAX_BITS-1. Currently we only use it with inputs between
479 * 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough. If necessary,
480 * I2F_MAX_BITS can be increased, but that will add to the loop iterations
481 * and slow us down. Conversion is done by shifting the input and counting
482 * down until the first 1 reaches bit position 23. The resulting counter
483 * and the shifted input are, respectively, the exponent and the fraction.
484 * The sign is always zero.
485 */
471static uint32_t i2f(uint32_t input) 486static uint32_t i2f(uint32_t input)
472{ 487{
473 u32 result, i, exponent, fraction; 488 u32 result, i, exponent, fraction;
474 489
475 if ((input & 0x3fff) == 0) 490 WARN_ON_ONCE(input > I2F_MAX_INPUT);
476 result = 0; /* 0 is a special case */ 491
492 if ((input & I2F_MAX_INPUT) == 0)
493 result = 0;
477 else { 494 else {
478 exponent = 140; /* exponent biased by 127; */ 495 exponent = 126 + I2F_MAX_BITS;
479 fraction = (input & 0x3fff) << 10; /* cheat and only 496 fraction = (input & I2F_MAX_INPUT) << I2F_SHIFT;
480 handle numbers below 2^^15 */ 497
481 for (i = 0; i < 14; i++) { 498 for (i = 0; i < I2F_MAX_BITS; i++) {
482 if (fraction & 0x800000) 499 if (fraction & 0x800000)
483 break; 500 break;
484 else { 501 else {
485 fraction = fraction << 1; /* keep 502 fraction = fraction << 1;
486 shifting left until top bit = 1 */
487 exponent = exponent - 1; 503 exponent = exponent - 1;
488 } 504 }
489 } 505 }
490 result = exponent << 23 | (fraction & 0x7fffff); /* mask 506 result = exponent << 23 | (fraction & 0x7fffff);
491 off top bit; assumed 1 */
492 } 507 }
493 return result; 508 return result;
494} 509}
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.c b/drivers/gpu/drm/radeon/r600_blit_shaders.c
index 2d1f6c5ee2a7..73e2c7c6edbc 100644
--- a/drivers/gpu/drm/radeon/r600_blit_shaders.c
+++ b/drivers/gpu/drm/radeon/r600_blit_shaders.c
@@ -314,6 +314,10 @@ const u32 r6xx_default_state[] =
314 0x00000000, /* VGT_VTX_CNT_EN */ 314 0x00000000, /* VGT_VTX_CNT_EN */
315 315
316 0xc0016900, 316 0xc0016900,
317 0x000000d4,
318 0x00000000, /* SX_MISC */
319
320 0xc0016900,
317 0x000002c8, 321 0x000002c8,
318 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ 322 0x00000000, /* VGT_STRMOUT_BUFFER_EN */
319 323
@@ -626,6 +630,10 @@ const u32 r7xx_default_state[] =
626 0x00000000, /* VGT_VTX_CNT_EN */ 630 0x00000000, /* VGT_VTX_CNT_EN */
627 631
628 0xc0016900, 632 0xc0016900,
633 0x000000d4,
634 0x00000000, /* SX_MISC */
635
636 0xc0016900,
629 0x000002c8, 637 0x000002c8,
630 0x00000000, /* VGT_STRMOUT_BUFFER_EN */ 638 0x00000000, /* VGT_STRMOUT_BUFFER_EN */
631 639
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 38ce5d0427e3..387fcc9f03ef 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1304 h0 = G_038004_TEX_HEIGHT(word1) + 1; 1304 h0 = G_038004_TEX_HEIGHT(word1) + 1;
1305 d0 = G_038004_TEX_DEPTH(word1); 1305 d0 = G_038004_TEX_DEPTH(word1);
1306 nfaces = 1; 1306 nfaces = 1;
1307 array = 0;
1307 switch (G_038000_DIM(word0)) { 1308 switch (G_038000_DIM(word0)) {
1308 case V_038000_SQ_TEX_DIM_1D: 1309 case V_038000_SQ_TEX_DIM_1D:
1309 case V_038000_SQ_TEX_DIM_2D: 1310 case V_038000_SQ_TEX_DIM_2D:
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 3ee1fd7ef394..9b23670716f1 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -831,6 +831,7 @@
831#define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 831#define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
832#define PACKET3_INDIRECT_BUFFER_MP 0x38 832#define PACKET3_INDIRECT_BUFFER_MP 0x38
833#define PACKET3_MEM_SEMAPHORE 0x39 833#define PACKET3_MEM_SEMAPHORE 0x39
834# define PACKET3_SEM_WAIT_ON_SIGNAL (0x1 << 12)
834# define PACKET3_SEM_SEL_SIGNAL (0x6 << 29) 835# define PACKET3_SEM_SEL_SIGNAL (0x6 << 29)
835# define PACKET3_SEM_SEL_WAIT (0x7 << 29) 836# define PACKET3_SEM_SEL_WAIT (0x7 << 29)
836#define PACKET3_MPEG_INDEX 0x3A 837#define PACKET3_MPEG_INDEX 0x3A
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 5082d17d14dc..1f53ae74ada1 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -2931,6 +2931,20 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
2931 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5; 2931 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5;
2932 } 2932 }
2933 } 2933 }
2934 if ((radeon_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) &&
2935 (radeon_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) {
2936 if (connected) {
2937 DRM_DEBUG_KMS("DFP6 connected\n");
2938 bios_0_scratch |= ATOM_S0_DFP6;
2939 bios_3_scratch |= ATOM_S3_DFP6_ACTIVE;
2940 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP6;
2941 } else {
2942 DRM_DEBUG_KMS("DFP6 disconnected\n");
2943 bios_0_scratch &= ~ATOM_S0_DFP6;
2944 bios_3_scratch &= ~ATOM_S3_DFP6_ACTIVE;
2945 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP6;
2946 }
2947 }
2934 2948
2935 if (rdev->family >= CHIP_R600) { 2949 if (rdev->family >= CHIP_R600) {
2936 WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch); 2950 WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch);
@@ -2951,6 +2965,9 @@ radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc)
2951 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 2965 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
2952 uint32_t bios_3_scratch; 2966 uint32_t bios_3_scratch;
2953 2967
2968 if (ASIC_IS_DCE4(rdev))
2969 return;
2970
2954 if (rdev->family >= CHIP_R600) 2971 if (rdev->family >= CHIP_R600)
2955 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH); 2972 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH);
2956 else 2973 else
@@ -3003,6 +3020,9 @@ radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on)
3003 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 3020 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
3004 uint32_t bios_2_scratch; 3021 uint32_t bios_2_scratch;
3005 3022
3023 if (ASIC_IS_DCE4(rdev))
3024 return;
3025
3006 if (rdev->family >= CHIP_R600) 3026 if (rdev->family >= CHIP_R600)
3007 bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH); 3027 bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH);
3008 else 3028 else
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index 13ac63ba6075..98724fcb0088 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -59,8 +59,9 @@ static int radeon_atrm_call(acpi_handle atrm_handle, uint8_t *bios,
59 59
60 obj = (union acpi_object *)buffer.pointer; 60 obj = (union acpi_object *)buffer.pointer;
61 memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length); 61 memcpy(bios+offset, obj->buffer.pointer, obj->buffer.length);
62 len = obj->buffer.length;
62 kfree(buffer.pointer); 63 kfree(buffer.pointer);
63 return obj->buffer.length; 64 return len;
64} 65}
65 66
66bool radeon_atrm_supported(struct pci_dev *pdev) 67bool radeon_atrm_supported(struct pci_dev *pdev)
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e7cb3ab09243..8c9a8115b632 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1057,7 +1057,7 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector,
1057 (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) 1057 (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B))
1058 return MODE_OK; 1058 return MODE_OK;
1059 else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) { 1059 else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) {
1060 if (ASIC_IS_DCE3(rdev)) { 1060 if (0) {
1061 /* HDMI 1.3+ supports max clock of 340 Mhz */ 1061 /* HDMI 1.3+ supports max clock of 340 Mhz */
1062 if (mode->clock > 340000) 1062 if (mode->clock > 340000)
1063 return MODE_CLOCK_HIGH; 1063 return MODE_CLOCK_HIGH;
@@ -1117,13 +1117,23 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { 1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
1118 struct drm_display_mode *mode; 1118 struct drm_display_mode *mode;
1119 1119
1120 if (!radeon_dig_connector->edp_on) 1120 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
1121 atombios_set_edp_panel_power(connector, 1121 if (!radeon_dig_connector->edp_on)
1122 ATOM_TRANSMITTER_ACTION_POWER_ON); 1122 atombios_set_edp_panel_power(connector,
1123 ret = radeon_ddc_get_modes(radeon_connector); 1123 ATOM_TRANSMITTER_ACTION_POWER_ON);
1124 if (!radeon_dig_connector->edp_on) 1124 ret = radeon_ddc_get_modes(radeon_connector);
1125 atombios_set_edp_panel_power(connector, 1125 if (!radeon_dig_connector->edp_on)
1126 ATOM_TRANSMITTER_ACTION_POWER_OFF); 1126 atombios_set_edp_panel_power(connector,
1127 ATOM_TRANSMITTER_ACTION_POWER_OFF);
1128 } else {
1129 /* need to setup ddc on the bridge */
1130 if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
1131 ENCODER_OBJECT_ID_NONE) {
1132 if (encoder)
1133 radeon_atom_ext_encoder_setup_ddc(encoder);
1134 }
1135 ret = radeon_ddc_get_modes(radeon_connector);
1136 }
1127 1137
1128 if (ret > 0) { 1138 if (ret > 0) {
1129 if (encoder) { 1139 if (encoder) {
@@ -1134,7 +1144,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1134 return ret; 1144 return ret;
1135 } 1145 }
1136 1146
1137 encoder = radeon_best_single_encoder(connector);
1138 if (!encoder) 1147 if (!encoder)
1139 return 0; 1148 return 0;
1140 1149
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 435a3d970ab8..e64bec488ed8 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -453,6 +453,10 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
453 int r; 453 int r;
454 454
455 radeon_mutex_lock(&rdev->cs_mutex); 455 radeon_mutex_lock(&rdev->cs_mutex);
456 if (!rdev->accel_working) {
457 radeon_mutex_unlock(&rdev->cs_mutex);
458 return -EBUSY;
459 }
456 /* initialize parser */ 460 /* initialize parser */
457 memset(&parser, 0, sizeof(struct radeon_cs_parser)); 461 memset(&parser, 0, sizeof(struct radeon_cs_parser));
458 parser.filp = filp; 462 parser.filp = filp;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index cec51a5b69dd..49f7cb7e226b 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -883,6 +883,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
883 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) 883 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
884 return 0; 884 return 0;
885 885
886 drm_kms_helper_poll_disable(dev);
887
886 /* turn off display hw */ 888 /* turn off display hw */
887 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 889 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
888 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); 890 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
@@ -972,6 +974,8 @@ int radeon_resume_kms(struct drm_device *dev)
972 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 974 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
973 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); 975 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
974 } 976 }
977
978 drm_kms_helper_poll_enable(dev);
975 return 0; 979 return 0;
976} 980}
977 981
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 8c49fef1ce78..3d314338d843 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1078,15 +1078,21 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = {
1078 .create_handle = radeon_user_framebuffer_create_handle, 1078 .create_handle = radeon_user_framebuffer_create_handle,
1079}; 1079};
1080 1080
1081void 1081int
1082radeon_framebuffer_init(struct drm_device *dev, 1082radeon_framebuffer_init(struct drm_device *dev,
1083 struct radeon_framebuffer *rfb, 1083 struct radeon_framebuffer *rfb,
1084 struct drm_mode_fb_cmd2 *mode_cmd, 1084 struct drm_mode_fb_cmd2 *mode_cmd,
1085 struct drm_gem_object *obj) 1085 struct drm_gem_object *obj)
1086{ 1086{
1087 int ret;
1087 rfb->obj = obj; 1088 rfb->obj = obj;
1088 drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs); 1089 ret = drm_framebuffer_init(dev, &rfb->base, &radeon_fb_funcs);
1090 if (ret) {
1091 rfb->obj = NULL;
1092 return ret;
1093 }
1089 drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd); 1094 drm_helper_mode_fill_fb_struct(&rfb->base, mode_cmd);
1095 return 0;
1090} 1096}
1091 1097
1092static struct drm_framebuffer * 1098static struct drm_framebuffer *
@@ -1096,6 +1102,7 @@ radeon_user_framebuffer_create(struct drm_device *dev,
1096{ 1102{
1097 struct drm_gem_object *obj; 1103 struct drm_gem_object *obj;
1098 struct radeon_framebuffer *radeon_fb; 1104 struct radeon_framebuffer *radeon_fb;
1105 int ret;
1099 1106
1100 obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]); 1107 obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
1101 if (obj == NULL) { 1108 if (obj == NULL) {
@@ -1108,7 +1115,12 @@ radeon_user_framebuffer_create(struct drm_device *dev,
1108 if (radeon_fb == NULL) 1115 if (radeon_fb == NULL)
1109 return ERR_PTR(-ENOMEM); 1116 return ERR_PTR(-ENOMEM);
1110 1117
1111 radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); 1118 ret = radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj);
1119 if (ret) {
1120 kfree(radeon_fb);
1121 drm_gem_object_unreference_unlocked(obj);
1122 return NULL;
1123 }
1112 1124
1113 return &radeon_fb->base; 1125 return &radeon_fb->base;
1114} 1126}
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 9419c51bcf50..26e92708d114 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -307,8 +307,6 @@ void radeon_panel_mode_fixup(struct drm_encoder *encoder,
307bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, 307bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
308 u32 pixel_clock) 308 u32 pixel_clock)
309{ 309{
310 struct drm_device *dev = encoder->dev;
311 struct radeon_device *rdev = dev->dev_private;
312 struct drm_connector *connector; 310 struct drm_connector *connector;
313 struct radeon_connector *radeon_connector; 311 struct radeon_connector *radeon_connector;
314 struct radeon_connector_atom_dig *dig_connector; 312 struct radeon_connector_atom_dig *dig_connector;
@@ -326,7 +324,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
326 case DRM_MODE_CONNECTOR_HDMIB: 324 case DRM_MODE_CONNECTOR_HDMIB:
327 if (radeon_connector->use_digital) { 325 if (radeon_connector->use_digital) {
328 /* HDMI 1.3 supports up to 340 Mhz over single link */ 326 /* HDMI 1.3 supports up to 340 Mhz over single link */
329 if (ASIC_IS_DCE3(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { 327 if (0 && drm_detect_hdmi_monitor(radeon_connector->edid)) {
330 if (pixel_clock > 340000) 328 if (pixel_clock > 340000)
331 return true; 329 return true;
332 else 330 else
@@ -348,7 +346,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
348 return false; 346 return false;
349 else { 347 else {
350 /* HDMI 1.3 supports up to 340 Mhz over single link */ 348 /* HDMI 1.3 supports up to 340 Mhz over single link */
351 if (ASIC_IS_DCE3(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { 349 if (0 && drm_detect_hdmi_monitor(radeon_connector->edid)) {
352 if (pixel_clock > 340000) 350 if (pixel_clock > 340000)
353 return true; 351 return true;
354 else 352 else
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index cf2bf35b56b8..195471cf65d3 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -209,6 +209,11 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
209 sizes->surface_depth); 209 sizes->surface_depth);
210 210
211 ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj); 211 ret = radeonfb_create_pinned_object(rfbdev, &mode_cmd, &gobj);
212 if (ret) {
213 DRM_ERROR("failed to create fbcon object %d\n", ret);
214 return ret;
215 }
216
212 rbo = gem_to_radeon_bo(gobj); 217 rbo = gem_to_radeon_bo(gobj);
213 218
214 /* okay we have an object now allocate the framebuffer */ 219 /* okay we have an object now allocate the framebuffer */
@@ -220,7 +225,11 @@ static int radeonfb_create(struct radeon_fbdev *rfbdev,
220 225
221 info->par = rfbdev; 226 info->par = rfbdev;
222 227
223 radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); 228 ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
229 if (ret) {
230 DRM_ERROR("failed to initalise framebuffer %d\n", ret);
231 goto out_unref;
232 }
224 233
225 fb = &rfbdev->rfb.base; 234 fb = &rfbdev->rfb.base;
226 235
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 64ea3dd9e6ff..4bd36a354fbe 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -364,8 +364,10 @@ int radeon_fence_count_emitted(struct radeon_device *rdev, int ring)
364 int not_processed = 0; 364 int not_processed = 0;
365 365
366 read_lock_irqsave(&rdev->fence_lock, irq_flags); 366 read_lock_irqsave(&rdev->fence_lock, irq_flags);
367 if (!rdev->fence_drv[ring].initialized) 367 if (!rdev->fence_drv[ring].initialized) {
368 read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
368 return 0; 369 return 0;
370 }
369 371
370 if (!list_empty(&rdev->fence_drv[ring].emitted)) { 372 if (!list_empty(&rdev->fence_drv[ring].emitted)) {
371 struct list_head *ptr; 373 struct list_head *ptr;
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 010dad8b66ae..c58a036233fb 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -597,13 +597,13 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
597 if (bo_va == NULL) 597 if (bo_va == NULL)
598 return 0; 598 return 0;
599 599
600 list_del(&bo_va->bo_list);
601 mutex_lock(&vm->mutex); 600 mutex_lock(&vm->mutex);
602 radeon_mutex_lock(&rdev->cs_mutex); 601 radeon_mutex_lock(&rdev->cs_mutex);
603 radeon_vm_bo_update_pte(rdev, vm, bo, NULL); 602 radeon_vm_bo_update_pte(rdev, vm, bo, NULL);
604 radeon_mutex_unlock(&rdev->cs_mutex); 603 radeon_mutex_unlock(&rdev->cs_mutex);
605 list_del(&bo_va->vm_list); 604 list_del(&bo_va->vm_list);
606 mutex_unlock(&vm->mutex); 605 mutex_unlock(&vm->mutex);
606 list_del(&bo_va->bo_list);
607 607
608 kfree(bo_va); 608 kfree(bo_va);
609 return 0; 609 return 0;
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index 7bb1b079f480..98a8ad680109 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -897,6 +897,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
897 i2c->rec = *rec; 897 i2c->rec = *rec;
898 i2c->adapter.owner = THIS_MODULE; 898 i2c->adapter.owner = THIS_MODULE;
899 i2c->adapter.class = I2C_CLASS_DDC; 899 i2c->adapter.class = I2C_CLASS_DDC;
900 i2c->adapter.dev.parent = &dev->pdev->dev;
900 i2c->dev = dev; 901 i2c->dev = dev;
901 i2c_set_adapdata(&i2c->adapter, i2c); 902 i2c_set_adapdata(&i2c->adapter, i2c);
902 if (rec->mm_i2c || 903 if (rec->mm_i2c ||
@@ -957,6 +958,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
957 i2c->rec = *rec; 958 i2c->rec = *rec;
958 i2c->adapter.owner = THIS_MODULE; 959 i2c->adapter.owner = THIS_MODULE;
959 i2c->adapter.class = I2C_CLASS_DDC; 960 i2c->adapter.class = I2C_CLASS_DDC;
961 i2c->adapter.dev.parent = &dev->pdev->dev;
960 i2c->dev = dev; 962 i2c->dev = dev;
961 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), 963 snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
962 "Radeon aux bus %s", name); 964 "Radeon aux bus %s", name);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 4330e3253573..8a85598fb242 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -649,7 +649,7 @@ extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
649 u16 blue, int regno); 649 u16 blue, int regno);
650extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 650extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
651 u16 *blue, int regno); 651 u16 *blue, int regno);
652void radeon_framebuffer_init(struct drm_device *dev, 652int radeon_framebuffer_init(struct drm_device *dev,
653 struct radeon_framebuffer *rfb, 653 struct radeon_framebuffer *rfb,
654 struct drm_mode_fb_cmd2 *mode_cmd, 654 struct drm_mode_fb_cmd2 *mode_cmd,
655 struct drm_gem_object *obj); 655 struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 30a4c5014c8b..92c9ea4751fb 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -500,8 +500,11 @@ static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32];
500int radeon_debugfs_ring_init(struct radeon_device *rdev) 500int radeon_debugfs_ring_init(struct radeon_device *rdev)
501{ 501{
502#if defined(CONFIG_DEBUG_FS) 502#if defined(CONFIG_DEBUG_FS)
503 return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, 503 if (rdev->family >= CHIP_CAYMAN)
504 ARRAY_SIZE(radeon_debugfs_ring_info_list)); 504 return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list,
505 ARRAY_SIZE(radeon_debugfs_ring_info_list));
506 else
507 return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, 1);
505#else 508#else
506 return 0; 509 return 0;
507#endif 510#endif
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index b0ce84a20a68..866a05be75f2 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -442,6 +442,8 @@ static int rs400_startup(struct radeon_device *rdev)
442 442
443int rs400_resume(struct radeon_device *rdev) 443int rs400_resume(struct radeon_device *rdev)
444{ 444{
445 int r;
446
445 /* Make sur GART are not working */ 447 /* Make sur GART are not working */
446 rs400_gart_disable(rdev); 448 rs400_gart_disable(rdev);
447 /* Resume clock before doing reset */ 449 /* Resume clock before doing reset */
@@ -462,7 +464,11 @@ int rs400_resume(struct radeon_device *rdev)
462 radeon_surface_init(rdev); 464 radeon_surface_init(rdev);
463 465
464 rdev->accel_working = true; 466 rdev->accel_working = true;
465 return rs400_startup(rdev); 467 r = rs400_startup(rdev);
468 if (r) {
469 rdev->accel_working = false;
470 }
471 return r;
466} 472}
467 473
468int rs400_suspend(struct radeon_device *rdev) 474int rs400_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index ec46eb45e34c..4fc700684dcd 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -684,9 +684,7 @@ int rs600_irq_process(struct radeon_device *rdev)
684 WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM); 684 WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM);
685 break; 685 break;
686 default: 686 default:
687 msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; 687 WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN);
688 WREG32(RADEON_MSI_REARM_EN, msi_rearm);
689 WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN);
690 break; 688 break;
691 } 689 }
692 } 690 }
@@ -878,6 +876,8 @@ static int rs600_startup(struct radeon_device *rdev)
878 876
879int rs600_resume(struct radeon_device *rdev) 877int rs600_resume(struct radeon_device *rdev)
880{ 878{
879 int r;
880
881 /* Make sur GART are not working */ 881 /* Make sur GART are not working */
882 rs600_gart_disable(rdev); 882 rs600_gart_disable(rdev);
883 /* Resume clock before doing reset */ 883 /* Resume clock before doing reset */
@@ -896,7 +896,11 @@ int rs600_resume(struct radeon_device *rdev)
896 radeon_surface_init(rdev); 896 radeon_surface_init(rdev);
897 897
898 rdev->accel_working = true; 898 rdev->accel_working = true;
899 return rs600_startup(rdev); 899 r = rs600_startup(rdev);
900 if (r) {
901 rdev->accel_working = false;
902 }
903 return r;
900} 904}
901 905
902int rs600_suspend(struct radeon_device *rdev) 906int rs600_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 4f24a0fa8c82..f68dff2fadcb 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -659,6 +659,8 @@ static int rs690_startup(struct radeon_device *rdev)
659 659
660int rs690_resume(struct radeon_device *rdev) 660int rs690_resume(struct radeon_device *rdev)
661{ 661{
662 int r;
663
662 /* Make sur GART are not working */ 664 /* Make sur GART are not working */
663 rs400_gart_disable(rdev); 665 rs400_gart_disable(rdev);
664 /* Resume clock before doing reset */ 666 /* Resume clock before doing reset */
@@ -677,7 +679,11 @@ int rs690_resume(struct radeon_device *rdev)
677 radeon_surface_init(rdev); 679 radeon_surface_init(rdev);
678 680
679 rdev->accel_working = true; 681 rdev->accel_working = true;
680 return rs690_startup(rdev); 682 r = rs690_startup(rdev);
683 if (r) {
684 rdev->accel_working = false;
685 }
686 return r;
681} 687}
682 688
683int rs690_suspend(struct radeon_device *rdev) 689int rs690_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 880637fd1946..959bf4483bea 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -424,6 +424,8 @@ static int rv515_startup(struct radeon_device *rdev)
424 424
425int rv515_resume(struct radeon_device *rdev) 425int rv515_resume(struct radeon_device *rdev)
426{ 426{
427 int r;
428
427 /* Make sur GART are not working */ 429 /* Make sur GART are not working */
428 if (rdev->flags & RADEON_IS_PCIE) 430 if (rdev->flags & RADEON_IS_PCIE)
429 rv370_pcie_gart_disable(rdev); 431 rv370_pcie_gart_disable(rdev);
@@ -443,7 +445,11 @@ int rv515_resume(struct radeon_device *rdev)
443 radeon_surface_init(rdev); 445 radeon_surface_init(rdev);
444 446
445 rdev->accel_working = true; 447 rdev->accel_working = true;
446 return rv515_startup(rdev); 448 r = rv515_startup(rdev);
449 if (r) {
450 rdev->accel_working = false;
451 }
452 return r;
447} 453}
448 454
449int rv515_suspend(struct radeon_device *rdev) 455int rv515_suspend(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index a1668b659ddd..c049c0c51841 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1139,6 +1139,7 @@ int rv770_resume(struct radeon_device *rdev)
1139 r = rv770_startup(rdev); 1139 r = rv770_startup(rdev);
1140 if (r) { 1140 if (r) {
1141 DRM_ERROR("r600 startup failed on resume\n"); 1141 DRM_ERROR("r600 startup failed on resume\n");
1142 rdev->accel_working = false;
1142 return r; 1143 return r;
1143 } 1144 }
1144 1145