summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/r600_dpm.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-03-26 02:28:29 +0400
committerAlex Deucher <alexander.deucher@amd.com>2013-06-28 03:16:40 +0400
commit4bd9f516f622b883b35cda8fb38b95f3a493fc17 (patch)
tree76fe8ddc8d59a9fc4b67afe9c128be7fd575d0ba /drivers/gpu/drm/radeon/r600_dpm.c
parent2abba66e7af70825734eaf9fdea37c97f9e7b6ff (diff)
downloadlinux-4bd9f516f622b883b35cda8fb38b95f3a493fc17.tar.xz
drm/radeon/dpm: add pcie gen helper function
Add a helper function to determine the preferred pcie gen based on the card, system, and circumstance. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r600_dpm.c')
-rw-r--r--drivers/gpu/drm/radeon/r600_dpm.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index 2e5ec65a78f7..28177da694f2 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -997,3 +997,26 @@ void r600_free_extended_power_table(struct radeon_device *rdev)
if (rdev->pm.dpm.dyn_state.ppm_table)
kfree(rdev->pm.dpm.dyn_state.ppm_table);
}
+
+enum radeon_pcie_gen r600_get_pcie_gen_support(struct radeon_device *rdev,
+ u32 sys_mask,
+ enum radeon_pcie_gen asic_gen,
+ enum radeon_pcie_gen default_gen)
+{
+ switch (asic_gen) {
+ case RADEON_PCIE_GEN1:
+ return RADEON_PCIE_GEN1;
+ case RADEON_PCIE_GEN2:
+ return RADEON_PCIE_GEN2;
+ case RADEON_PCIE_GEN3:
+ return RADEON_PCIE_GEN3;
+ default:
+ if ((sys_mask & DRM_PCIE_SPEED_80) && (default_gen == RADEON_PCIE_GEN3))
+ return RADEON_PCIE_GEN3;
+ else if ((sys_mask & DRM_PCIE_SPEED_50) && (default_gen == RADEON_PCIE_GEN2))
+ return RADEON_PCIE_GEN2;
+ else
+ return RADEON_PCIE_GEN1;
+ }
+ return RADEON_PCIE_GEN1;
+}