Commit fbbcb3f2 authored by Ma Jun's avatar Ma Jun Committed by Alex Deucher

drm/amd/pm: Fix return value and drop redundant param

Fix the return value and drop redundant parameter
of get_asic_baco_capability function.
Signed-off-by: default avatarMa Jun <Jun.Ma2@amd.com>
Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 94e2dae0
...@@ -421,7 +421,7 @@ struct amd_pm_funcs { ...@@ -421,7 +421,7 @@ struct amd_pm_funcs {
int (*set_hard_min_dcefclk_by_freq)(void *handle, uint32_t clock); int (*set_hard_min_dcefclk_by_freq)(void *handle, uint32_t clock);
int (*set_hard_min_fclk_by_freq)(void *handle, uint32_t clock); int (*set_hard_min_fclk_by_freq)(void *handle, uint32_t clock);
int (*set_min_deep_sleep_dcefclk)(void *handle, uint32_t clock); int (*set_min_deep_sleep_dcefclk)(void *handle, uint32_t clock);
int (*get_asic_baco_capability)(void *handle, bool *cap); bool (*get_asic_baco_capability)(void *handle);
int (*get_asic_baco_state)(void *handle, int *state); int (*get_asic_baco_state)(void *handle, int *state);
int (*set_asic_baco_state)(void *handle, int state); int (*set_asic_baco_state)(void *handle, int state);
int (*get_ppfeature_status)(void *handle, char *buf); int (*get_ppfeature_status)(void *handle, char *buf);
......
...@@ -185,8 +185,7 @@ bool amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev) ...@@ -185,8 +185,7 @@ bool amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
{ {
const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
void *pp_handle = adev->powerplay.pp_handle; void *pp_handle = adev->powerplay.pp_handle;
bool baco_cap; bool ret;
int ret = 0;
if (!pp_funcs || !pp_funcs->get_asic_baco_capability) if (!pp_funcs || !pp_funcs->get_asic_baco_capability)
return false; return false;
...@@ -204,12 +203,11 @@ bool amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev) ...@@ -204,12 +203,11 @@ bool amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
mutex_lock(&adev->pm.mutex); mutex_lock(&adev->pm.mutex);
ret = pp_funcs->get_asic_baco_capability(pp_handle, ret = pp_funcs->get_asic_baco_capability(pp_handle);
&baco_cap);
mutex_unlock(&adev->pm.mutex); mutex_unlock(&adev->pm.mutex);
return ret ? false : baco_cap; return ret;
} }
int amdgpu_dpm_mode2_reset(struct amdgpu_device *adev) int amdgpu_dpm_mode2_reset(struct amdgpu_device *adev)
......
...@@ -1371,21 +1371,18 @@ static int pp_set_active_display_count(void *handle, uint32_t count) ...@@ -1371,21 +1371,18 @@ static int pp_set_active_display_count(void *handle, uint32_t count)
return phm_set_active_display_count(hwmgr, count); return phm_set_active_display_count(hwmgr, count);
} }
static int pp_get_asic_baco_capability(void *handle, bool *cap) static bool pp_get_asic_baco_capability(void *handle)
{ {
struct pp_hwmgr *hwmgr = handle; struct pp_hwmgr *hwmgr = handle;
*cap = false;
if (!hwmgr) if (!hwmgr)
return -EINVAL; return false;
if (!(hwmgr->not_vf && amdgpu_dpm) || if (!(hwmgr->not_vf && amdgpu_dpm) ||
!hwmgr->hwmgr_func->get_asic_baco_capability) !hwmgr->hwmgr_func->get_asic_baco_capability)
return 0; return false;
hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr, cap);
return 0; return hwmgr->hwmgr_func->get_asic_baco_capability(hwmgr);
} }
static int pp_get_asic_baco_state(void *handle, int *state) static int pp_get_asic_baco_state(void *handle, int *state)
......
...@@ -33,21 +33,20 @@ ...@@ -33,21 +33,20 @@
#include "smu/smu_7_1_2_d.h" #include "smu/smu_7_1_2_d.h"
#include "smu/smu_7_1_2_sh_mask.h" #include "smu/smu_7_1_2_sh_mask.h"
int smu7_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap) bool smu7_baco_get_capability(struct pp_hwmgr *hwmgr)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
uint32_t reg; uint32_t reg;
*cap = false;
if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO))
return 0; return 0;
reg = RREG32(mmCC_BIF_BX_FUSESTRAP0); reg = RREG32(mmCC_BIF_BX_FUSESTRAP0);
if (reg & CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK) if (reg & CC_BIF_BX_FUSESTRAP0__STRAP_BIF_PX_CAPABLE_MASK)
*cap = true; return true;
return 0; return false;
} }
int smu7_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state) int smu7_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "hwmgr.h" #include "hwmgr.h"
#include "common_baco.h" #include "common_baco.h"
extern int smu7_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap); extern bool smu7_baco_get_capability(struct pp_hwmgr *hwmgr);
extern int smu7_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); extern int smu7_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state);
extern int smu7_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state); extern int smu7_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state);
......
...@@ -28,14 +28,13 @@ ...@@ -28,14 +28,13 @@
#include "vega10_inc.h" #include "vega10_inc.h"
#include "smu9_baco.h" #include "smu9_baco.h"
int smu9_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap) bool smu9_baco_get_capability(struct pp_hwmgr *hwmgr)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
uint32_t reg, data; uint32_t reg, data;
*cap = false;
if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO))
return 0; return false;
WREG32(0x12074, 0xFFF0003B); WREG32(0x12074, 0xFFF0003B);
data = RREG32(0x12075); data = RREG32(0x12075);
...@@ -44,10 +43,10 @@ int smu9_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap) ...@@ -44,10 +43,10 @@ int smu9_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap)
reg = RREG32_SOC15(NBIF, 0, mmRCC_BIF_STRAP0); reg = RREG32_SOC15(NBIF, 0, mmRCC_BIF_STRAP0);
if (reg & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) if (reg & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK)
*cap = true; return true;
} }
return 0; return false;
} }
int smu9_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state) int smu9_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "hwmgr.h" #include "hwmgr.h"
#include "common_baco.h" #include "common_baco.h"
extern int smu9_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap); extern bool smu9_baco_get_capability(struct pp_hwmgr *hwmgr);
extern int smu9_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); extern int smu9_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state);
#endif #endif
...@@ -36,23 +36,22 @@ static const struct soc15_baco_cmd_entry clean_baco_tbl[] = { ...@@ -36,23 +36,22 @@ static const struct soc15_baco_cmd_entry clean_baco_tbl[] = {
{CMD_WRITE, SOC15_REG_ENTRY(NBIF, 0, mmBIOS_SCRATCH_7), 0, 0, 0, 0}, {CMD_WRITE, SOC15_REG_ENTRY(NBIF, 0, mmBIOS_SCRATCH_7), 0, 0, 0, 0},
}; };
int vega20_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap) bool vega20_baco_get_capability(struct pp_hwmgr *hwmgr)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
uint32_t reg; uint32_t reg;
*cap = false;
if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO)) if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_BACO))
return 0; return false;
if (((RREG32(0x17569) & 0x20000000) >> 29) == 0x1) { if (((RREG32(0x17569) & 0x20000000) >> 29) == 0x1) {
reg = RREG32_SOC15(NBIF, 0, mmRCC_BIF_STRAP0); reg = RREG32_SOC15(NBIF, 0, mmRCC_BIF_STRAP0);
if (reg & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) if (reg & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK)
*cap = true; return true;
} }
return 0; return false;
} }
int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state) int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state)
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "hwmgr.h" #include "hwmgr.h"
#include "common_baco.h" #include "common_baco.h"
extern int vega20_baco_get_capability(struct pp_hwmgr *hwmgr, bool *cap); extern bool vega20_baco_get_capability(struct pp_hwmgr *hwmgr);
extern int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); extern int vega20_baco_get_state(struct pp_hwmgr *hwmgr, enum BACO_STATE *state);
extern int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state); extern int vega20_baco_set_state(struct pp_hwmgr *hwmgr, enum BACO_STATE state);
extern int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr); extern int vega20_baco_apply_vdci_flush_workaround(struct pp_hwmgr *hwmgr);
......
...@@ -351,7 +351,7 @@ struct pp_hwmgr_func { ...@@ -351,7 +351,7 @@ struct pp_hwmgr_func {
int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock); int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock);
int (*set_hard_min_gfxclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock); int (*set_hard_min_gfxclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock);
int (*set_soft_max_gfxclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock); int (*set_soft_max_gfxclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock);
int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr, bool *cap); bool (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr);
int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE *state);
int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE state); int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE state);
int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr, char *buf); int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr, char *buf);
......
...@@ -3005,19 +3005,17 @@ static int smu_set_xgmi_pstate(void *handle, ...@@ -3005,19 +3005,17 @@ static int smu_set_xgmi_pstate(void *handle,
return ret; return ret;
} }
static int smu_get_baco_capability(void *handle, bool *cap) static bool smu_get_baco_capability(void *handle)
{ {
struct smu_context *smu = handle; struct smu_context *smu = handle;
*cap = false;
if (!smu->pm_enabled) if (!smu->pm_enabled)
return 0; return false;
if (smu->ppt_funcs && smu->ppt_funcs->baco_is_support) if (!smu->ppt_funcs || !smu->ppt_funcs->baco_is_support)
*cap = smu->ppt_funcs->baco_is_support(smu); return false;
return 0; return smu->ppt_funcs->baco_is_support(smu);
} }
static int smu_baco_set_state(void *handle, int state) static int smu_baco_set_state(void *handle, int state)
......
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