drm/radeon/kms: init rdev->num_crtc at asic init
authorAlex Deucher <alexdeucher@gmail.com>
Tue, 16 Mar 2010 21:08:06 +0000 (17:08 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 30 Mar 2010 23:54:07 +0000 (09:54 +1000)
Replace hardcoded numbers with rdev->num_crtc.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_irq_kms.c

index 6d2a545..dd23dcf 100644 (file)
@@ -700,6 +700,16 @@ int radeon_asic_init(struct radeon_device *rdev)
                rdev->asic->set_memory_clock = NULL;
        }
 
+       /* set the number of crtcs */
+       if (rdev->flags & RADEON_SINGLE_CRTC)
+               rdev->num_crtc = 1;
+       else {
+               if (ASIC_IS_DCE4(rdev))
+                       rdev->num_crtc = 6;
+               else
+                       rdev->num_crtc = 2;
+       }
+
        return 0;
 }
 
index ff5f099..d65931d 100644 (file)
@@ -1003,15 +1003,6 @@ int radeon_modeset_init(struct radeon_device *rdev)
                radeon_combios_check_hardcoded_edid(rdev);
        }
 
-       if (rdev->flags & RADEON_SINGLE_CRTC)
-               rdev->num_crtc = 1;
-       else {
-               if (ASIC_IS_DCE4(rdev))
-                       rdev->num_crtc = 6;
-               else
-                       rdev->num_crtc = 2;
-       }
-
        /* allocate crtcs */
        for (i = 0; i < rdev->num_crtc; i++) {
                radeon_crtc_init(rdev->ddev, i);
index 3cfd60f..68519b4 100644 (file)
@@ -67,9 +67,10 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 
        /* Disable *all* interrupts */
        rdev->irq.sw_int = false;
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < rdev->num_crtc; i++)
                rdev->irq.crtc_vblank_int[i] = false;
-       }
+       for (i = 0; i < 6; i++)
+               rdev->irq.hpd[i] = false;
        radeon_irq_set(rdev);
        /* Clear bits */
        radeon_irq_process(rdev);
@@ -95,22 +96,19 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
        }
        /* Disable *all* interrupts */
        rdev->irq.sw_int = false;
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < rdev->num_crtc; i++)
                rdev->irq.crtc_vblank_int[i] = false;
+       for (i = 0; i < 6; i++)
                rdev->irq.hpd[i] = false;
-       }
        radeon_irq_set(rdev);
 }
 
 int radeon_irq_kms_init(struct radeon_device *rdev)
 {
        int r = 0;
-       int num_crtc = 2;
 
-       if (rdev->flags & RADEON_SINGLE_CRTC)
-               num_crtc = 1;
        spin_lock_init(&rdev->irq.sw_lock);
-       r = drm_vblank_init(rdev->ddev, num_crtc);
+       r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
        if (r) {
                return r;
        }