diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2017-02-15 02:48:40 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-02-22 17:54:23 -0500 |
commit | 187368a5c7ad6c41159b85025a87d6d136eb8d4b (patch) | |
tree | 6771c4d84cfcb23c619cb88e4b0fcb8fd9cfc0b6 | |
parent | 4694335dad7357e9b3d7822ab13049014d74d8b0 (diff) |
drm/amd/powerplay: fix PSI feature on Polars12.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 files changed, 36 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c index 4b0a94cc995e..953e0c9ad7cd 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | |||
@@ -1396,3 +1396,25 @@ int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, | |||
1396 | 1396 | ||
1397 | return 0; | 1397 | return 0; |
1398 | } | 1398 | } |
1399 | |||
1400 | int atomctrl_get_svi2_info(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | ||
1401 | uint8_t *svd_gpio_id, uint8_t *svc_gpio_id, | ||
1402 | uint16_t *load_line) | ||
1403 | { | ||
1404 | ATOM_VOLTAGE_OBJECT_INFO_V3_1 *voltage_info = | ||
1405 | (ATOM_VOLTAGE_OBJECT_INFO_V3_1 *)get_voltage_info_table(hwmgr->device); | ||
1406 | |||
1407 | const ATOM_VOLTAGE_OBJECT_V3 *voltage_object; | ||
1408 | |||
1409 | PP_ASSERT_WITH_CODE((NULL != voltage_info), | ||
1410 | "Could not find Voltage Table in BIOS.", return -EINVAL); | ||
1411 | |||
1412 | voltage_object = atomctrl_lookup_voltage_type_v3 | ||
1413 | (voltage_info, voltage_type, VOLTAGE_OBJ_SVID2); | ||
1414 | |||
1415 | *svd_gpio_id = voltage_object->asSVID2Obj.ucSVDGpioId; | ||
1416 | *svc_gpio_id = voltage_object->asSVID2Obj.ucSVCGpioId; | ||
1417 | *load_line = voltage_object->asSVID2Obj.usLoadLine_PSI; | ||
1418 | |||
1419 | return 0; | ||
1420 | } | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h index fc898afce002..e9fe2e84006b 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h | |||
@@ -311,5 +311,8 @@ extern int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_a | |||
311 | 311 | ||
312 | extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); | 312 | extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_ctrl__avfs_parameters *param); |
313 | 313 | ||
314 | extern int atomctrl_get_svi2_info(struct pp_hwmgr *hwmgr, uint8_t voltage_type, | ||
315 | uint8_t *svd_gpio_id, uint8_t *svc_gpio_id, | ||
316 | uint16_t *load_line); | ||
314 | #endif | 317 | #endif |
315 | 318 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index b1de9e8ccdbc..f75ee33ec5bb 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -1383,6 +1383,15 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
1383 | data->force_pcie_gen = PP_PCIEGenInvalid; | 1383 | data->force_pcie_gen = PP_PCIEGenInvalid; |
1384 | data->ulv_supported = hwmgr->feature_mask & PP_ULV_MASK ? true : false; | 1384 | data->ulv_supported = hwmgr->feature_mask & PP_ULV_MASK ? true : false; |
1385 | 1385 | ||
1386 | if (hwmgr->chip_id == CHIP_POLARIS12 || hwmgr->smumgr->is_kicker) { | ||
1387 | uint8_t tmp1, tmp2; | ||
1388 | uint16_t tmp3 = 0; | ||
1389 | atomctrl_get_svi2_info(hwmgr, VOLTAGE_TYPE_VDDC, &tmp1, &tmp2, | ||
1390 | &tmp3); | ||
1391 | tmp3 = (tmp3 >> 5) & 0x3; | ||
1392 | data->vddc_phase_shed_control = ((tmp3 << 1) | (tmp3 >> 1)) & 0x3; | ||
1393 | } | ||
1394 | |||
1386 | data->fast_watermark_threshold = 100; | 1395 | data->fast_watermark_threshold = 100; |
1387 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, | 1396 | if (atomctrl_is_voltage_controled_by_gpio_v3(hwmgr, |
1388 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) | 1397 | VOLTAGE_TYPE_VDDC, VOLTAGE_OBJ_SVID2)) |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h index 27e7f76ad8a6..f221e17b67e7 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h | |||
@@ -268,7 +268,7 @@ struct smu7_hwmgr { | |||
268 | uint32_t fast_watermark_threshold; | 268 | uint32_t fast_watermark_threshold; |
269 | 269 | ||
270 | /* ---- Phase Shedding ---- */ | 270 | /* ---- Phase Shedding ---- */ |
271 | bool vddc_phase_shed_control; | 271 | uint8_t vddc_phase_shed_control; |
272 | 272 | ||
273 | /* ---- DI/DT ---- */ | 273 | /* ---- DI/DT ---- */ |
274 | struct smu7_display_timing display_timing; | 274 | struct smu7_display_timing display_timing; |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c index c6c3c5751ac7..80e2329a1b9e 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c | |||
@@ -503,7 +503,7 @@ static int polaris10_populate_ulv_level(struct pp_hwmgr *hwmgr, | |||
503 | state->VddcOffsetVid = (uint8_t)(table_info->us_ulv_voltage_offset * | 503 | state->VddcOffsetVid = (uint8_t)(table_info->us_ulv_voltage_offset * |
504 | VOLTAGE_VID_OFFSET_SCALE2 / VOLTAGE_VID_OFFSET_SCALE1); | 504 | VOLTAGE_VID_OFFSET_SCALE2 / VOLTAGE_VID_OFFSET_SCALE1); |
505 | 505 | ||
506 | if (smumgr->is_kicker) | 506 | if (smumgr->chip_id == CHIP_POLARIS12 || smumgr->is_kicker) |
507 | state->VddcPhase = data->vddc_phase_shed_control ^ 0x3; | 507 | state->VddcPhase = data->vddc_phase_shed_control ^ 0x3; |
508 | else | 508 | else |
509 | state->VddcPhase = (data->vddc_phase_shed_control) ? 0 : 1; | 509 | state->VddcPhase = (data->vddc_phase_shed_control) ? 0 : 1; |