diff options
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index c2f5bec272c4..f730ec8b529d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -1303,7 +1303,6 @@ static int polaris10_populate_single_memory_level(struct pp_hwmgr *hwmgr, | |||
1303 | mem_level->VoltageDownHyst = 0; | 1303 | mem_level->VoltageDownHyst = 0; |
1304 | mem_level->ActivityLevel = (uint16_t)data->mclk_activity_target; | 1304 | mem_level->ActivityLevel = (uint16_t)data->mclk_activity_target; |
1305 | mem_level->StutterEnable = false; | 1305 | mem_level->StutterEnable = false; |
1306 | |||
1307 | mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; | 1306 | mem_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; |
1308 | 1307 | ||
1309 | data->display_timing.num_existing_displays = info.display_count; | 1308 | data->display_timing.num_existing_displays = info.display_count; |
@@ -1955,6 +1954,90 @@ static int polaris10_populate_vr_config(struct pp_hwmgr *hwmgr, | |||
1955 | return 0; | 1954 | return 0; |
1956 | } | 1955 | } |
1957 | 1956 | ||
1957 | |||
1958 | int polaris10_populate_avfs_parameters(struct pp_hwmgr *hwmgr) | ||
1959 | { | ||
1960 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | ||
1961 | SMU74_Discrete_DpmTable *table = &(data->smc_state_table); | ||
1962 | int result = 0; | ||
1963 | struct pp_atom_ctrl__avfs_parameters avfs_params = {0}; | ||
1964 | AVFS_meanNsigma_t AVFS_meanNsigma = { {0} }; | ||
1965 | AVFS_Sclk_Offset_t AVFS_SclkOffset = { {0} }; | ||
1966 | uint32_t tmp, i; | ||
1967 | struct pp_smumgr *smumgr = hwmgr->smumgr; | ||
1968 | struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); | ||
1969 | |||
1970 | struct phm_ppt_v1_information *table_info = | ||
1971 | (struct phm_ppt_v1_information *)hwmgr->pptable; | ||
1972 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = | ||
1973 | table_info->vdd_dep_on_sclk; | ||
1974 | |||
1975 | |||
1976 | if (smu_data->avfs.avfs_btc_status == AVFS_BTC_NOTSUPPORTED) | ||
1977 | return result; | ||
1978 | |||
1979 | result = atomctrl_get_avfs_information(hwmgr, &avfs_params); | ||
1980 | |||
1981 | if (0 == result) { | ||
1982 | table->BTCGB_VDROOP_TABLE[0].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a0); | ||
1983 | table->BTCGB_VDROOP_TABLE[0].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a1); | ||
1984 | table->BTCGB_VDROOP_TABLE[0].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSON_a2); | ||
1985 | table->BTCGB_VDROOP_TABLE[1].a0 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a0); | ||
1986 | table->BTCGB_VDROOP_TABLE[1].a1 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a1); | ||
1987 | table->BTCGB_VDROOP_TABLE[1].a2 = PP_HOST_TO_SMC_UL(avfs_params.ulGB_VDROOP_TABLE_CKSOFF_a2); | ||
1988 | table->AVFSGB_VDROOP_TABLE[0].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_m1); | ||
1989 | table->AVFSGB_VDROOP_TABLE[0].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSON_m2); | ||
1990 | table->AVFSGB_VDROOP_TABLE[0].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSON_b); | ||
1991 | table->AVFSGB_VDROOP_TABLE[0].m1_shift = 24; | ||
1992 | table->AVFSGB_VDROOP_TABLE[0].m2_shift = 12; | ||
1993 | table->AVFSGB_VDROOP_TABLE[1].m1 = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_m1); | ||
1994 | table->AVFSGB_VDROOP_TABLE[1].m2 = PP_HOST_TO_SMC_US(avfs_params.usAVFSGB_FUSE_TABLE_CKSOFF_m2); | ||
1995 | table->AVFSGB_VDROOP_TABLE[1].b = PP_HOST_TO_SMC_UL(avfs_params.ulAVFSGB_FUSE_TABLE_CKSOFF_b); | ||
1996 | table->AVFSGB_VDROOP_TABLE[1].m1_shift = 24; | ||
1997 | table->AVFSGB_VDROOP_TABLE[1].m2_shift = 12; | ||
1998 | table->MaxVoltage = PP_HOST_TO_SMC_US(avfs_params.usMaxVoltage_0_25mv); | ||
1999 | AVFS_meanNsigma.Aconstant[0] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant0); | ||
2000 | AVFS_meanNsigma.Aconstant[1] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant1); | ||
2001 | AVFS_meanNsigma.Aconstant[2] = PP_HOST_TO_SMC_UL(avfs_params.ulAVFS_meanNsigma_Acontant2); | ||
2002 | AVFS_meanNsigma.DC_tol_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_DC_tol_sigma); | ||
2003 | AVFS_meanNsigma.Platform_mean = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_mean); | ||
2004 | AVFS_meanNsigma.PSM_Age_CompFactor = PP_HOST_TO_SMC_US(avfs_params.usPSM_Age_ComFactor); | ||
2005 | AVFS_meanNsigma.Platform_sigma = PP_HOST_TO_SMC_US(avfs_params.usAVFS_meanNsigma_Platform_sigma); | ||
2006 | |||
2007 | for (i = 0; i < NUM_VFT_COLUMNS; i++) { | ||
2008 | AVFS_meanNsigma.Static_Voltage_Offset[i] = (uint8_t)(sclk_table->entries[i].cks_voffset * 100 / 625); | ||
2009 | AVFS_SclkOffset.Sclk_Offset[i] = PP_HOST_TO_SMC_US((uint16_t)(sclk_table->entries[i].sclk_offset) / 100); | ||
2010 | } | ||
2011 | |||
2012 | result = polaris10_read_smc_sram_dword(smumgr, | ||
2013 | SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsMeanNSigma), | ||
2014 | &tmp, data->sram_end); | ||
2015 | |||
2016 | polaris10_copy_bytes_to_smc(smumgr, | ||
2017 | tmp, | ||
2018 | (uint8_t *)&AVFS_meanNsigma, | ||
2019 | sizeof(AVFS_meanNsigma_t), | ||
2020 | data->sram_end); | ||
2021 | |||
2022 | result = polaris10_read_smc_sram_dword(smumgr, | ||
2023 | SMU7_FIRMWARE_HEADER_LOCATION + offsetof(SMU74_Firmware_Header, AvfsSclkOffsetTable), | ||
2024 | &tmp, data->sram_end); | ||
2025 | polaris10_copy_bytes_to_smc(smumgr, | ||
2026 | tmp, | ||
2027 | (uint8_t *)&AVFS_SclkOffset, | ||
2028 | sizeof(AVFS_Sclk_Offset_t), | ||
2029 | data->sram_end); | ||
2030 | |||
2031 | data->avfs_vdroop_override_setting = (avfs_params.ucEnableGB_VDROOP_TABLE_CKSON << BTCGB0_Vdroop_Enable_SHIFT) | | ||
2032 | (avfs_params.ucEnableGB_VDROOP_TABLE_CKSOFF << BTCGB1_Vdroop_Enable_SHIFT) | | ||
2033 | (avfs_params.ucEnableGB_FUSE_TABLE_CKSON << AVFSGB0_Vdroop_Enable_SHIFT) | | ||
2034 | (avfs_params.ucEnableGB_FUSE_TABLE_CKSOFF << AVFSGB1_Vdroop_Enable_SHIFT); | ||
2035 | data->apply_avfs_cks_off_voltage = (avfs_params.ucEnableApplyAVFS_CKS_OFF_Voltage == 1) ? true : false; | ||
2036 | } | ||
2037 | return result; | ||
2038 | } | ||
2039 | |||
2040 | |||
1958 | /** | 2041 | /** |
1959 | * Initializes the SMC table and uploads it | 2042 | * Initializes the SMC table and uploads it |
1960 | * | 2043 | * |
@@ -2055,6 +2138,10 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr) | |||
2055 | "Failed to populate Clock Stretcher Data Table!", | 2138 | "Failed to populate Clock Stretcher Data Table!", |
2056 | return result); | 2139 | return result); |
2057 | } | 2140 | } |
2141 | |||
2142 | result = polaris10_populate_avfs_parameters(hwmgr); | ||
2143 | PP_ASSERT_WITH_CODE(0 == result, "Failed to populate AVFS Parameters!", return result;); | ||
2144 | |||
2058 | table->CurrSclkPllRange = 0xff; | 2145 | table->CurrSclkPllRange = 0xff; |
2059 | table->GraphicsVoltageChangeEnable = 1; | 2146 | table->GraphicsVoltageChangeEnable = 1; |
2060 | table->GraphicsThermThrottleEnable = 1; | 2147 | table->GraphicsThermThrottleEnable = 1; |
@@ -2277,7 +2364,6 @@ static int polaris10_enable_sclk_mclk_dpm(struct pp_hwmgr *hwmgr) | |||
2277 | "Failed to enable MCLK DPM during DPM Start Function!", | 2364 | "Failed to enable MCLK DPM during DPM Start Function!", |
2278 | return -1); | 2365 | return -1); |
2279 | 2366 | ||
2280 | |||
2281 | PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); | 2367 | PHM_WRITE_FIELD(hwmgr->device, MC_SEQ_CNTL_3, CAC_EN, 0x1); |
2282 | 2368 | ||
2283 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixLCAC_MC0_CNTL, 0x5); | 2369 | cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixLCAC_MC0_CNTL, 0x5); |