aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-07-17 14:02:41 -0400
committerChristian König <deathsimple@vodafone.de>2012-07-18 07:53:40 -0400
commit48ef779ff32561c2ed780808fcd0ab4633df22bd (patch)
tree714cef276bcb4ea3412c70d75ec8383668297882 /drivers/gpu/drm/radeon/r100.c
parent09db86443230503f57d4079694a337f4e3c7b5a2 (diff)
drm/radeon: start to document the functions r100.c
Still a lot more 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/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c127
1 files changed, 124 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 2e0a60328bd4..8acb34fd3fd5 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -65,6 +65,19 @@ MODULE_FIRMWARE(FIRMWARE_R520);
65 65
66#include "r100_track.h" 66#include "r100_track.h"
67 67
68/* This files gather functions specifics to:
69 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280
70 * and others in some cases.
71 */
72
73/**
74 * r100_wait_for_vblank - vblank wait asic callback.
75 *
76 * @rdev: radeon_device pointer
77 * @crtc: crtc to wait for vblank on
78 *
79 * Wait for vblank on the requested crtc (r1xx-r4xx).
80 */
68void r100_wait_for_vblank(struct radeon_device *rdev, int crtc) 81void r100_wait_for_vblank(struct radeon_device *rdev, int crtc)
69{ 82{
70 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; 83 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
@@ -99,22 +112,49 @@ void r100_wait_for_vblank(struct radeon_device *rdev, int crtc)
99 } 112 }
100} 113}
101 114
102/* This files gather functions specifics to: 115/**
103 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 116 * r100_pre_page_flip - pre-pageflip callback.
117 *
118 * @rdev: radeon_device pointer
119 * @crtc: crtc to prepare for pageflip on
120 *
121 * Pre-pageflip callback (r1xx-r4xx).
122 * Enables the pageflip irq (vblank irq).
104 */ 123 */
105
106void r100_pre_page_flip(struct radeon_device *rdev, int crtc) 124void r100_pre_page_flip(struct radeon_device *rdev, int crtc)
107{ 125{
108 /* enable the pflip int */ 126 /* enable the pflip int */
109 radeon_irq_kms_pflip_irq_get(rdev, crtc); 127 radeon_irq_kms_pflip_irq_get(rdev, crtc);
110} 128}
111 129
130/**
131 * r100_post_page_flip - pos-pageflip callback.
132 *
133 * @rdev: radeon_device pointer
134 * @crtc: crtc to cleanup pageflip on
135 *
136 * Post-pageflip callback (r1xx-r4xx).
137 * Disables the pageflip irq (vblank irq).
138 */
112void r100_post_page_flip(struct radeon_device *rdev, int crtc) 139void r100_post_page_flip(struct radeon_device *rdev, int crtc)
113{ 140{
114 /* disable the pflip int */ 141 /* disable the pflip int */
115 radeon_irq_kms_pflip_irq_put(rdev, crtc); 142 radeon_irq_kms_pflip_irq_put(rdev, crtc);
116} 143}
117 144
145/**
146 * r100_page_flip - pageflip callback.
147 *
148 * @rdev: radeon_device pointer
149 * @crtc_id: crtc to cleanup pageflip on
150 * @crtc_base: new address of the crtc (GPU MC address)
151 *
152 * Does the actual pageflip (r1xx-r4xx).
153 * During vblank we take the crtc lock and wait for the update_pending
154 * bit to go high, when it does, we release the lock, and allow the
155 * double buffered update to take place.
156 * Returns the current update pending status.
157 */
118u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) 158u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
119{ 159{
120 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; 160 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
@@ -141,6 +181,15 @@ u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
141 return RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET; 181 return RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET;
142} 182}
143 183
184/**
185 * r100_pm_get_dynpm_state - look up dynpm power state callback.
186 *
187 * @rdev: radeon_device pointer
188 *
189 * Look up the optimal power state based on the
190 * current state of the GPU (r1xx-r5xx).
191 * Used for dynpm only.
192 */
144void r100_pm_get_dynpm_state(struct radeon_device *rdev) 193void r100_pm_get_dynpm_state(struct radeon_device *rdev)
145{ 194{
146 int i; 195 int i;
@@ -223,6 +272,15 @@ void r100_pm_get_dynpm_state(struct radeon_device *rdev)
223 pcie_lanes); 272 pcie_lanes);
224} 273}
225 274
275/**
276 * r100_pm_init_profile - Initialize power profiles callback.
277 *
278 * @rdev: radeon_device pointer
279 *
280 * Initialize the power states used in profile mode
281 * (r1xx-r3xx).
282 * Used for profile mode only.
283 */
226void r100_pm_init_profile(struct radeon_device *rdev) 284void r100_pm_init_profile(struct radeon_device *rdev)
227{ 285{
228 /* default */ 286 /* default */
@@ -262,6 +320,14 @@ void r100_pm_init_profile(struct radeon_device *rdev)
262 rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_cm_idx = 0; 320 rdev->pm.profiles[PM_PROFILE_HIGH_MH_IDX].dpms_on_cm_idx = 0;
263} 321}
264 322
323/**
324 * r100_pm_misc - set additional pm hw parameters callback.
325 *
326 * @rdev: radeon_device pointer
327 *
328 * Set non-clock parameters associated with a power state
329 * (voltage, pcie lanes, etc.) (r1xx-r4xx).
330 */
265void r100_pm_misc(struct radeon_device *rdev) 331void r100_pm_misc(struct radeon_device *rdev)
266{ 332{
267 int requested_index = rdev->pm.requested_power_state_index; 333 int requested_index = rdev->pm.requested_power_state_index;
@@ -353,6 +419,13 @@ void r100_pm_misc(struct radeon_device *rdev)
353 } 419 }
354} 420}
355 421
422/**
423 * r100_pm_prepare - pre-power state change callback.
424 *
425 * @rdev: radeon_device pointer
426 *
427 * Prepare for a power state change (r1xx-r4xx).
428 */
356void r100_pm_prepare(struct radeon_device *rdev) 429void r100_pm_prepare(struct radeon_device *rdev)
357{ 430{
358 struct drm_device *ddev = rdev->ddev; 431 struct drm_device *ddev = rdev->ddev;
@@ -377,6 +450,13 @@ void r100_pm_prepare(struct radeon_device *rdev)
377 } 450 }
378} 451}
379 452
453/**
454 * r100_pm_finish - post-power state change callback.
455 *
456 * @rdev: radeon_device pointer
457 *
458 * Clean up after a power state change (r1xx-r4xx).
459 */
380void r100_pm_finish(struct radeon_device *rdev) 460void r100_pm_finish(struct radeon_device *rdev)
381{ 461{
382 struct drm_device *ddev = rdev->ddev; 462 struct drm_device *ddev = rdev->ddev;
@@ -401,6 +481,14 @@ void r100_pm_finish(struct radeon_device *rdev)
401 } 481 }
402} 482}
403 483
484/**
485 * r100_gui_idle - gui idle callback.
486 *
487 * @rdev: radeon_device pointer
488 *
489 * Check of the GUI (2D/3D engines) are idle (r1xx-r5xx).
490 * Returns true if idle, false if not.
491 */
404bool r100_gui_idle(struct radeon_device *rdev) 492bool r100_gui_idle(struct radeon_device *rdev)
405{ 493{
406 if (RREG32(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE) 494 if (RREG32(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)
@@ -410,6 +498,15 @@ bool r100_gui_idle(struct radeon_device *rdev)
410} 498}
411 499
412/* hpd for digital panel detect/disconnect */ 500/* hpd for digital panel detect/disconnect */
501/**
502 * r100_hpd_sense - hpd sense callback.
503 *
504 * @rdev: radeon_device pointer
505 * @hpd: hpd (hotplug detect) pin
506 *
507 * Checks if a digital monitor is connected (r1xx-r4xx).
508 * Returns true if connected, false if not connected.
509 */
413bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) 510bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd)
414{ 511{
415 bool connected = false; 512 bool connected = false;
@@ -429,6 +526,14 @@ bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd)
429 return connected; 526 return connected;
430} 527}
431 528
529/**
530 * r100_hpd_set_polarity - hpd set polarity callback.
531 *
532 * @rdev: radeon_device pointer
533 * @hpd: hpd (hotplug detect) pin
534 *
535 * Set the polarity of the hpd pin (r1xx-r4xx).
536 */
432void r100_hpd_set_polarity(struct radeon_device *rdev, 537void r100_hpd_set_polarity(struct radeon_device *rdev,
433 enum radeon_hpd_id hpd) 538 enum radeon_hpd_id hpd)
434{ 539{
@@ -457,6 +562,14 @@ void r100_hpd_set_polarity(struct radeon_device *rdev,
457 } 562 }
458} 563}
459 564
565/**
566 * r100_hpd_init - hpd setup callback.
567 *
568 * @rdev: radeon_device pointer
569 *
570 * Setup the hpd pins used by the card (r1xx-r4xx).
571 * Set the polarity, and enable the hpd interrupts.
572 */
460void r100_hpd_init(struct radeon_device *rdev) 573void r100_hpd_init(struct radeon_device *rdev)
461{ 574{
462 struct drm_device *dev = rdev->ddev; 575 struct drm_device *dev = rdev->ddev;
@@ -471,6 +584,14 @@ void r100_hpd_init(struct radeon_device *rdev)
471 radeon_irq_kms_enable_hpd(rdev, enable); 584 radeon_irq_kms_enable_hpd(rdev, enable);
472} 585}
473 586
587/**
588 * r100_hpd_fini - hpd tear down callback.
589 *
590 * @rdev: radeon_device pointer
591 *
592 * Tear down the hpd pins used by the card (r1xx-r4xx).
593 * Disable the hpd interrupts.
594 */
474void r100_hpd_fini(struct radeon_device *rdev) 595void r100_hpd_fini(struct radeon_device *rdev)
475{ 596{
476 struct drm_device *dev = rdev->ddev; 597 struct drm_device *dev = rdev->ddev;