summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/pm/powerplay
diff options
context:
space:
mode:
authorEric Huang <jinhuieric.huang@amd.com>2021-03-12 12:43:32 -0500
committerAlex Deucher <alexander.deucher@amd.com>2021-03-23 23:30:55 -0400
commit6e58941cff74aac49659abc8b27740c0457c2397 (patch)
tree40e0e4db9b686cb880e06ac280ae1cc01a78555e /drivers/gpu/drm/amd/pm/powerplay
parent616cf23b6cf40ad6f03ffbddfa1b6c4eb68d8ae1 (diff)
drm/amd/pm: add a new sysfs entry for default power limit
Driver doesn't keep the default bootup power limit and expose it to user. As requested we add it in driver. Signed-off-by: Eric Huang <jinhuieric.huang@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm/powerplay')
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index e0d288208220..ee6340c6f921 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -1034,7 +1034,8 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
return 0;
}
-static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
+static int pp_get_power_limit(void *handle, uint32_t *limit,
+ uint32_t *max_limit, bool default_limit)
{
struct pp_hwmgr *hwmgr = handle;
@@ -1045,9 +1046,12 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
if (default_limit) {
*limit = hwmgr->default_power_limit;
- if (hwmgr->od_enabled) {
- *limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
- *limit /= 100;
+ if (max_limit) {
+ *max_limit = *limit;
+ if (hwmgr->od_enabled) {
+ *max_limit *= (100 + hwmgr->platform_descriptor.TDPODLimit);
+ *max_limit /= 100;
+ }
}
}
else