diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2016-07-12 05:32:36 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-07-29 14:37:00 -0400 |
commit | 990c70ad75a26529d77517c0d22a503f18139683 (patch) | |
tree | 8f27b9c7767881f267fd8afa3d577a2a82f3b8ab | |
parent | ec38f1889a8bf949f53ef9eaf52842f087596edf (diff) |
drm/amd/powerplay: fix issue can't enable vce dpm.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
3 files changed, 22 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c index 423ab6348d3d..b5edb5105986 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c | |||
@@ -131,11 +131,19 @@ int polaris10_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate) | |||
131 | 131 | ||
132 | data->vce_power_gated = bgate; | 132 | data->vce_power_gated = bgate; |
133 | 133 | ||
134 | if (bgate) | 134 | if (bgate) { |
135 | cgs_set_clockgating_state(hwmgr->device, | ||
136 | AMD_IP_BLOCK_TYPE_VCE, | ||
137 | AMD_CG_STATE_GATE); | ||
138 | polaris10_update_vce_dpm(hwmgr, true); | ||
135 | polaris10_phm_powerdown_vce(hwmgr); | 139 | polaris10_phm_powerdown_vce(hwmgr); |
136 | else | 140 | } else { |
137 | polaris10_phm_powerup_vce(hwmgr); | 141 | polaris10_phm_powerup_vce(hwmgr); |
138 | 142 | polaris10_update_vce_dpm(hwmgr, false); | |
143 | cgs_set_clockgating_state(hwmgr->device, | ||
144 | AMD_IP_BLOCK_TYPE_VCE, | ||
145 | AMD_CG_STATE_UNGATE); | ||
146 | } | ||
139 | return 0; | 147 | return 0; |
140 | } | 148 | } |
141 | 149 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index 82d01d7bce60..769636a0c5b5 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -4424,25 +4424,20 @@ int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate) | |||
4424 | return polaris10_enable_disable_uvd_dpm(hwmgr, !bgate); | 4424 | return polaris10_enable_disable_uvd_dpm(hwmgr, !bgate); |
4425 | } | 4425 | } |
4426 | 4426 | ||
4427 | static int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input) | 4427 | int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, bool bgate) |
4428 | { | 4428 | { |
4429 | const struct phm_set_power_state_input *states = | ||
4430 | (const struct phm_set_power_state_input *)input; | ||
4431 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 4429 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
4432 | const struct polaris10_power_state *polaris10_nps = | ||
4433 | cast_const_phw_polaris10_power_state(states->pnew_state); | ||
4434 | const struct polaris10_power_state *polaris10_cps = | ||
4435 | cast_const_phw_polaris10_power_state(states->pcurrent_state); | ||
4436 | |||
4437 | uint32_t mm_boot_level_offset, mm_boot_level_value; | 4430 | uint32_t mm_boot_level_offset, mm_boot_level_value; |
4438 | struct phm_ppt_v1_information *table_info = | 4431 | struct phm_ppt_v1_information *table_info = |
4439 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 4432 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
4440 | 4433 | ||
4441 | if (polaris10_nps->vce_clks.evclk > 0 && | 4434 | if (!bgate) { |
4442 | (polaris10_cps == NULL || polaris10_cps->vce_clks.evclk == 0)) { | 4435 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
4443 | 4436 | PHM_PlatformCaps_StablePState)) | |
4444 | data->smc_state_table.VceBootLevel = | 4437 | data->smc_state_table.VceBootLevel = |
4445 | (uint8_t) (table_info->mm_dep_table->count - 1); | 4438 | (uint8_t) (table_info->mm_dep_table->count - 1); |
4439 | else | ||
4440 | data->smc_state_table.VceBootLevel = 0; | ||
4446 | 4441 | ||
4447 | mm_boot_level_offset = data->dpm_table_start + | 4442 | mm_boot_level_offset = data->dpm_table_start + |
4448 | offsetof(SMU74_Discrete_DpmTable, VceBootLevel); | 4443 | offsetof(SMU74_Discrete_DpmTable, VceBootLevel); |
@@ -4455,18 +4450,14 @@ static int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input) | |||
4455 | cgs_write_ind_register(hwmgr->device, | 4450 | cgs_write_ind_register(hwmgr->device, |
4456 | CGS_IND_REG__SMC, mm_boot_level_offset, mm_boot_level_value); | 4451 | CGS_IND_REG__SMC, mm_boot_level_offset, mm_boot_level_value); |
4457 | 4452 | ||
4458 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) { | 4453 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) |
4459 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, | 4454 | smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, |
4460 | PPSMC_MSG_VCEDPM_SetEnabledMask, | 4455 | PPSMC_MSG_VCEDPM_SetEnabledMask, |
4461 | (uint32_t)1 << data->smc_state_table.VceBootLevel); | 4456 | (uint32_t)1 << data->smc_state_table.VceBootLevel); |
4462 | |||
4463 | polaris10_enable_disable_vce_dpm(hwmgr, true); | ||
4464 | } else if (polaris10_nps->vce_clks.evclk == 0 && | ||
4465 | polaris10_cps != NULL && | ||
4466 | polaris10_cps->vce_clks.evclk > 0) | ||
4467 | polaris10_enable_disable_vce_dpm(hwmgr, false); | ||
4468 | } | 4457 | } |
4469 | 4458 | ||
4459 | polaris10_enable_disable_vce_dpm(hwmgr, !bgate); | ||
4460 | |||
4470 | return 0; | 4461 | return 0; |
4471 | } | 4462 | } |
4472 | 4463 | ||
@@ -4655,11 +4646,6 @@ static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *i | |||
4655 | "Failed to generate DPM level enabled mask!", | 4646 | "Failed to generate DPM level enabled mask!", |
4656 | result = tmp_result); | 4647 | result = tmp_result); |
4657 | 4648 | ||
4658 | tmp_result = polaris10_update_vce_dpm(hwmgr, input); | ||
4659 | PP_ASSERT_WITH_CODE((0 == tmp_result), | ||
4660 | "Failed to update VCE DPM!", | ||
4661 | result = tmp_result); | ||
4662 | |||
4663 | tmp_result = polaris10_update_sclk_threshold(hwmgr); | 4649 | tmp_result = polaris10_update_sclk_threshold(hwmgr); |
4664 | PP_ASSERT_WITH_CODE((0 == tmp_result), | 4650 | PP_ASSERT_WITH_CODE((0 == tmp_result), |
4665 | "Failed to update SCLK threshold!", | 4651 | "Failed to update SCLK threshold!", |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h index dbc6d9bfd5af..33c33947e827 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h | |||
@@ -352,6 +352,6 @@ int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr); | |||
352 | int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); | 352 | int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate); |
353 | int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate); | 353 | int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate); |
354 | int polaris10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); | 354 | int polaris10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable); |
355 | 355 | int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, bool bgate); | |
356 | #endif | 356 | #endif |
357 | 357 | ||