drm/radeon/kms: reorganize pm callbacks
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Feb 2012 22:53:41 +0000 (17:53 -0500)
committerDave Airlie <airlied@redhat.com>
Mon, 27 Feb 2012 14:49:35 +0000 (14:49 +0000)
tidy up the radeon_asic struct.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_asic.c

index f627ac935d7fc1ee746563278cfb26820c979835..049fc472c04953466c2a4dc28f153342000ca757 100644 (file)
@@ -1199,11 +1199,13 @@ struct radeon_asic {
        void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
        bool (*gui_idle)(struct radeon_device *rdev);
        /* power management */
-       void (*pm_misc)(struct radeon_device *rdev);
-       void (*pm_prepare)(struct radeon_device *rdev);
-       void (*pm_finish)(struct radeon_device *rdev);
-       void (*pm_init_profile)(struct radeon_device *rdev);
-       void (*pm_get_dynpm_state)(struct radeon_device *rdev);
+       struct {
+               void (*misc)(struct radeon_device *rdev);
+               void (*prepare)(struct radeon_device *rdev);
+               void (*finish)(struct radeon_device *rdev);
+               void (*init_profile)(struct radeon_device *rdev);
+               void (*get_dynpm_state)(struct radeon_device *rdev);
+       } pm;
        /* pageflipping */
        struct {
                void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
@@ -1694,11 +1696,11 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
 #define radeon_hpd_sense(rdev, h) (rdev)->asic->hpd.sense((rdev), (h))
 #define radeon_hpd_set_polarity(rdev, h) (rdev)->asic->hpd.set_polarity((rdev), (h))
 #define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev))
-#define radeon_pm_misc(rdev) (rdev)->asic->pm_misc((rdev))
-#define radeon_pm_prepare(rdev) (rdev)->asic->pm_prepare((rdev))
-#define radeon_pm_finish(rdev) (rdev)->asic->pm_finish((rdev))
-#define radeon_pm_init_profile(rdev) (rdev)->asic->pm_init_profile((rdev))
-#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm_get_dynpm_state((rdev))
+#define radeon_pm_misc(rdev) (rdev)->asic->pm.misc((rdev))
+#define radeon_pm_prepare(rdev) (rdev)->asic->pm.prepare((rdev))
+#define radeon_pm_finish(rdev) (rdev)->asic->pm.finish((rdev))
+#define radeon_pm_init_profile(rdev) (rdev)->asic->pm.init_profile((rdev))
+#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm.get_dynpm_state((rdev))
 #define radeon_pre_page_flip(rdev, crtc) rdev->asic->pflip.pre_page_flip((rdev), (crtc))
 #define radeon_page_flip(rdev, crtc, base) rdev->asic->pflip.page_flip((rdev), (crtc), (base))
 #define radeon_post_page_flip(rdev, crtc) rdev->asic->pflip.post_page_flip((rdev), (crtc))
index 839b1883169989ce1af62ccdeadd633070fa4f21..9dc8f8dfeb651fd9312cc1938672dc8072c9e1f4 100644 (file)
@@ -172,11 +172,13 @@ static struct radeon_asic r100_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r100_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r100_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -229,11 +231,13 @@ static struct radeon_asic r200_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r100_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r100_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -287,11 +291,13 @@ static struct radeon_asic r300_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r100_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r100_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -344,11 +350,13 @@ static struct radeon_asic r300_asic_pcie = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r100_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r100_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -402,11 +410,13 @@ static struct radeon_asic r420_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r420_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r420_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -460,11 +470,13 @@ static struct radeon_asic rs400_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &r100_pm_misc,
-       .pm_prepare = &r100_pm_prepare,
-       .pm_finish = &r100_pm_finish,
-       .pm_init_profile = &r100_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r100_pm_misc,
+               .prepare = &r100_pm_prepare,
+               .finish = &r100_pm_finish,
+               .init_profile = &r100_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &r100_pre_page_flip,
                .page_flip = &r100_page_flip,
@@ -518,11 +530,13 @@ static struct radeon_asic rs600_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &rs600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r420_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &rs600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r420_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -576,11 +590,13 @@ static struct radeon_asic rs690_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &rs600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r420_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &rs600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r420_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -634,11 +650,13 @@ static struct radeon_asic rv515_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &rs600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r420_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &rs600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r420_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -692,11 +710,13 @@ static struct radeon_asic r520_asic = {
        },
        .ioctl_wait_idle = NULL,
        .gui_idle = &r100_gui_idle,
-       .pm_misc = &rs600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r420_pm_init_profile,
-       .pm_get_dynpm_state = &r100_pm_get_dynpm_state,
+       .pm = {
+               .misc = &rs600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r420_pm_init_profile,
+               .get_dynpm_state = &r100_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -749,11 +769,13 @@ static struct radeon_asic r600_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &r600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r600_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r600_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -806,11 +828,13 @@ static struct radeon_asic rs780_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &r600_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &rs780_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &r600_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &rs780_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rs600_page_flip,
@@ -863,11 +887,13 @@ static struct radeon_asic rv770_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &rv770_pm_misc,
-       .pm_prepare = &rs600_pm_prepare,
-       .pm_finish = &rs600_pm_finish,
-       .pm_init_profile = &r600_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &rv770_pm_misc,
+               .prepare = &rs600_pm_prepare,
+               .finish = &rs600_pm_finish,
+               .init_profile = &r600_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &rs600_pre_page_flip,
                .page_flip = &rv770_page_flip,
@@ -920,11 +946,13 @@ static struct radeon_asic evergreen_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &evergreen_pm_misc,
-       .pm_prepare = &evergreen_pm_prepare,
-       .pm_finish = &evergreen_pm_finish,
-       .pm_init_profile = &r600_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &evergreen_pm_misc,
+               .prepare = &evergreen_pm_prepare,
+               .finish = &evergreen_pm_finish,
+               .init_profile = &r600_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
                .page_flip = &evergreen_page_flip,
@@ -977,11 +1005,13 @@ static struct radeon_asic sumo_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &evergreen_pm_misc,
-       .pm_prepare = &evergreen_pm_prepare,
-       .pm_finish = &evergreen_pm_finish,
-       .pm_init_profile = &sumo_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &evergreen_pm_misc,
+               .prepare = &evergreen_pm_prepare,
+               .finish = &evergreen_pm_finish,
+               .init_profile = &sumo_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
                .page_flip = &evergreen_page_flip,
@@ -1034,11 +1064,13 @@ static struct radeon_asic btc_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &evergreen_pm_misc,
-       .pm_prepare = &evergreen_pm_prepare,
-       .pm_finish = &evergreen_pm_finish,
-       .pm_init_profile = &r600_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &evergreen_pm_misc,
+               .prepare = &evergreen_pm_prepare,
+               .finish = &evergreen_pm_finish,
+               .init_profile = &r600_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
                .page_flip = &evergreen_page_flip,
@@ -1114,11 +1146,13 @@ static struct radeon_asic cayman_asic = {
        },
        .ioctl_wait_idle = r600_ioctl_wait_idle,
        .gui_idle = &r600_gui_idle,
-       .pm_misc = &evergreen_pm_misc,
-       .pm_prepare = &evergreen_pm_prepare,
-       .pm_finish = &evergreen_pm_finish,
-       .pm_init_profile = &r600_pm_init_profile,
-       .pm_get_dynpm_state = &r600_pm_get_dynpm_state,
+       .pm = {
+               .misc = &evergreen_pm_misc,
+               .prepare = &evergreen_pm_prepare,
+               .finish = &evergreen_pm_finish,
+               .init_profile = &r600_pm_init_profile,
+               .get_dynpm_state = &r600_pm_get_dynpm_state,
+       },
        .pflip = {
                .pre_page_flip = &evergreen_pre_page_flip,
                .page_flip = &evergreen_page_flip,