diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-07-17 14:02:35 -0400 |
---|---|---|
committer | Christian König <deathsimple@vodafone.de> | 2012-07-18 07:53:35 -0400 |
commit | b73ba98dcb9f8e148773c3810a522440484fe05a (patch) | |
tree | 90f814c6f2c9cd950c76afa998dee07783766459 /drivers/gpu/drm | |
parent | f482a1419545ded5f4ee748b44cba42d9a885dd4 (diff) |
drm/radeon: document radeon_irq_kms.c
Adds documentation to most of the functions in
radeon_irq_kms.c
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/radeon_irq_kms.c | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 6664514bbdca..afaa1727abd2 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -34,6 +34,15 @@ | |||
34 | 34 | ||
35 | #define RADEON_WAIT_IDLE_TIMEOUT 200 | 35 | #define RADEON_WAIT_IDLE_TIMEOUT 200 |
36 | 36 | ||
37 | /** | ||
38 | * radeon_driver_irq_handler_kms - irq handler for KMS | ||
39 | * | ||
40 | * @DRM_IRQ_ARGS: args | ||
41 | * | ||
42 | * This is the irq handler for the radeon KMS driver (all asics). | ||
43 | * radeon_irq_process is a macro that points to the per-asic | ||
44 | * irq handler callback. | ||
45 | */ | ||
37 | irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) | 46 | irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) |
38 | { | 47 | { |
39 | struct drm_device *dev = (struct drm_device *) arg; | 48 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -45,6 +54,17 @@ irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) | |||
45 | /* | 54 | /* |
46 | * Handle hotplug events outside the interrupt handler proper. | 55 | * Handle hotplug events outside the interrupt handler proper. |
47 | */ | 56 | */ |
57 | /** | ||
58 | * radeon_hotplug_work_func - display hotplug work handler | ||
59 | * | ||
60 | * @work: work struct | ||
61 | * | ||
62 | * This is the hot plug event work handler (all asics). | ||
63 | * The work gets scheduled from the irq handler if there | ||
64 | * was a hot plug interrupt. It walks the connector table | ||
65 | * and calls the hotplug handler for each one, then sends | ||
66 | * a drm hotplug event to alert userspace. | ||
67 | */ | ||
48 | static void radeon_hotplug_work_func(struct work_struct *work) | 68 | static void radeon_hotplug_work_func(struct work_struct *work) |
49 | { | 69 | { |
50 | struct radeon_device *rdev = container_of(work, struct radeon_device, | 70 | struct radeon_device *rdev = container_of(work, struct radeon_device, |
@@ -61,6 +81,14 @@ static void radeon_hotplug_work_func(struct work_struct *work) | |||
61 | drm_helper_hpd_irq_event(dev); | 81 | drm_helper_hpd_irq_event(dev); |
62 | } | 82 | } |
63 | 83 | ||
84 | /** | ||
85 | * radeon_driver_irq_preinstall_kms - drm irq preinstall callback | ||
86 | * | ||
87 | * @dev: drm dev pointer | ||
88 | * | ||
89 | * Gets the hw ready to enable irqs (all asics). | ||
90 | * This function disables all interrupt sources on the GPU. | ||
91 | */ | ||
64 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev) | 92 | void radeon_driver_irq_preinstall_kms(struct drm_device *dev) |
65 | { | 93 | { |
66 | struct radeon_device *rdev = dev->dev_private; | 94 | struct radeon_device *rdev = dev->dev_private; |
@@ -85,12 +113,27 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev) | |||
85 | radeon_irq_process(rdev); | 113 | radeon_irq_process(rdev); |
86 | } | 114 | } |
87 | 115 | ||
116 | /** | ||
117 | * radeon_driver_irq_postinstall_kms - drm irq preinstall callback | ||
118 | * | ||
119 | * @dev: drm dev pointer | ||
120 | * | ||
121 | * Handles stuff to be done after enabling irqs (all asics). | ||
122 | * Returns 0 on success. | ||
123 | */ | ||
88 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev) | 124 | int radeon_driver_irq_postinstall_kms(struct drm_device *dev) |
89 | { | 125 | { |
90 | dev->max_vblank_count = 0x001fffff; | 126 | dev->max_vblank_count = 0x001fffff; |
91 | return 0; | 127 | return 0; |
92 | } | 128 | } |
93 | 129 | ||
130 | /** | ||
131 | * radeon_driver_irq_uninstall_kms - drm irq uninstall callback | ||
132 | * | ||
133 | * @dev: drm dev pointer | ||
134 | * | ||
135 | * This function disables all interrupt sources on the GPU (all asics). | ||
136 | */ | ||
94 | void radeon_driver_irq_uninstall_kms(struct drm_device *dev) | 137 | void radeon_driver_irq_uninstall_kms(struct drm_device *dev) |
95 | { | 138 | { |
96 | struct radeon_device *rdev = dev->dev_private; | 139 | struct radeon_device *rdev = dev->dev_private; |
@@ -116,6 +159,16 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) | |||
116 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); | 159 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
117 | } | 160 | } |
118 | 161 | ||
162 | /** | ||
163 | * radeon_msi_ok - asic specific msi checks | ||
164 | * | ||
165 | * @rdev: radeon device pointer | ||
166 | * | ||
167 | * Handles asic specific MSI checks to determine if | ||
168 | * MSIs should be enabled on a particular chip (all asics). | ||
169 | * Returns true if MSIs should be enabled, false if MSIs | ||
170 | * should not be enabled. | ||
171 | */ | ||
119 | static bool radeon_msi_ok(struct radeon_device *rdev) | 172 | static bool radeon_msi_ok(struct radeon_device *rdev) |
120 | { | 173 | { |
121 | /* RV370/RV380 was first asic with MSI support */ | 174 | /* RV370/RV380 was first asic with MSI support */ |
@@ -168,6 +221,14 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
168 | return true; | 221 | return true; |
169 | } | 222 | } |
170 | 223 | ||
224 | /** | ||
225 | * radeon_irq_kms_init - init driver interrupt info | ||
226 | * | ||
227 | * @rdev: radeon device pointer | ||
228 | * | ||
229 | * Sets up the work irq handlers, vblank init, MSIs, etc. (all asics). | ||
230 | * Returns 0 for success, error for failure. | ||
231 | */ | ||
171 | int radeon_irq_kms_init(struct radeon_device *rdev) | 232 | int radeon_irq_kms_init(struct radeon_device *rdev) |
172 | { | 233 | { |
173 | int r = 0; | 234 | int r = 0; |
@@ -200,6 +261,13 @@ int radeon_irq_kms_init(struct radeon_device *rdev) | |||
200 | return 0; | 261 | return 0; |
201 | } | 262 | } |
202 | 263 | ||
264 | /** | ||
265 | * radeon_irq_kms_fini - tear down driver interrrupt info | ||
266 | * | ||
267 | * @rdev: radeon device pointer | ||
268 | * | ||
269 | * Tears down the work irq handlers, vblank handlers, MSIs, etc. (all asics). | ||
270 | */ | ||
203 | void radeon_irq_kms_fini(struct radeon_device *rdev) | 271 | void radeon_irq_kms_fini(struct radeon_device *rdev) |
204 | { | 272 | { |
205 | drm_vblank_cleanup(rdev->ddev); | 273 | drm_vblank_cleanup(rdev->ddev); |
@@ -212,6 +280,16 @@ void radeon_irq_kms_fini(struct radeon_device *rdev) | |||
212 | flush_work_sync(&rdev->hotplug_work); | 280 | flush_work_sync(&rdev->hotplug_work); |
213 | } | 281 | } |
214 | 282 | ||
283 | /** | ||
284 | * radeon_irq_kms_sw_irq_get - enable software interrupt | ||
285 | * | ||
286 | * @rdev: radeon device pointer | ||
287 | * @ring: ring whose interrupt you want to enable | ||
288 | * | ||
289 | * Enables the software interrupt for a specific ring (all asics). | ||
290 | * The software interrupt is generally used to signal a fence on | ||
291 | * a particular ring. | ||
292 | */ | ||
215 | void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring) | 293 | void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring) |
216 | { | 294 | { |
217 | unsigned long irqflags; | 295 | unsigned long irqflags; |
@@ -226,6 +304,16 @@ void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring) | |||
226 | } | 304 | } |
227 | } | 305 | } |
228 | 306 | ||
307 | /** | ||
308 | * radeon_irq_kms_sw_irq_put - disable software interrupt | ||
309 | * | ||
310 | * @rdev: radeon device pointer | ||
311 | * @ring: ring whose interrupt you want to disable | ||
312 | * | ||
313 | * Disables the software interrupt for a specific ring (all asics). | ||
314 | * The software interrupt is generally used to signal a fence on | ||
315 | * a particular ring. | ||
316 | */ | ||
229 | void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring) | 317 | void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring) |
230 | { | 318 | { |
231 | unsigned long irqflags; | 319 | unsigned long irqflags; |
@@ -240,6 +328,15 @@ void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring) | |||
240 | } | 328 | } |
241 | } | 329 | } |
242 | 330 | ||
331 | /** | ||
332 | * radeon_irq_kms_pflip_irq_get - enable pageflip interrupt | ||
333 | * | ||
334 | * @rdev: radeon device pointer | ||
335 | * @crtc: crtc whose interrupt you want to enable | ||
336 | * | ||
337 | * Enables the pageflip interrupt for a specific crtc (all asics). | ||
338 | * For pageflips we use the vblank interrupt source. | ||
339 | */ | ||
243 | void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc) | 340 | void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc) |
244 | { | 341 | { |
245 | unsigned long irqflags; | 342 | unsigned long irqflags; |
@@ -257,6 +354,15 @@ void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc) | |||
257 | } | 354 | } |
258 | } | 355 | } |
259 | 356 | ||
357 | /** | ||
358 | * radeon_irq_kms_pflip_irq_put - disable pageflip interrupt | ||
359 | * | ||
360 | * @rdev: radeon device pointer | ||
361 | * @crtc: crtc whose interrupt you want to disable | ||
362 | * | ||
363 | * Disables the pageflip interrupt for a specific crtc (all asics). | ||
364 | * For pageflips we use the vblank interrupt source. | ||
365 | */ | ||
260 | void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) | 366 | void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) |
261 | { | 367 | { |
262 | unsigned long irqflags; | 368 | unsigned long irqflags; |
@@ -274,6 +380,14 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) | |||
274 | } | 380 | } |
275 | } | 381 | } |
276 | 382 | ||
383 | /** | ||
384 | * radeon_irq_kms_enable_afmt - enable audio format change interrupt | ||
385 | * | ||
386 | * @rdev: radeon device pointer | ||
387 | * @block: afmt block whose interrupt you want to enable | ||
388 | * | ||
389 | * Enables the afmt change interrupt for a specific afmt block (all asics). | ||
390 | */ | ||
277 | void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) | 391 | void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) |
278 | { | 392 | { |
279 | unsigned long irqflags; | 393 | unsigned long irqflags; |
@@ -285,6 +399,14 @@ void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) | |||
285 | 399 | ||
286 | } | 400 | } |
287 | 401 | ||
402 | /** | ||
403 | * radeon_irq_kms_disable_afmt - disable audio format change interrupt | ||
404 | * | ||
405 | * @rdev: radeon device pointer | ||
406 | * @block: afmt block whose interrupt you want to disable | ||
407 | * | ||
408 | * Disables the afmt change interrupt for a specific afmt block (all asics). | ||
409 | */ | ||
288 | void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) | 410 | void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) |
289 | { | 411 | { |
290 | unsigned long irqflags; | 412 | unsigned long irqflags; |
@@ -295,6 +417,14 @@ void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) | |||
295 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); | 417 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
296 | } | 418 | } |
297 | 419 | ||
420 | /** | ||
421 | * radeon_irq_kms_enable_hpd - enable hotplug detect interrupt | ||
422 | * | ||
423 | * @rdev: radeon device pointer | ||
424 | * @hpd_mask: mask of hpd pins you want to enable. | ||
425 | * | ||
426 | * Enables the hotplug detect interrupt for a specific hpd pin (all asics). | ||
427 | */ | ||
298 | void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | 428 | void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) |
299 | { | 429 | { |
300 | unsigned long irqflags; | 430 | unsigned long irqflags; |
@@ -307,6 +437,14 @@ void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | |||
307 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); | 437 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
308 | } | 438 | } |
309 | 439 | ||
440 | /** | ||
441 | * radeon_irq_kms_disable_hpd - disable hotplug detect interrupt | ||
442 | * | ||
443 | * @rdev: radeon device pointer | ||
444 | * @hpd_mask: mask of hpd pins you want to disable. | ||
445 | * | ||
446 | * Disables the hotplug detect interrupt for a specific hpd pin (all asics). | ||
447 | */ | ||
310 | void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | 448 | void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) |
311 | { | 449 | { |
312 | unsigned long irqflags; | 450 | unsigned long irqflags; |
@@ -319,6 +457,18 @@ void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) | |||
319 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); | 457 | spin_unlock_irqrestore(&rdev->irq.lock, irqflags); |
320 | } | 458 | } |
321 | 459 | ||
460 | /** | ||
461 | * radeon_irq_kms_wait_gui_idle - waits for drawing engine to be idle | ||
462 | * | ||
463 | * @rdev: radeon device pointer | ||
464 | * | ||
465 | * Enabled the GUI idle interrupt and waits for it to fire (r6xx+). | ||
466 | * This is currently used to make sure the 3D engine is idle for power | ||
467 | * management, but should be replaces with proper fence waits. | ||
468 | * GUI idle interrupts don't work very well on pre-r6xx hw and it also | ||
469 | * does not take into account other aspects of the chip that may be busy. | ||
470 | * DO NOT USE GOING FORWARD. | ||
471 | */ | ||
322 | int radeon_irq_kms_wait_gui_idle(struct radeon_device *rdev) | 472 | int radeon_irq_kms_wait_gui_idle(struct radeon_device *rdev) |
323 | { | 473 | { |
324 | unsigned long irqflags; | 474 | unsigned long irqflags; |