diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-07-17 14:02:42 -0400 |
---|---|---|
committer | Christian König <deathsimple@vodafone.de> | 2012-07-18 07:53:41 -0400 |
commit | 377edc8bbd34f177d4ad7113ef70b76ed278fa94 (patch) | |
tree | 73fbfbb285e059d8581cee12cb9005d0ff329a26 /drivers/gpu/drm | |
parent | 48ef779ff32561c2ed780808fcd0ab4633df22bd (diff) |
drm/radeon: start to document evergreen.c
Still a lot to do.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 870009ad5f56..08293f1ba6aa 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -99,6 +99,14 @@ void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev) | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | /** | ||
103 | * dce4_wait_for_vblank - vblank wait asic callback. | ||
104 | * | ||
105 | * @rdev: radeon_device pointer | ||
106 | * @crtc: crtc to wait for vblank on | ||
107 | * | ||
108 | * Wait for vblank on the requested crtc (evergreen+). | ||
109 | */ | ||
102 | void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc) | 110 | void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc) |
103 | { | 111 | { |
104 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; | 112 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; |
@@ -118,18 +126,49 @@ void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc) | |||
118 | } | 126 | } |
119 | } | 127 | } |
120 | 128 | ||
129 | /** | ||
130 | * radeon_irq_kms_pflip_irq_get - pre-pageflip callback. | ||
131 | * | ||
132 | * @rdev: radeon_device pointer | ||
133 | * @crtc: crtc to prepare for pageflip on | ||
134 | * | ||
135 | * Pre-pageflip callback (evergreen+). | ||
136 | * Enables the pageflip irq (vblank irq). | ||
137 | */ | ||
121 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) | 138 | void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) |
122 | { | 139 | { |
123 | /* enable the pflip int */ | 140 | /* enable the pflip int */ |
124 | radeon_irq_kms_pflip_irq_get(rdev, crtc); | 141 | radeon_irq_kms_pflip_irq_get(rdev, crtc); |
125 | } | 142 | } |
126 | 143 | ||
144 | /** | ||
145 | * evergreen_post_page_flip - pos-pageflip callback. | ||
146 | * | ||
147 | * @rdev: radeon_device pointer | ||
148 | * @crtc: crtc to cleanup pageflip on | ||
149 | * | ||
150 | * Post-pageflip callback (evergreen+). | ||
151 | * Disables the pageflip irq (vblank irq). | ||
152 | */ | ||
127 | void evergreen_post_page_flip(struct radeon_device *rdev, int crtc) | 153 | void evergreen_post_page_flip(struct radeon_device *rdev, int crtc) |
128 | { | 154 | { |
129 | /* disable the pflip int */ | 155 | /* disable the pflip int */ |
130 | radeon_irq_kms_pflip_irq_put(rdev, crtc); | 156 | radeon_irq_kms_pflip_irq_put(rdev, crtc); |
131 | } | 157 | } |
132 | 158 | ||
159 | /** | ||
160 | * evergreen_page_flip - pageflip callback. | ||
161 | * | ||
162 | * @rdev: radeon_device pointer | ||
163 | * @crtc_id: crtc to cleanup pageflip on | ||
164 | * @crtc_base: new address of the crtc (GPU MC address) | ||
165 | * | ||
166 | * Does the actual pageflip (evergreen+). | ||
167 | * During vblank we take the crtc lock and wait for the update_pending | ||
168 | * bit to go high, when it does, we release the lock, and allow the | ||
169 | * double buffered update to take place. | ||
170 | * Returns the current update pending status. | ||
171 | */ | ||
133 | u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | 172 | u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) |
134 | { | 173 | { |
135 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 174 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
@@ -214,6 +253,15 @@ int sumo_get_temp(struct radeon_device *rdev) | |||
214 | return actual_temp * 1000; | 253 | return actual_temp * 1000; |
215 | } | 254 | } |
216 | 255 | ||
256 | /** | ||
257 | * sumo_pm_init_profile - Initialize power profiles callback. | ||
258 | * | ||
259 | * @rdev: radeon_device pointer | ||
260 | * | ||
261 | * Initialize the power states used in profile mode | ||
262 | * (sumo, trinity, SI). | ||
263 | * Used for profile mode only. | ||
264 | */ | ||
217 | void sumo_pm_init_profile(struct radeon_device *rdev) | 265 | void sumo_pm_init_profile(struct radeon_device *rdev) |
218 | { | 266 | { |
219 | int idx; | 267 | int idx; |
@@ -265,6 +313,14 @@ void sumo_pm_init_profile(struct radeon_device *rdev) | |||
265 | rdev->pm.power_state[idx].num_clock_modes - 1; | 313 | rdev->pm.power_state[idx].num_clock_modes - 1; |
266 | } | 314 | } |
267 | 315 | ||
316 | /** | ||
317 | * evergreen_pm_misc - set additional pm hw parameters callback. | ||
318 | * | ||
319 | * @rdev: radeon_device pointer | ||
320 | * | ||
321 | * Set non-clock parameters associated with a power state | ||
322 | * (voltage, etc.) (evergreen+). | ||
323 | */ | ||
268 | void evergreen_pm_misc(struct radeon_device *rdev) | 324 | void evergreen_pm_misc(struct radeon_device *rdev) |
269 | { | 325 | { |
270 | int req_ps_idx = rdev->pm.requested_power_state_index; | 326 | int req_ps_idx = rdev->pm.requested_power_state_index; |
@@ -292,6 +348,13 @@ void evergreen_pm_misc(struct radeon_device *rdev) | |||
292 | } | 348 | } |
293 | } | 349 | } |
294 | 350 | ||
351 | /** | ||
352 | * evergreen_pm_prepare - pre-power state change callback. | ||
353 | * | ||
354 | * @rdev: radeon_device pointer | ||
355 | * | ||
356 | * Prepare for a power state change (evergreen+). | ||
357 | */ | ||
295 | void evergreen_pm_prepare(struct radeon_device *rdev) | 358 | void evergreen_pm_prepare(struct radeon_device *rdev) |
296 | { | 359 | { |
297 | struct drm_device *ddev = rdev->ddev; | 360 | struct drm_device *ddev = rdev->ddev; |
@@ -310,6 +373,13 @@ void evergreen_pm_prepare(struct radeon_device *rdev) | |||
310 | } | 373 | } |
311 | } | 374 | } |
312 | 375 | ||
376 | /** | ||
377 | * evergreen_pm_finish - post-power state change callback. | ||
378 | * | ||
379 | * @rdev: radeon_device pointer | ||
380 | * | ||
381 | * Clean up after a power state change (evergreen+). | ||
382 | */ | ||
313 | void evergreen_pm_finish(struct radeon_device *rdev) | 383 | void evergreen_pm_finish(struct radeon_device *rdev) |
314 | { | 384 | { |
315 | struct drm_device *ddev = rdev->ddev; | 385 | struct drm_device *ddev = rdev->ddev; |
@@ -328,6 +398,15 @@ void evergreen_pm_finish(struct radeon_device *rdev) | |||
328 | } | 398 | } |
329 | } | 399 | } |
330 | 400 | ||
401 | /** | ||
402 | * evergreen_hpd_sense - hpd sense callback. | ||
403 | * | ||
404 | * @rdev: radeon_device pointer | ||
405 | * @hpd: hpd (hotplug detect) pin | ||
406 | * | ||
407 | * Checks if a digital monitor is connected (evergreen+). | ||
408 | * Returns true if connected, false if not connected. | ||
409 | */ | ||
331 | bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) | 410 | bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) |
332 | { | 411 | { |
333 | bool connected = false; | 412 | bool connected = false; |
@@ -364,6 +443,14 @@ bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) | |||
364 | return connected; | 443 | return connected; |
365 | } | 444 | } |
366 | 445 | ||
446 | /** | ||
447 | * evergreen_hpd_set_polarity - hpd set polarity callback. | ||
448 | * | ||
449 | * @rdev: radeon_device pointer | ||
450 | * @hpd: hpd (hotplug detect) pin | ||
451 | * | ||
452 | * Set the polarity of the hpd pin (evergreen+). | ||
453 | */ | ||
367 | void evergreen_hpd_set_polarity(struct radeon_device *rdev, | 454 | void evergreen_hpd_set_polarity(struct radeon_device *rdev, |
368 | enum radeon_hpd_id hpd) | 455 | enum radeon_hpd_id hpd) |
369 | { | 456 | { |
@@ -424,6 +511,14 @@ void evergreen_hpd_set_polarity(struct radeon_device *rdev, | |||
424 | } | 511 | } |
425 | } | 512 | } |
426 | 513 | ||
514 | /** | ||
515 | * evergreen_hpd_init - hpd setup callback. | ||
516 | * | ||
517 | * @rdev: radeon_device pointer | ||
518 | * | ||
519 | * Setup the hpd pins used by the card (evergreen+). | ||
520 | * Enable the pin, set the polarity, and enable the hpd interrupts. | ||
521 | */ | ||
427 | void evergreen_hpd_init(struct radeon_device *rdev) | 522 | void evergreen_hpd_init(struct radeon_device *rdev) |
428 | { | 523 | { |
429 | struct drm_device *dev = rdev->ddev; | 524 | struct drm_device *dev = rdev->ddev; |
@@ -462,6 +557,14 @@ void evergreen_hpd_init(struct radeon_device *rdev) | |||
462 | radeon_irq_kms_enable_hpd(rdev, enabled); | 557 | radeon_irq_kms_enable_hpd(rdev, enabled); |
463 | } | 558 | } |
464 | 559 | ||
560 | /** | ||
561 | * evergreen_hpd_fini - hpd tear down callback. | ||
562 | * | ||
563 | * @rdev: radeon_device pointer | ||
564 | * | ||
565 | * Tear down the hpd pins used by the card (evergreen+). | ||
566 | * Disable the hpd interrupts. | ||
567 | */ | ||
465 | void evergreen_hpd_fini(struct radeon_device *rdev) | 568 | void evergreen_hpd_fini(struct radeon_device *rdev) |
466 | { | 569 | { |
467 | struct drm_device *dev = rdev->ddev; | 570 | struct drm_device *dev = rdev->ddev; |
@@ -925,6 +1028,14 @@ static void evergreen_program_watermarks(struct radeon_device *rdev, | |||
925 | 1028 | ||
926 | } | 1029 | } |
927 | 1030 | ||
1031 | /** | ||
1032 | * evergreen_bandwidth_update - update display watermarks callback. | ||
1033 | * | ||
1034 | * @rdev: radeon_device pointer | ||
1035 | * | ||
1036 | * Update the display watermarks based on the requested mode(s) | ||
1037 | * (evergreen+). | ||
1038 | */ | ||
928 | void evergreen_bandwidth_update(struct radeon_device *rdev) | 1039 | void evergreen_bandwidth_update(struct radeon_device *rdev) |
929 | { | 1040 | { |
930 | struct drm_display_mode *mode0 = NULL; | 1041 | struct drm_display_mode *mode0 = NULL; |
@@ -948,6 +1059,15 @@ void evergreen_bandwidth_update(struct radeon_device *rdev) | |||
948 | } | 1059 | } |
949 | } | 1060 | } |
950 | 1061 | ||
1062 | /** | ||
1063 | * evergreen_mc_wait_for_idle - wait for MC idle callback. | ||
1064 | * | ||
1065 | * @rdev: radeon_device pointer | ||
1066 | * | ||
1067 | * Wait for the MC (memory controller) to be idle. | ||
1068 | * (evergreen+). | ||
1069 | * Returns 0 if the MC is idle, -1 if not. | ||
1070 | */ | ||
951 | int evergreen_mc_wait_for_idle(struct radeon_device *rdev) | 1071 | int evergreen_mc_wait_for_idle(struct radeon_device *rdev) |
952 | { | 1072 | { |
953 | unsigned i; | 1073 | unsigned i; |