Skip to content

Commit

Permalink
drm/amdgpu/smu11: add a helper to set the power source
Browse files Browse the repository at this point in the history
Add a common smu11 helper to set the AC/DC power source.

Bug: https://gitlab.freedesktop.org/drm/amd/issues/1043
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Mar 25, 2020
1 parent 2c02b38 commit f8c8321
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,7 @@ uint32_t smu_v11_0_get_max_power_limit(struct smu_context *smu);
int smu_v11_0_set_performance_level(struct smu_context *smu,
enum amd_dpm_forced_level level);

int smu_v11_0_set_power_source(struct smu_context *smu,
enum smu_power_src_type power_src);

#endif
15 changes: 15 additions & 0 deletions drivers/gpu/drm/amd/powerplay/smu_v11_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,3 +1939,18 @@ int smu_v11_0_set_performance_level(struct smu_context *smu,
return ret;
}

int smu_v11_0_set_power_source(struct smu_context *smu,
enum smu_power_src_type power_src)
{
int pwr_source;

pwr_source = smu_power_get_index(smu, (uint32_t)power_src);
if (pwr_source < 0)
return -EINVAL;

return smu_send_smc_msg_with_param(smu,
SMU_MSG_NotifyPowerSource,
pwr_source,
NULL);
}

0 comments on commit f8c8321

Please sign in to comment.