aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2017-04-27 03:48:56 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-04-28 17:33:16 -0400
commit8b9242eddd51f17b8306d6c96172fd68ef1106c6 (patch)
treee5af18519679d9f773cd1cf6548bc9f2d0c23de0 /drivers/gpu
parentf8dc9476d9fe25b982e642a733967d7b5fbe5ae3 (diff)
drm/amd/powerplay: implement stop dpm task for vega10.
Add functions to disable dpm for S3/S4. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c97
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c23
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.h1
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.h1
5 files changed, 123 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 5e3e89be9fb6..68eae529df50 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -2420,6 +2420,26 @@ static int vega10_enable_thermal_protection(struct pp_hwmgr *hwmgr)
2420 return 0; 2420 return 0;
2421} 2421}
2422 2422
2423static int vega10_disable_thermal_protection(struct pp_hwmgr *hwmgr)
2424{
2425 struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
2426
2427 if (data->smu_features[GNLD_THERMAL].supported) {
2428 if (!data->smu_features[GNLD_THERMAL].enabled)
2429 pr_info("THERMAL Feature Already disabled!");
2430
2431 PP_ASSERT_WITH_CODE(
2432 !vega10_enable_smc_features(hwmgr->smumgr,
2433 false,
2434 data->smu_features[GNLD_THERMAL].smu_feature_bitmap),
2435 "disable THERMAL Feature Failed!",
2436 return -1);
2437 data->smu_features[GNLD_THERMAL].enabled = false;
2438 }
2439
2440 return 0;
2441}
2442
2423static int vega10_enable_vrhot_feature(struct pp_hwmgr *hwmgr) 2443static int vega10_enable_vrhot_feature(struct pp_hwmgr *hwmgr)
2424{ 2444{
2425 struct vega10_hwmgr *data = 2445 struct vega10_hwmgr *data =
@@ -2498,6 +2518,37 @@ static int vega10_enable_deep_sleep_master_switch(struct pp_hwmgr *hwmgr)
2498 return 0; 2518 return 0;
2499} 2519}
2500 2520
2521static int vega10_stop_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap)
2522{
2523 struct vega10_hwmgr *data =
2524 (struct vega10_hwmgr *)(hwmgr->backend);
2525 uint32_t i, feature_mask = 0;
2526
2527
2528 if(data->smu_features[GNLD_LED_DISPLAY].supported == true){
2529 PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr->smumgr,
2530 true, data->smu_features[GNLD_LED_DISPLAY].smu_feature_bitmap),
2531 "Attempt to Enable LED DPM feature Failed!", return -EINVAL);
2532 data->smu_features[GNLD_LED_DISPLAY].enabled = true;
2533 }
2534
2535 for (i = 0; i < GNLD_DPM_MAX; i++) {
2536 if (data->smu_features[i].smu_feature_bitmap & bitmap) {
2537 if (data->smu_features[i].supported) {
2538 if (data->smu_features[i].enabled) {
2539 feature_mask |= data->smu_features[i].
2540 smu_feature_bitmap;
2541 data->smu_features[i].enabled = false;
2542 }
2543 }
2544 }
2545 }
2546
2547 vega10_enable_smc_features(hwmgr->smumgr, false, feature_mask);
2548
2549 return 0;
2550}
2551
2501/** 2552/**
2502 * @brief Tell SMC to enabled the supported DPMs. 2553 * @brief Tell SMC to enabled the supported DPMs.
2503 * 2554 *
@@ -4356,11 +4407,55 @@ vega10_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmg
4356 return is_update_required; 4407 return is_update_required;
4357} 4408}
4358 4409
4410static int vega10_disable_dpm_tasks(struct pp_hwmgr *hwmgr)
4411{
4412 int tmp_result, result = 0;
4413
4414 tmp_result = (vega10_is_dpm_running(hwmgr)) ? 0 : -1;
4415 PP_ASSERT_WITH_CODE(tmp_result == 0,
4416 "DPM is not running right now, no need to disable DPM!",
4417 return 0);
4418
4419 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
4420 PHM_PlatformCaps_ThermalController))
4421 vega10_disable_thermal_protection(hwmgr);
4422
4423 tmp_result = vega10_disable_power_containment(hwmgr);
4424 PP_ASSERT_WITH_CODE((tmp_result == 0),
4425 "Failed to disable power containment!", result = tmp_result);
4426
4427 tmp_result = vega10_avfs_enable(hwmgr, false);
4428 PP_ASSERT_WITH_CODE((tmp_result == 0),
4429 "Failed to disable AVFS!", result = tmp_result);
4430
4431 tmp_result = vega10_stop_dpm(hwmgr, SMC_DPM_FEATURES);
4432 PP_ASSERT_WITH_CODE((tmp_result == 0),
4433 "Failed to stop DPM!", result = tmp_result);
4434
4435 return result;
4436}
4437
4438static int vega10_power_off_asic(struct pp_hwmgr *hwmgr)
4439{
4440 struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
4441 int result;
4442
4443 result = vega10_disable_dpm_tasks(hwmgr);
4444 PP_ASSERT_WITH_CODE((0 == result),
4445 "[disable_dpm_tasks] Failed to disable DPM!",
4446 );
4447 data->water_marks_bitmap &= ~(WaterMarksLoaded);
4448
4449 return result;
4450}
4451
4452
4359static const struct pp_hwmgr_func vega10_hwmgr_funcs = { 4453static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
4360 .backend_init = vega10_hwmgr_backend_init, 4454 .backend_init = vega10_hwmgr_backend_init,
4361 .backend_fini = vega10_hwmgr_backend_fini, 4455 .backend_fini = vega10_hwmgr_backend_fini,
4362 .asic_setup = vega10_setup_asic_task, 4456 .asic_setup = vega10_setup_asic_task,
4363 .dynamic_state_management_enable = vega10_enable_dpm_tasks, 4457 .dynamic_state_management_enable = vega10_enable_dpm_tasks,
4458 .dynamic_state_management_disable = vega10_disable_dpm_tasks,
4364 .get_num_of_pp_table_entries = 4459 .get_num_of_pp_table_entries =
4365 vega10_get_number_of_powerplay_table_entries, 4460 vega10_get_number_of_powerplay_table_entries,
4366 .get_power_state_size = vega10_get_power_state_size, 4461 .get_power_state_size = vega10_get_power_state_size,
@@ -4400,6 +4495,8 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
4400 .check_states_equal = vega10_check_states_equal, 4495 .check_states_equal = vega10_check_states_equal,
4401 .check_smc_update_required_for_display_configuration = 4496 .check_smc_update_required_for_display_configuration =
4402 vega10_check_smc_update_required_for_display_configuration, 4497 vega10_check_smc_update_required_for_display_configuration,
4498 .power_off_asic = vega10_power_off_asic,
4499 .disable_smc_firmware_ctf = vega10_thermal_disable_alert,
4403}; 4500};
4404 4501
4405int vega10_hwmgr_init(struct pp_hwmgr *hwmgr) 4502int vega10_hwmgr_init(struct pp_hwmgr *hwmgr)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
index f1e244cd2370..692f752fbb27 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c
@@ -113,6 +113,29 @@ int vega10_enable_power_containment(struct pp_hwmgr *hwmgr)
113 return result; 113 return result;
114} 114}
115 115
116int vega10_disable_power_containment(struct pp_hwmgr *hwmgr)
117{
118 struct vega10_hwmgr *data =
119 (struct vega10_hwmgr *)(hwmgr->backend);
120
121 if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
122 PHM_PlatformCaps_PowerContainment)) {
123 if (data->smu_features[GNLD_PPT].supported)
124 PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr->smumgr,
125 false, data->smu_features[GNLD_PPT].smu_feature_bitmap),
126 "Attempt to disable PPT feature Failed!",
127 data->smu_features[GNLD_PPT].supported = false);
128
129 if (data->smu_features[GNLD_TDC].supported)
130 PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr->smumgr,
131 false, data->smu_features[GNLD_TDC].smu_feature_bitmap),
132 "Attempt to disable PPT feature Failed!",
133 data->smu_features[GNLD_TDC].supported = false);
134 }
135
136 return 0;
137}
138
116static int vega10_set_overdrive_target_percentage(struct pp_hwmgr *hwmgr, 139static int vega10_set_overdrive_target_percentage(struct pp_hwmgr *hwmgr,
117 uint32_t adjust_percent) 140 uint32_t adjust_percent)
118{ 141{
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.h
index d9662bf4a4b4..9ecaa27c0bb5 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.h
@@ -60,6 +60,7 @@ int vega10_enable_smc_cac(struct pp_hwmgr *hwmgr);
60int vega10_enable_power_containment(struct pp_hwmgr *hwmgr); 60int vega10_enable_power_containment(struct pp_hwmgr *hwmgr);
61int vega10_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n); 61int vega10_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n);
62int vega10_power_control_set_level(struct pp_hwmgr *hwmgr); 62int vega10_power_control_set_level(struct pp_hwmgr *hwmgr);
63int vega10_disable_power_containment(struct pp_hwmgr *hwmgr);
63 64
64#endif /* _VEGA10_POWERTUNE_H_ */ 65#endif /* _VEGA10_POWERTUNE_H_ */
65 66
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
index f4d77b62e1ba..7062ec8cc4ac 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
@@ -501,7 +501,7 @@ static int vega10_thermal_enable_alert(struct pp_hwmgr *hwmgr)
501* Disable thermal alerts on the RV770 thermal controller. 501* Disable thermal alerts on the RV770 thermal controller.
502* @param hwmgr The address of the hardware manager. 502* @param hwmgr The address of the hardware manager.
503*/ 503*/
504static int vega10_thermal_disable_alert(struct pp_hwmgr *hwmgr) 504int vega10_thermal_disable_alert(struct pp_hwmgr *hwmgr)
505{ 505{
506 struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend); 506 struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
507 507
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.h
index 8036808ec421..70c1d22b3d7d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.h
@@ -78,6 +78,7 @@ extern int vega10_fan_ctrl_get_fan_speed_rpm(struct pp_hwmgr *hwmgr,
78 uint32_t *speed); 78 uint32_t *speed);
79extern int vega10_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr); 79extern int vega10_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr);
80extern uint32_t smu7_get_xclk(struct pp_hwmgr *hwmgr); 80extern uint32_t smu7_get_xclk(struct pp_hwmgr *hwmgr);
81extern int vega10_thermal_disable_alert(struct pp_hwmgr *hwmgr);
81 82
82#endif 83#endif
83 84