summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
diff options
context:
space:
mode:
authorDarren Powell <darren.powell@amd.com>2020-10-29 18:19:35 -0400
committerAlex Deucher <alexander.deucher@amd.com>2021-02-26 17:17:00 -0500
commitbab0f602918d9fa55d55784d2498336af16f2342 (patch)
tree6cf5eed8370156029dd6a36a4bcc46b371c0c6ec /drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
parent4df144f80d5b67895317833a5e7b9ecc34642bec (diff)
downloadlinux-stable-bab0f602918d9fa55d55784d2498336af16f2342.tar.gz
linux-stable-bab0f602918d9fa55d55784d2498336af16f2342.tar.bz2
linux-stable-bab0f602918d9fa55d55784d2498336af16f2342.zip
amdgpu/pm: Powerplay API for smu , changed 6 dpm reset functions to use API
Modified Functions smu_set_xgmi_pstate() - modifed arg0 to match Powerplay API set_xgmi_pstate smu_mode2_reset() - modifed arg0 to match Powerplay API asic_reset_mode_2 smu_switch_power_profile() - modifed arg0 to match Powerplay API switch_power_profile smu_set_mp1_state() - modifed arg0 to match Powerplay API set_mp1_state smu_set_df_cstate() - modifed arg0 to match Powerplay API set_df_cstate smu_enable_mgpu_fan_boost() - modifed arg0 to match Powerplay API enable_mgpu_fan_boost Other Changes added above smu reset Powerplay functions to swsmu_dpm_funcs removed special smu handling of above functions and called through Powerplay API Signed-off-by: Darren Powell <darren.powell@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@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/swsmu/amdgpu_smu.c')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 1c77444c75b5..ef1dfd1bb294 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1660,10 +1660,11 @@ out:
return ret;
}
-int smu_switch_power_profile(struct smu_context *smu,
+int smu_switch_power_profile(void *handle,
enum PP_SMC_POWER_PROFILE type,
bool en)
{
+ struct smu_context *smu = handle;
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
long workload;
uint32_t index;
@@ -1800,9 +1801,10 @@ int smu_force_clk_levels(struct smu_context *smu,
* However, the mp1 state setting should still be granted
* even if the dpm_enabled cleared.
*/
-int smu_set_mp1_state(struct smu_context *smu,
+int smu_set_mp1_state(void *handle,
enum pp_mp1_state mp1_state)
{
+ struct smu_context *smu = handle;
uint16_t msg;
int ret;
@@ -1839,9 +1841,10 @@ int smu_set_mp1_state(struct smu_context *smu,
return ret;
}
-int smu_set_df_cstate(struct smu_context *smu,
+int smu_set_df_cstate(void *handle,
enum pp_df_cstate state)
{
+ struct smu_context *smu = handle;
int ret = 0;
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
@@ -2440,9 +2443,10 @@ int smu_display_disable_memory_clock_switch(struct smu_context *smu, bool disabl
return ret;
}
-int smu_set_xgmi_pstate(struct smu_context *smu,
+int smu_set_xgmi_pstate(void *handle,
uint32_t pstate)
{
+ struct smu_context *smu = handle;
int ret = 0;
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
@@ -2589,8 +2593,9 @@ int smu_mode1_reset(struct smu_context *smu)
return ret;
}
-int smu_mode2_reset(struct smu_context *smu)
+int smu_mode2_reset(void *handle)
{
+ struct smu_context *smu = handle;
int ret = 0;
if (!smu->pm_enabled)
@@ -2701,8 +2706,9 @@ ssize_t smu_sys_get_gpu_metrics(struct smu_context *smu,
return size;
}
-int smu_enable_mgpu_fan_boost(struct smu_context *smu)
+int smu_enable_mgpu_fan_boost(void *handle)
{
+ struct smu_context *smu = handle;
int ret = 0;
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
@@ -2731,5 +2737,14 @@ int smu_gfx_state_change_set(struct smu_context *smu, uint32_t state)
}
static const struct amd_pm_funcs swsmu_pm_funcs = {
+ /* export for sysfs */
.get_performance_level = smu_get_performance_level,
+ .switch_power_profile = smu_switch_power_profile,
+ /* export to amdgpu */
+ .set_mp1_state = smu_set_mp1_state,
+ /* export to DC */
+ .enable_mgpu_fan_boost = smu_enable_mgpu_fan_boost,
+ .asic_reset_mode_2 = smu_mode2_reset,
+ .set_df_cstate = smu_set_df_cstate,
+ .set_xgmi_pstate = smu_set_xgmi_pstate,
};