aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/radeon/evergreen_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/r100.c37
-rw-r--r--drivers/gpu/drm/radeon/r600.c37
-rw-r--r--drivers/gpu/drm/radeon/radeon.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c14
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c100
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h1
8 files changed, 148 insertions, 49 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h
index f7c7c9643433..9dba6d97d9b7 100644
--- a/drivers/gpu/drm/radeon/evergreen_reg.h
+++ b/drivers/gpu/drm/radeon/evergreen_reg.h
@@ -166,6 +166,7 @@
166/* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */ 166/* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
167#define EVERGREEN_CRTC_CONTROL 0x6e70 167#define EVERGREEN_CRTC_CONTROL 0x6e70
168# define EVERGREEN_CRTC_MASTER_EN (1 << 0) 168# define EVERGREEN_CRTC_MASTER_EN (1 << 0)
169#define EVERGREEN_CRTC_STATUS 0x6e8c
169#define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 170#define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4
170 171
171#define EVERGREEN_DC_GPIO_HPD_MASK 0x64b0 172#define EVERGREEN_DC_GPIO_HPD_MASK 0x64b0
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index d35298684f30..b076b96f8b6c 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -67,6 +67,43 @@ MODULE_FIRMWARE(FIRMWARE_R520);
67 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 67 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280
68 */ 68 */
69 69
70void r100_set_power_state(struct radeon_device *rdev)
71{
72 /* if *_clock_mode are the same, *_power_state are as well */
73 if (rdev->pm.requested_clock_mode == rdev->pm.current_clock_mode)
74 return;
75
76 DRM_INFO("Setting: e: %d m: %d p: %d\n",
77 rdev->pm.requested_clock_mode->sclk,
78 rdev->pm.requested_clock_mode->mclk,
79 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);
80
81 /* set pcie lanes */
82 /* TODO */
83
84 /* set voltage */
85 /* TODO */
86
87 /* set engine clock */
88 radeon_sync_with_vblank(rdev);
89 radeon_pm_debug_check_in_vbl(rdev, false);
90 radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);
91 radeon_pm_debug_check_in_vbl(rdev, true);
92
93#if 0
94 /* set memory clock */
95 if (rdev->asic->set_memory_clock) {
96 radeon_sync_with_vblank(rdev);
97 radeon_pm_debug_check_in_vbl(rdev, false);
98 radeon_set_memory_clock(rdev, rdev->pm.requested_clock_mode->mclk);
99 radeon_pm_debug_check_in_vbl(rdev, true);
100 }
101#endif
102
103 rdev->pm.current_power_state = rdev->pm.requested_power_state;
104 rdev->pm.current_clock_mode = rdev->pm.requested_clock_mode;
105}
106
70bool r100_gui_idle(struct radeon_device *rdev) 107bool r100_gui_idle(struct radeon_device *rdev)
71{ 108{
72 if (RREG32(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE) 109 if (RREG32(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 094c29dd96e3..c2d1946535ab 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -92,6 +92,43 @@ void r600_gpu_init(struct radeon_device *rdev);
92void r600_fini(struct radeon_device *rdev); 92void r600_fini(struct radeon_device *rdev);
93void r600_irq_disable(struct radeon_device *rdev); 93void r600_irq_disable(struct radeon_device *rdev);
94 94
95void r600_set_power_state(struct radeon_device *rdev)
96{
97 /* if *_clock_mode are the same, *_power_state are as well */
98 if (rdev->pm.requested_clock_mode == rdev->pm.current_clock_mode)
99 return;
100
101 DRM_INFO("Setting: e: %d m: %d p: %d\n",
102 rdev->pm.requested_clock_mode->sclk,
103 rdev->pm.requested_clock_mode->mclk,
104 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);
105
106 /* set pcie lanes */
107 /* TODO */
108
109 /* set voltage */
110 /* TODO */
111
112 /* set engine clock */
113 radeon_sync_with_vblank(rdev);
114 radeon_pm_debug_check_in_vbl(rdev, false);
115 radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);
116 radeon_pm_debug_check_in_vbl(rdev, true);
117
118#if 0
119 /* set memory clock */
120 if (rdev->asic->set_memory_clock) {
121 radeon_sync_with_vblank(rdev);
122 radeon_pm_debug_check_in_vbl(rdev, false);
123 radeon_set_memory_clock(rdev, rdev->pm.requested_clock_mode->mclk);
124 radeon_pm_debug_check_in_vbl(rdev, true);
125 }
126#endif
127
128 rdev->pm.current_power_state = rdev->pm.requested_power_state;
129 rdev->pm.current_clock_mode = rdev->pm.requested_clock_mode;
130}
131
95bool r600_gui_idle(struct radeon_device *rdev) 132bool r600_gui_idle(struct radeon_device *rdev)
96{ 133{
97 if (RREG32(GRBM_STATUS) & GUI_ACTIVE) 134 if (RREG32(GRBM_STATUS) & GUI_ACTIVE)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 433937109afc..11fe1d1444c2 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -175,6 +175,8 @@ void radeon_pm_fini(struct radeon_device *rdev);
175void radeon_pm_compute_clocks(struct radeon_device *rdev); 175void radeon_pm_compute_clocks(struct radeon_device *rdev);
176void radeon_combios_get_power_modes(struct radeon_device *rdev); 176void radeon_combios_get_power_modes(struct radeon_device *rdev);
177void radeon_atombios_get_power_modes(struct radeon_device *rdev); 177void radeon_atombios_get_power_modes(struct radeon_device *rdev);
178bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
179void radeon_sync_with_vblank(struct radeon_device *rdev);
178 180
179/* 181/*
180 * Fences. 182 * Fences.
@@ -808,6 +810,7 @@ struct radeon_asic {
808 */ 810 */
809 void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo); 811 void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
810 bool (*gui_idle)(struct radeon_device *rdev); 812 bool (*gui_idle)(struct radeon_device *rdev);
813 void (*set_power_state)(struct radeon_device *rdev);
811}; 814};
812 815
813/* 816/*
@@ -1215,6 +1218,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
1215#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) 1218#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd))
1216#define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd)) 1219#define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd))
1217#define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev)) 1220#define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev))
1221#define radeon_set_power_state(rdev) (rdev)->asic->set_power_state((rdev))
1218 1222
1219/* Common functions */ 1223/* Common functions */
1220/* AGP */ 1224/* AGP */
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 42708462fd4b..48893fbb6582 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -166,6 +166,7 @@ static struct radeon_asic r100_asic = {
166 .hpd_set_polarity = &r100_hpd_set_polarity, 166 .hpd_set_polarity = &r100_hpd_set_polarity,
167 .ioctl_wait_idle = NULL, 167 .ioctl_wait_idle = NULL,
168 .gui_idle = &r100_gui_idle, 168 .gui_idle = &r100_gui_idle,
169 .set_power_state = &r100_set_power_state,
169}; 170};
170 171
171static struct radeon_asic r200_asic = { 172static struct radeon_asic r200_asic = {
@@ -205,6 +206,7 @@ static struct radeon_asic r200_asic = {
205 .hpd_set_polarity = &r100_hpd_set_polarity, 206 .hpd_set_polarity = &r100_hpd_set_polarity,
206 .ioctl_wait_idle = NULL, 207 .ioctl_wait_idle = NULL,
207 .gui_idle = &r100_gui_idle, 208 .gui_idle = &r100_gui_idle,
209 .set_power_state = &r100_set_power_state,
208}; 210};
209 211
210static struct radeon_asic r300_asic = { 212static struct radeon_asic r300_asic = {
@@ -245,6 +247,7 @@ static struct radeon_asic r300_asic = {
245 .hpd_set_polarity = &r100_hpd_set_polarity, 247 .hpd_set_polarity = &r100_hpd_set_polarity,
246 .ioctl_wait_idle = NULL, 248 .ioctl_wait_idle = NULL,
247 .gui_idle = &r100_gui_idle, 249 .gui_idle = &r100_gui_idle,
250 .set_power_state = &r100_set_power_state,
248}; 251};
249 252
250static struct radeon_asic r300_asic_pcie = { 253static struct radeon_asic r300_asic_pcie = {
@@ -284,6 +287,7 @@ static struct radeon_asic r300_asic_pcie = {
284 .hpd_set_polarity = &r100_hpd_set_polarity, 287 .hpd_set_polarity = &r100_hpd_set_polarity,
285 .ioctl_wait_idle = NULL, 288 .ioctl_wait_idle = NULL,
286 .gui_idle = &r100_gui_idle, 289 .gui_idle = &r100_gui_idle,
290 .set_power_state = &r100_set_power_state,
287}; 291};
288 292
289static struct radeon_asic r420_asic = { 293static struct radeon_asic r420_asic = {
@@ -324,6 +328,7 @@ static struct radeon_asic r420_asic = {
324 .hpd_set_polarity = &r100_hpd_set_polarity, 328 .hpd_set_polarity = &r100_hpd_set_polarity,
325 .ioctl_wait_idle = NULL, 329 .ioctl_wait_idle = NULL,
326 .gui_idle = &r100_gui_idle, 330 .gui_idle = &r100_gui_idle,
331 .set_power_state = &r100_set_power_state,
327}; 332};
328 333
329static struct radeon_asic rs400_asic = { 334static struct radeon_asic rs400_asic = {
@@ -364,6 +369,7 @@ static struct radeon_asic rs400_asic = {
364 .hpd_set_polarity = &r100_hpd_set_polarity, 369 .hpd_set_polarity = &r100_hpd_set_polarity,
365 .ioctl_wait_idle = NULL, 370 .ioctl_wait_idle = NULL,
366 .gui_idle = &r100_gui_idle, 371 .gui_idle = &r100_gui_idle,
372 .set_power_state = &r100_set_power_state,
367}; 373};
368 374
369static struct radeon_asic rs600_asic = { 375static struct radeon_asic rs600_asic = {
@@ -404,6 +410,7 @@ static struct radeon_asic rs600_asic = {
404 .hpd_set_polarity = &rs600_hpd_set_polarity, 410 .hpd_set_polarity = &rs600_hpd_set_polarity,
405 .ioctl_wait_idle = NULL, 411 .ioctl_wait_idle = NULL,
406 .gui_idle = &r100_gui_idle, 412 .gui_idle = &r100_gui_idle,
413 .set_power_state = &r100_set_power_state,
407}; 414};
408 415
409static struct radeon_asic rs690_asic = { 416static struct radeon_asic rs690_asic = {
@@ -444,6 +451,7 @@ static struct radeon_asic rs690_asic = {
444 .hpd_set_polarity = &rs600_hpd_set_polarity, 451 .hpd_set_polarity = &rs600_hpd_set_polarity,
445 .ioctl_wait_idle = NULL, 452 .ioctl_wait_idle = NULL,
446 .gui_idle = &r100_gui_idle, 453 .gui_idle = &r100_gui_idle,
454 .set_power_state = &r100_set_power_state,
447}; 455};
448 456
449static struct radeon_asic rv515_asic = { 457static struct radeon_asic rv515_asic = {
@@ -484,6 +492,7 @@ static struct radeon_asic rv515_asic = {
484 .hpd_set_polarity = &rs600_hpd_set_polarity, 492 .hpd_set_polarity = &rs600_hpd_set_polarity,
485 .ioctl_wait_idle = NULL, 493 .ioctl_wait_idle = NULL,
486 .gui_idle = &r100_gui_idle, 494 .gui_idle = &r100_gui_idle,
495 .set_power_state = &r100_set_power_state,
487}; 496};
488 497
489static struct radeon_asic r520_asic = { 498static struct radeon_asic r520_asic = {
@@ -524,6 +533,7 @@ static struct radeon_asic r520_asic = {
524 .hpd_set_polarity = &rs600_hpd_set_polarity, 533 .hpd_set_polarity = &rs600_hpd_set_polarity,
525 .ioctl_wait_idle = NULL, 534 .ioctl_wait_idle = NULL,
526 .gui_idle = &r100_gui_idle, 535 .gui_idle = &r100_gui_idle,
536 .set_power_state = &r100_set_power_state,
527}; 537};
528 538
529static struct radeon_asic r600_asic = { 539static struct radeon_asic r600_asic = {
@@ -563,6 +573,7 @@ static struct radeon_asic r600_asic = {
563 .hpd_set_polarity = &r600_hpd_set_polarity, 573 .hpd_set_polarity = &r600_hpd_set_polarity,
564 .ioctl_wait_idle = r600_ioctl_wait_idle, 574 .ioctl_wait_idle = r600_ioctl_wait_idle,
565 .gui_idle = &r600_gui_idle, 575 .gui_idle = &r600_gui_idle,
576 .set_power_state = &r600_set_power_state,
566}; 577};
567 578
568static struct radeon_asic rs780_asic = { 579static struct radeon_asic rs780_asic = {
@@ -602,6 +613,7 @@ static struct radeon_asic rs780_asic = {
602 .hpd_set_polarity = &r600_hpd_set_polarity, 613 .hpd_set_polarity = &r600_hpd_set_polarity,
603 .ioctl_wait_idle = r600_ioctl_wait_idle, 614 .ioctl_wait_idle = r600_ioctl_wait_idle,
604 .gui_idle = &r600_gui_idle, 615 .gui_idle = &r600_gui_idle,
616 .set_power_state = &r600_set_power_state,
605}; 617};
606 618
607static struct radeon_asic rv770_asic = { 619static struct radeon_asic rv770_asic = {
@@ -641,6 +653,7 @@ static struct radeon_asic rv770_asic = {
641 .hpd_set_polarity = &r600_hpd_set_polarity, 653 .hpd_set_polarity = &r600_hpd_set_polarity,
642 .ioctl_wait_idle = r600_ioctl_wait_idle, 654 .ioctl_wait_idle = r600_ioctl_wait_idle,
643 .gui_idle = &r600_gui_idle, 655 .gui_idle = &r600_gui_idle,
656 .set_power_state = &r600_set_power_state,
644}; 657};
645 658
646static struct radeon_asic evergreen_asic = { 659static struct radeon_asic evergreen_asic = {
@@ -678,6 +691,7 @@ static struct radeon_asic evergreen_asic = {
678 .hpd_sense = &evergreen_hpd_sense, 691 .hpd_sense = &evergreen_hpd_sense,
679 .hpd_set_polarity = &evergreen_hpd_set_polarity, 692 .hpd_set_polarity = &evergreen_hpd_set_polarity,
680 .gui_idle = &r600_gui_idle, 693 .gui_idle = &r600_gui_idle,
694 .set_power_state = &r600_set_power_state,
681}; 695};
682 696
683int radeon_asic_init(struct radeon_device *rdev) 697int radeon_asic_init(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index c74bf9bd26c2..90d8e6dee52c 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -127,6 +127,8 @@ void r100_enable_bm(struct radeon_device *rdev);
127void r100_set_common_regs(struct radeon_device *rdev); 127void r100_set_common_regs(struct radeon_device *rdev);
128void r100_bm_disable(struct radeon_device *rdev); 128void r100_bm_disable(struct radeon_device *rdev);
129extern bool r100_gui_idle(struct radeon_device *rdev); 129extern bool r100_gui_idle(struct radeon_device *rdev);
130extern void r100_set_power_state(struct radeon_device *rdev);
131
130/* 132/*
131 * r200,rv250,rs300,rv280 133 * r200,rv250,rs300,rv280
132 */ 134 */
@@ -271,6 +273,7 @@ void r600_hpd_set_polarity(struct radeon_device *rdev,
271 enum radeon_hpd_id hpd); 273 enum radeon_hpd_id hpd);
272extern void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo); 274extern void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo);
273extern bool r600_gui_idle(struct radeon_device *rdev); 275extern bool r600_gui_idle(struct radeon_device *rdev);
276extern void r600_set_power_state(struct radeon_device *rdev);
274 277
275/* 278/*
276 * rv770,rv730,rv710,rv740 279 * rv770,rv730,rv710,rv740
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index ff3abd8c8966..129956d003a4 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -29,7 +29,6 @@
29#define RADEON_WAIT_VBLANK_TIMEOUT 200 29#define RADEON_WAIT_VBLANK_TIMEOUT 200
30#define RADEON_WAIT_IDLE_TIMEOUT 200 30#define RADEON_WAIT_IDLE_TIMEOUT 200
31 31
32static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
33static void radeon_pm_set_clocks_locked(struct radeon_device *rdev); 32static void radeon_pm_set_clocks_locked(struct radeon_device *rdev);
34static void radeon_pm_set_clocks(struct radeon_device *rdev); 33static void radeon_pm_set_clocks(struct radeon_device *rdev);
35static void radeon_pm_idle_work_handler(struct work_struct *work); 34static void radeon_pm_idle_work_handler(struct work_struct *work);
@@ -181,7 +180,7 @@ static void radeon_get_power_state(struct radeon_device *rdev,
181 rdev->pm.requested_power_state->non_clock_info.pcie_lanes); 180 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);
182} 181}
183 182
184static inline void radeon_sync_with_vblank(struct radeon_device *rdev) 183void radeon_sync_with_vblank(struct radeon_device *rdev)
185{ 184{
186 if (rdev->pm.active_crtcs) { 185 if (rdev->pm.active_crtcs) {
187 rdev->pm.vblank_sync = false; 186 rdev->pm.vblank_sync = false;
@@ -191,43 +190,6 @@ static inline void radeon_sync_with_vblank(struct radeon_device *rdev)
191 } 190 }
192} 191}
193 192
194static void radeon_set_power_state(struct radeon_device *rdev)
195{
196 /* if *_clock_mode are the same, *_power_state are as well */
197 if (rdev->pm.requested_clock_mode == rdev->pm.current_clock_mode)
198 return;
199
200 DRM_INFO("Setting: e: %d m: %d p: %d\n",
201 rdev->pm.requested_clock_mode->sclk,
202 rdev->pm.requested_clock_mode->mclk,
203 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);
204
205 /* set pcie lanes */
206 /* TODO */
207
208 /* set voltage */
209 /* TODO */
210
211 /* set engine clock */
212 radeon_sync_with_vblank(rdev);
213 radeon_pm_debug_check_in_vbl(rdev, false);
214 radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);
215 radeon_pm_debug_check_in_vbl(rdev, true);
216
217#if 0
218 /* set memory clock */
219 if (rdev->asic->set_memory_clock) {
220 radeon_sync_with_vblank(rdev);
221 radeon_pm_debug_check_in_vbl(rdev, false);
222 radeon_set_memory_clock(rdev, rdev->pm.requested_clock_mode->mclk);
223 radeon_pm_debug_check_in_vbl(rdev, true);
224 }
225#endif
226
227 rdev->pm.current_power_state = rdev->pm.requested_power_state;
228 rdev->pm.current_clock_mode = rdev->pm.requested_clock_mode;
229}
230
231int radeon_pm_init(struct radeon_device *rdev) 193int radeon_pm_init(struct radeon_device *rdev)
232{ 194{
233 rdev->pm.state = PM_STATE_DISABLED; 195 rdev->pm.state = PM_STATE_DISABLED;
@@ -330,26 +292,68 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
330 mutex_unlock(&rdev->pm.mutex); 292 mutex_unlock(&rdev->pm.mutex);
331} 293}
332 294
333static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish) 295bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
334{ 296{
335 u32 stat_crtc1 = 0, stat_crtc2 = 0; 297 u32 stat_crtc = 0;
336 bool in_vbl = true; 298 bool in_vbl = true;
337 299
338 if (ASIC_IS_AVIVO(rdev)) { 300 if (ASIC_IS_DCE4(rdev)) {
301 if (rdev->pm.active_crtcs & (1 << 0)) {
302 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC0_REGISTER_OFFSET);
303 if (!(stat_crtc & 1))
304 in_vbl = false;
305 }
306 if (rdev->pm.active_crtcs & (1 << 1)) {
307 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC1_REGISTER_OFFSET);
308 if (!(stat_crtc & 1))
309 in_vbl = false;
310 }
311 if (rdev->pm.active_crtcs & (1 << 2)) {
312 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC2_REGISTER_OFFSET);
313 if (!(stat_crtc & 1))
314 in_vbl = false;
315 }
316 if (rdev->pm.active_crtcs & (1 << 3)) {
317 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC3_REGISTER_OFFSET);
318 if (!(stat_crtc & 1))
319 in_vbl = false;
320 }
321 if (rdev->pm.active_crtcs & (1 << 4)) {
322 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC4_REGISTER_OFFSET);
323 if (!(stat_crtc & 1))
324 in_vbl = false;
325 }
326 if (rdev->pm.active_crtcs & (1 << 5)) {
327 stat_crtc = RREG32(EVERGREEN_CRTC_STATUS + EVERGREEN_CRTC5_REGISTER_OFFSET);
328 if (!(stat_crtc & 1))
329 in_vbl = false;
330 }
331 } else if (ASIC_IS_AVIVO(rdev)) {
332 if (rdev->pm.active_crtcs & (1 << 0)) {
333 stat_crtc = RREG32(D1CRTC_STATUS);
334 if (!(stat_crtc & 1))
335 in_vbl = false;
336 }
337 if (rdev->pm.active_crtcs & (1 << 1)) {
338 stat_crtc = RREG32(D2CRTC_STATUS);
339 if (!(stat_crtc & 1))
340 in_vbl = false;
341 }
342 } else {
339 if (rdev->pm.active_crtcs & (1 << 0)) { 343 if (rdev->pm.active_crtcs & (1 << 0)) {
340 stat_crtc1 = RREG32(D1CRTC_STATUS); 344 stat_crtc = RREG32(RADEON_CRTC_STATUS);
341 if (!(stat_crtc1 & 1)) 345 if (!(stat_crtc & 1))
342 in_vbl = false; 346 in_vbl = false;
343 } 347 }
344 if (rdev->pm.active_crtcs & (1 << 1)) { 348 if (rdev->pm.active_crtcs & (1 << 1)) {
345 stat_crtc2 = RREG32(D2CRTC_STATUS); 349 stat_crtc = RREG32(RADEON_CRTC2_STATUS);
346 if (!(stat_crtc2 & 1)) 350 if (!(stat_crtc & 1))
347 in_vbl = false; 351 in_vbl = false;
348 } 352 }
349 } 353 }
350 if (in_vbl == false) 354 if (in_vbl == false)
351 DRM_INFO("not in vbl for pm change %08x %08x at %s\n", stat_crtc1, 355 DRM_INFO("not in vbl for pm change %08x at %s\n", stat_crtc,
352 stat_crtc2, finish ? "exit" : "entry"); 356 finish ? "exit" : "entry");
353 return in_vbl; 357 return in_vbl;
354} 358}
355static void radeon_pm_set_clocks_locked(struct radeon_device *rdev) 359static void radeon_pm_set_clocks_locked(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index 74d1cbfa23a1..c332f46340d5 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -553,7 +553,6 @@
553# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16) 553# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16)
554#define RADEON_CRTC2_CRNT_FRAME 0x0314 554#define RADEON_CRTC2_CRNT_FRAME 0x0314
555#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318 555#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318
556#define RADEON_CRTC2_STATUS 0x03fc
557#define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310 556#define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310
558#define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */ 557#define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */
559#define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */ 558#define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */