aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/evergreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/evergreen.c')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c119
1 files changed, 54 insertions, 65 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 941080a77940..e9bc135d9189 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -43,17 +43,6 @@ static void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
43 43
44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) 44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
45{ 45{
46 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
47 u32 tmp;
48
49 /* make sure flip is at vb rather than hb */
50 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
51 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
52 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
53
54 /* set pageflip to happen anywhere in vblank interval */
55 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
56
57 /* enable the pflip int */ 46 /* enable the pflip int */
58 radeon_irq_kms_pflip_irq_get(rdev, crtc); 47 radeon_irq_kms_pflip_irq_get(rdev, crtc);
59} 48}
@@ -131,11 +120,16 @@ void evergreen_pm_misc(struct radeon_device *rdev)
131 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; 120 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
132 struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; 121 struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
133 122
134 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { 123 if (voltage->type == VOLTAGE_SW) {
135 if (voltage->voltage != rdev->pm.current_vddc) { 124 if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) {
136 radeon_atom_set_voltage(rdev, voltage->voltage); 125 radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
137 rdev->pm.current_vddc = voltage->voltage; 126 rdev->pm.current_vddc = voltage->voltage;
138 DRM_DEBUG("Setting: v: %d\n", voltage->voltage); 127 DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage);
128 }
129 if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) {
130 radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI);
131 rdev->pm.current_vddci = voltage->vddci;
132 DRM_DEBUG("Setting: vddci: %d\n", voltage->vddci);
139 } 133 }
140 } 134 }
141} 135}
@@ -359,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
359 struct drm_display_mode *mode, 353 struct drm_display_mode *mode,
360 struct drm_display_mode *other_mode) 354 struct drm_display_mode *other_mode)
361{ 355{
362 u32 tmp = 0; 356 u32 tmp;
363 /* 357 /*
364 * Line Buffer Setup 358 * Line Buffer Setup
365 * There are 3 line buffers, each one shared by 2 display controllers. 359 * There are 3 line buffers, each one shared by 2 display controllers.
@@ -369,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
369 * first display controller 363 * first display controller
370 * 0 - first half of lb (3840 * 2) 364 * 0 - first half of lb (3840 * 2)
371 * 1 - first 3/4 of lb (5760 * 2) 365 * 1 - first 3/4 of lb (5760 * 2)
372 * 2 - whole lb (7680 * 2) 366 * 2 - whole lb (7680 * 2), other crtc must be disabled
373 * 3 - first 1/4 of lb (1920 * 2) 367 * 3 - first 1/4 of lb (1920 * 2)
374 * second display controller 368 * second display controller
375 * 4 - second half of lb (3840 * 2) 369 * 4 - second half of lb (3840 * 2)
376 * 5 - second 3/4 of lb (5760 * 2) 370 * 5 - second 3/4 of lb (5760 * 2)
377 * 6 - whole lb (7680 * 2) 371 * 6 - whole lb (7680 * 2), other crtc must be disabled
378 * 7 - last 1/4 of lb (1920 * 2) 372 * 7 - last 1/4 of lb (1920 * 2)
379 */ 373 */
380 if (mode && other_mode) { 374 /* this can get tricky if we have two large displays on a paired group
381 if (mode->hdisplay > other_mode->hdisplay) { 375 * of crtcs. Ideally for multiple large displays we'd assign them to
382 if (mode->hdisplay > 2560) 376 * non-linked crtcs for maximum line buffer allocation.
383 tmp = 1; /* 3/4 */ 377 */
384 else 378 if (radeon_crtc->base.enabled && mode) {
385 tmp = 0; /* 1/2 */ 379 if (other_mode)
386 } else if (other_mode->hdisplay > mode->hdisplay) {
387 if (other_mode->hdisplay > 2560)
388 tmp = 3; /* 1/4 */
389 else
390 tmp = 0; /* 1/2 */
391 } else
392 tmp = 0; /* 1/2 */ 380 tmp = 0; /* 1/2 */
393 } else if (mode) 381 else
394 tmp = 2; /* whole */ 382 tmp = 2; /* whole */
395 else if (other_mode) 383 } else
396 tmp = 3; /* 1/4 */ 384 tmp = 0;
397 385
398 /* second controller of the pair uses second half of the lb */ 386 /* second controller of the pair uses second half of the lb */
399 if (radeon_crtc->crtc_id % 2) 387 if (radeon_crtc->crtc_id % 2)
400 tmp += 4; 388 tmp += 4;
401 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); 389 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp);
402 390
403 switch (tmp) { 391 if (radeon_crtc->base.enabled && mode) {
404 case 0: 392 switch (tmp) {
405 case 4: 393 case 0:
406 default: 394 case 4:
407 if (ASIC_IS_DCE5(rdev)) 395 default:
408 return 4096 * 2; 396 if (ASIC_IS_DCE5(rdev))
409 else 397 return 4096 * 2;
410 return 3840 * 2; 398 else
411 case 1: 399 return 3840 * 2;
412 case 5: 400 case 1:
413 if (ASIC_IS_DCE5(rdev)) 401 case 5:
414 return 6144 * 2; 402 if (ASIC_IS_DCE5(rdev))
415 else 403 return 6144 * 2;
416 return 5760 * 2; 404 else
417 case 2: 405 return 5760 * 2;
418 case 6: 406 case 2:
419 if (ASIC_IS_DCE5(rdev)) 407 case 6:
420 return 8192 * 2; 408 if (ASIC_IS_DCE5(rdev))
421 else 409 return 8192 * 2;
422 return 7680 * 2; 410 else
423 case 3: 411 return 7680 * 2;
424 case 7: 412 case 3:
425 if (ASIC_IS_DCE5(rdev)) 413 case 7:
426 return 2048 * 2; 414 if (ASIC_IS_DCE5(rdev))
427 else 415 return 2048 * 2;
428 return 1920 * 2; 416 else
417 return 1920 * 2;
418 }
429 } 419 }
420
421 /* controller not enabled, so no lb used */
422 return 0;
430} 423}
431 424
432static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) 425static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev)
@@ -2587,7 +2580,7 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
2587 u32 wptr, tmp; 2580 u32 wptr, tmp;
2588 2581
2589 if (rdev->wb.enabled) 2582 if (rdev->wb.enabled)
2590 wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; 2583 wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]);
2591 else 2584 else
2592 wptr = RREG32(IH_RB_WPTR); 2585 wptr = RREG32(IH_RB_WPTR);
2593 2586
@@ -3047,9 +3040,6 @@ int evergreen_init(struct radeon_device *rdev)
3047{ 3040{
3048 int r; 3041 int r;
3049 3042
3050 r = radeon_dummy_page_init(rdev);
3051 if (r)
3052 return r;
3053 /* This don't do much */ 3043 /* This don't do much */
3054 r = radeon_gem_init(rdev); 3044 r = radeon_gem_init(rdev);
3055 if (r) 3045 if (r)
@@ -3161,7 +3151,6 @@ void evergreen_fini(struct radeon_device *rdev)
3161 radeon_atombios_fini(rdev); 3151 radeon_atombios_fini(rdev);
3162 kfree(rdev->bios); 3152 kfree(rdev->bios);
3163 rdev->bios = NULL; 3153 rdev->bios = NULL;
3164 radeon_dummy_page_fini(rdev);
3165} 3154}
3166 3155
3167static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) 3156static void evergreen_pcie_gen2_enable(struct radeon_device *rdev)