aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-07-02 18:40:35 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-07-05 18:09:30 -0400
commit8b5e6b7f0ec81f237d87cf9632309db9481c6fb5 (patch)
tree2b0cfc0679841fe0afbe5ef24a0e11f0a8b26582 /drivers/gpu
parent70d01a5ee29fcb23a6b5948227b1aee212922ade (diff)
drm/radeon/dpm: implement force performance levels for 7xx/eg/btc
Allows you to limit the selected power levels via sysfs. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/btc_dpm.c4
-rw-r--r--drivers/gpu/drm/radeon/cypress_dpm.c4
-rw-r--r--drivers/gpu/drm/radeon/ppsmc.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h2
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c31
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.h3
7 files changed, 37 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index f072660c7665..91567448c55d 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -2326,9 +2326,9 @@ int btc_dpm_set_power_state(struct radeon_device *rdev)
2326 return ret; 2326 return ret;
2327 } 2327 }
2328 2328
2329 ret = rv770_unrestrict_performance_levels_after_switch(rdev); 2329 ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
2330 if (ret) { 2330 if (ret) {
2331 DRM_ERROR("rv770_unrestrict_performance_levels_after_switch failed\n"); 2331 DRM_ERROR("rv770_dpm_force_performance_level failed\n");
2332 return ret; 2332 return ret;
2333 } 2333 }
2334 2334
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 5ada922e5cec..9ef840807dd1 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -2014,9 +2014,9 @@ int cypress_dpm_set_power_state(struct radeon_device *rdev)
2014 if (eg_pi->pcie_performance_request) 2014 if (eg_pi->pcie_performance_request)
2015 cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); 2015 cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps);
2016 2016
2017 ret = rv770_unrestrict_performance_levels_after_switch(rdev); 2017 ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
2018 if (ret) { 2018 if (ret) {
2019 DRM_ERROR("rv770_unrestrict_performance_levels_after_switch failed\n"); 2019 DRM_ERROR("rv770_dpm_force_performance_level failed\n");
2020 return ret; 2020 return ret;
2021 } 2021 }
2022 2022
diff --git a/drivers/gpu/drm/radeon/ppsmc.h b/drivers/gpu/drm/radeon/ppsmc.h
index 8fb1113a8fd7..fc71ca6b04ca 100644
--- a/drivers/gpu/drm/radeon/ppsmc.h
+++ b/drivers/gpu/drm/radeon/ppsmc.h
@@ -71,6 +71,8 @@ typedef uint8_t PPSMC_Result;
71#define PPSMC_MSG_SwitchToSwState ((uint8_t)0x20) 71#define PPSMC_MSG_SwitchToSwState ((uint8_t)0x20)
72#define PPSMC_MSG_SwitchToInitialState ((uint8_t)0x40) 72#define PPSMC_MSG_SwitchToInitialState ((uint8_t)0x40)
73#define PPSMC_MSG_NoForcedLevel ((uint8_t)0x41) 73#define PPSMC_MSG_NoForcedLevel ((uint8_t)0x41)
74#define PPSMC_MSG_ForceHigh ((uint8_t)0x42)
75#define PPSMC_MSG_ForceMediumOrHigh ((uint8_t)0x43)
74#define PPSMC_MSG_SwitchToMinimumPower ((uint8_t)0x51) 76#define PPSMC_MSG_SwitchToMinimumPower ((uint8_t)0x51)
75#define PPSMC_MSG_ResumeFromMinimumPower ((uint8_t)0x52) 77#define PPSMC_MSG_ResumeFromMinimumPower ((uint8_t)0x52)
76#define PPSMC_MSG_EnableCac ((uint8_t)0x53) 78#define PPSMC_MSG_EnableCac ((uint8_t)0x53)
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index a5b244dc50ca..221a0b31e649 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1393,6 +1393,7 @@ static struct radeon_asic rv770_asic = {
1393 .get_mclk = &rv770_dpm_get_mclk, 1393 .get_mclk = &rv770_dpm_get_mclk,
1394 .print_power_state = &rv770_dpm_print_power_state, 1394 .print_power_state = &rv770_dpm_print_power_state,
1395 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level, 1395 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1396 .force_performance_level = &rv770_dpm_force_performance_level,
1396 }, 1397 },
1397 .pflip = { 1398 .pflip = {
1398 .pre_page_flip = &rs600_pre_page_flip, 1399 .pre_page_flip = &rs600_pre_page_flip,
@@ -1516,6 +1517,7 @@ static struct radeon_asic evergreen_asic = {
1516 .get_mclk = &rv770_dpm_get_mclk, 1517 .get_mclk = &rv770_dpm_get_mclk,
1517 .print_power_state = &rv770_dpm_print_power_state, 1518 .print_power_state = &rv770_dpm_print_power_state,
1518 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level, 1519 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1520 .force_performance_level = &rv770_dpm_force_performance_level,
1519 }, 1521 },
1520 .pflip = { 1522 .pflip = {
1521 .pre_page_flip = &evergreen_pre_page_flip, 1523 .pre_page_flip = &evergreen_pre_page_flip,
@@ -1762,6 +1764,7 @@ static struct radeon_asic btc_asic = {
1762 .get_mclk = &btc_dpm_get_mclk, 1764 .get_mclk = &btc_dpm_get_mclk,
1763 .print_power_state = &rv770_dpm_print_power_state, 1765 .print_power_state = &rv770_dpm_print_power_state,
1764 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level, 1766 .debugfs_print_current_performance_level = &rv770_dpm_debugfs_print_current_performance_level,
1767 .force_performance_level = &rv770_dpm_force_performance_level,
1765 }, 1768 },
1766 .pflip = { 1769 .pflip = {
1767 .pre_page_flip = &evergreen_pre_page_flip, 1770 .pre_page_flip = &evergreen_pre_page_flip,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 6822c7aeacaa..a053dc1e7866 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -478,6 +478,8 @@ void rv770_dpm_print_power_state(struct radeon_device *rdev,
478 struct radeon_ps *ps); 478 struct radeon_ps *ps);
479void rv770_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, 479void rv770_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
480 struct seq_file *m); 480 struct seq_file *m);
481int rv770_dpm_force_performance_level(struct radeon_device *rdev,
482 enum radeon_dpm_forced_level level);
481 483
482/* 484/*
483 * evergreen 485 * evergreen
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index 9af464d48eaa..c3025de4f4e2 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -1471,14 +1471,30 @@ int rv770_restrict_performance_levels_before_switch(struct radeon_device *rdev)
1471 return 0; 1471 return 0;
1472} 1472}
1473 1473
1474int rv770_unrestrict_performance_levels_after_switch(struct radeon_device *rdev) 1474int rv770_dpm_force_performance_level(struct radeon_device *rdev,
1475{ 1475 enum radeon_dpm_forced_level level)
1476 if (rv770_send_msg_to_smc(rdev, (PPSMC_Msg)(PPSMC_MSG_NoForcedLevel)) != PPSMC_Result_OK) 1476{
1477 return -EINVAL; 1477 PPSMC_Msg msg;
1478
1479 if (level == RADEON_DPM_FORCED_LEVEL_HIGH) {
1480 if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_ZeroLevelsDisabled) != PPSMC_Result_OK)
1481 return -EINVAL;
1482 msg = PPSMC_MSG_ForceHigh;
1483 } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) {
1484 if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_NoForcedLevel) != PPSMC_Result_OK)
1485 return -EINVAL;
1486 msg = (PPSMC_Msg)(PPSMC_MSG_TwoLevelsDisabled);
1487 } else {
1488 if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_NoForcedLevel) != PPSMC_Result_OK)
1489 return -EINVAL;
1490 msg = (PPSMC_Msg)(PPSMC_MSG_ZeroLevelsDisabled);
1491 }
1478 1492
1479 if (rv770_send_msg_to_smc(rdev, (PPSMC_Msg)(PPSMC_MSG_ZeroLevelsDisabled)) != PPSMC_Result_OK) 1493 if (rv770_send_msg_to_smc(rdev, msg) != PPSMC_Result_OK)
1480 return -EINVAL; 1494 return -EINVAL;
1481 1495
1496 rdev->pm.dpm.forced_level = level;
1497
1482 return 0; 1498 return 0;
1483} 1499}
1484 1500
@@ -2047,9 +2063,10 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev)
2047 if (pi->dcodt) 2063 if (pi->dcodt)
2048 rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps); 2064 rv770_program_dcodt_after_state_switch(rdev, new_ps, old_ps);
2049 rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); 2065 rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps);
2050 ret = rv770_unrestrict_performance_levels_after_switch(rdev); 2066
2067 ret = rv770_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO);
2051 if (ret) { 2068 if (ret) {
2052 DRM_ERROR("rv770_unrestrict_performance_levels_after_switch failed\n"); 2069 DRM_ERROR("rv770_dpm_force_performance_level failed\n");
2053 return ret; 2070 return ret;
2054 } 2071 }
2055 2072
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h
index f1e1fcf7f622..96b1b2a62a8a 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.h
+++ b/drivers/gpu/drm/radeon/rv770_dpm.h
@@ -262,7 +262,8 @@ void rv770_stop_dpm(struct radeon_device *rdev);
262void r7xx_stop_smc(struct radeon_device *rdev); 262void r7xx_stop_smc(struct radeon_device *rdev);
263void rv770_reset_smio_status(struct radeon_device *rdev); 263void rv770_reset_smio_status(struct radeon_device *rdev);
264int rv770_restrict_performance_levels_before_switch(struct radeon_device *rdev); 264int rv770_restrict_performance_levels_before_switch(struct radeon_device *rdev);
265int rv770_unrestrict_performance_levels_after_switch(struct radeon_device *rdev); 265int rv770_dpm_force_performance_level(struct radeon_device *rdev,
266 enum radeon_dpm_forced_level level);
266int rv770_halt_smc(struct radeon_device *rdev); 267int rv770_halt_smc(struct radeon_device *rdev);
267int rv770_resume_smc(struct radeon_device *rdev); 268int rv770_resume_smc(struct radeon_device *rdev);
268int rv770_set_sw_state(struct radeon_device *rdev); 269int rv770_set_sw_state(struct radeon_device *rdev);