Commit 9f8ccae9 authored by Tom St Denis's avatar Tom St Denis Committed by Alex Deucher

drm/amd/powerplay: Tidy up smu7_enable_didt()

Signed-off-by: default avatarTom St Denis <tom.stdenis@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0120ad13
...@@ -629,7 +629,6 @@ static int smu7_enable_didt(struct pp_hwmgr *hwmgr, const bool enable) ...@@ -629,7 +629,6 @@ static int smu7_enable_didt(struct pp_hwmgr *hwmgr, const bool enable)
uint32_t block_en = 0; uint32_t block_en = 0;
int32_t result = 0; int32_t result = 0;
uint32_t didt_block; uint32_t didt_block;
uint32_t data;
if (hwmgr->chip_id == CHIP_POLARIS11) if (hwmgr->chip_id == CHIP_POLARIS11)
didt_block = Polaris11_DIDTBlock_Info; didt_block = Polaris11_DIDTBlock_Info;
...@@ -637,41 +636,29 @@ static int smu7_enable_didt(struct pp_hwmgr *hwmgr, const bool enable) ...@@ -637,41 +636,29 @@ static int smu7_enable_didt(struct pp_hwmgr *hwmgr, const bool enable)
didt_block = DIDTBlock_Info; didt_block = DIDTBlock_Info;
block_en = PP_CAP(PHM_PlatformCaps_SQRamping) ? en : 0; block_en = PP_CAP(PHM_PlatformCaps_SQRamping) ? en : 0;
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_SQ_CTRL0); DIDT_SQ_CTRL0, DIDT_CTRL_EN, block_en);
data &= ~DIDT_SQ_CTRL0__DIDT_CTRL_EN_MASK;
data |= ((block_en << DIDT_SQ_CTRL0__DIDT_CTRL_EN__SHIFT) & DIDT_SQ_CTRL0__DIDT_CTRL_EN_MASK);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_SQ_CTRL0, data);
didt_block &= ~SQ_Enable_MASK; didt_block &= ~SQ_Enable_MASK;
didt_block |= block_en << SQ_Enable_SHIFT; didt_block |= block_en << SQ_Enable_SHIFT;
block_en = PP_CAP(PHM_PlatformCaps_DBRamping) ? en : 0; block_en = PP_CAP(PHM_PlatformCaps_DBRamping) ? en : 0;
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_DB_CTRL0); DIDT_DB_CTRL0, DIDT_CTRL_EN, block_en);
data &= ~DIDT_DB_CTRL0__DIDT_CTRL_EN_MASK;
data |= ((block_en << DIDT_DB_CTRL0__DIDT_CTRL_EN__SHIFT) & DIDT_DB_CTRL0__DIDT_CTRL_EN_MASK);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_DB_CTRL0, data);
didt_block &= ~DB_Enable_MASK; didt_block &= ~DB_Enable_MASK;
didt_block |= block_en << DB_Enable_SHIFT; didt_block |= block_en << DB_Enable_SHIFT;
block_en = PP_CAP(PHM_PlatformCaps_TDRamping) ? en : 0; block_en = PP_CAP(PHM_PlatformCaps_TDRamping) ? en : 0;
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_TD_CTRL0); CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
data &= ~DIDT_TD_CTRL0__DIDT_CTRL_EN_MASK; DIDT_TD_CTRL0, DIDT_CTRL_EN, block_en);
data |= ((block_en << DIDT_TD_CTRL0__DIDT_CTRL_EN__SHIFT) & DIDT_TD_CTRL0__DIDT_CTRL_EN_MASK);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_TD_CTRL0, data);
didt_block &= ~TD_Enable_MASK; didt_block &= ~TD_Enable_MASK;
didt_block |= block_en << TD_Enable_SHIFT; didt_block |= block_en << TD_Enable_SHIFT;
block_en = PP_CAP(PHM_PlatformCaps_TCPRamping) ? en : 0; block_en = PP_CAP(PHM_PlatformCaps_TCPRamping) ? en : 0;
CGS_WREG32_FIELD_IND(hwmgr->device, CGS_IND_REG__DIDT,
data = cgs_read_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_TCP_CTRL0); DIDT_TCP_CTRL0, DIDT_CTRL_EN, block_en);
data &= ~DIDT_TCP_CTRL0__DIDT_CTRL_EN_MASK;
data |= ((block_en << DIDT_TCP_CTRL0__DIDT_CTRL_EN__SHIFT) & DIDT_TCP_CTRL0__DIDT_CTRL_EN_MASK);
cgs_write_ind_register(hwmgr->device, CGS_IND_REG__DIDT, ixDIDT_TCP_CTRL0, data);
didt_block &= ~TCP_Enable_MASK; didt_block &= ~TCP_Enable_MASK;
didt_block |= block_en << TCP_Enable_SHIFT; didt_block |= block_en << TCP_Enable_SHIFT;
if (enable) if (enable)
result = smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_Didt_Block_Function, didt_block); result = smum_send_msg_to_smc_with_parameter(hwmgr->smumgr, PPSMC_MSG_Didt_Block_Function, didt_block);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment