]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/gpu/drm/radeon/radeon_pm.c
drm/radeon: make cp variable an array
[mv-sheeva.git] / drivers / gpu / drm / radeon / radeon_pm.c
index 1fb84676afe3ba19bbfa9e7b32a05bc6dc464481..50b632ac8237915646c40b16b0a39e28fa7275ae 100644 (file)
@@ -252,7 +252,10 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
 
        mutex_lock(&rdev->ddev->struct_mutex);
        mutex_lock(&rdev->vram_mutex);
-       mutex_lock(&rdev->cp.mutex);
+       for (i = 0; i < RADEON_NUM_RINGS; ++i) {
+               if (rdev->cp[i].ring_obj)
+                       mutex_lock(&rdev->cp[i].mutex);
+       }
 
        /* gui idle int has issues on older chips it seems */
        if (rdev->family >= CHIP_R600) {
@@ -268,12 +271,13 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
                        radeon_irq_set(rdev);
                }
        } else {
-               if (rdev->cp.ready) {
+               struct radeon_cp *cp = &rdev->cp[RADEON_RING_TYPE_GFX_INDEX];
+               if (cp->ready) {
                        struct radeon_fence *fence;
-                       radeon_ring_alloc(rdev, 64);
-                       radeon_fence_create(rdev, &fence);
+                       radeon_ring_alloc(rdev, cp, 64);
+                       radeon_fence_create(rdev, &fence, radeon_ring_index(rdev, cp));
                        radeon_fence_emit(rdev, fence);
-                       radeon_ring_commit(rdev);
+                       radeon_ring_commit(rdev, cp);
                        radeon_fence_wait(fence, false);
                        radeon_fence_unref(&fence);
                }
@@ -307,7 +311,10 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
 
        rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
 
-       mutex_unlock(&rdev->cp.mutex);
+       for (i = 0; i < RADEON_NUM_RINGS; ++i) {
+               if (rdev->cp[i].ring_obj)
+                       mutex_unlock(&rdev->cp[i].mutex);
+       }
        mutex_unlock(&rdev->vram_mutex);
        mutex_unlock(&rdev->ddev->struct_mutex);
 }
@@ -797,17 +804,25 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
        if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) {
                unsigned long irq_flags;
                int not_processed = 0;
-
-               read_lock_irqsave(&rdev->fence_drv.lock, irq_flags);
-               if (!list_empty(&rdev->fence_drv.emitted)) {
-                       struct list_head *ptr;
-                       list_for_each(ptr, &rdev->fence_drv.emitted) {
-                               /* count up to 3, that's enought info */
-                               if (++not_processed >= 3)
-                                       break;
+               int i;
+
+               read_lock_irqsave(&rdev->fence_lock, irq_flags);
+               for (i = 0; i < RADEON_NUM_RINGS; ++i) {
+                       if (!rdev->fence_drv[i].initialized)
+                               continue;
+
+                       if (!list_empty(&rdev->fence_drv[i].emitted)) {
+                               struct list_head *ptr;
+                               list_for_each(ptr, &rdev->fence_drv[i].emitted) {
+                                       /* count up to 3, that's enought info */
+                                       if (++not_processed >= 3)
+                                               break;
+                               }
                        }
+                       if (not_processed >= 3)
+                               break;
                }
-               read_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags);
+               read_unlock_irqrestore(&rdev->fence_lock, irq_flags);
 
                if (not_processed >= 3) { /* should upclock */
                        if (rdev->pm.dynpm_planned_action == DYNPM_ACTION_DOWNCLOCK) {