Drop unused APIs, variables and argument.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
return r;
if (is_support_sw_smu(adev)) {
- smu_get_power_limit(&adev->smu, &limit, true, true);
+ smu_get_power_limit(&adev->smu, &limit, true);
size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000);
} else if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_power_limit) {
adev->powerplay.pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, true);
return r;
if (is_support_sw_smu(adev)) {
- smu_get_power_limit(&adev->smu, &limit, false, true);
+ smu_get_power_limit(&adev->smu, &limit, false);
size = snprintf(buf, PAGE_SIZE, "%u\n", limit * 1000000);
} else if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_power_limit) {
adev->powerplay.pp_funcs->get_power_limit(adev->powerplay.pp_handle, &limit, false);
int smu_get_power_limit(struct smu_context *smu,
uint32_t *limit,
- bool def,
- bool lock_needed)
+ bool max_setting)
{
- int ret = 0;
-
- if (lock_needed) {
- if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
- return -EOPNOTSUPP;
+ if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
+ return -EOPNOTSUPP;
- mutex_lock(&smu->mutex);
- }
+ mutex_lock(&smu->mutex);
- *limit = (def ? smu->max_power_limit : smu->current_power_limit);
+ *limit = (max_setting ? smu->max_power_limit : smu->current_power_limit);
- if (lock_needed)
- mutex_unlock(&smu->mutex);
+ mutex_unlock(&smu->mutex);
- return ret;
+ return 0;
}
int smu_set_power_limit(struct smu_context *smu, uint32_t limit)
return (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true : false;
}
-static uint32_t arcturus_get_pptable_power_limit(struct smu_context *smu)
-{
- PPTable_t *pptable = smu->smu_table.driver_pptable;
-
- return pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0];
-}
-
static int arcturus_set_df_cstate(struct smu_context *smu,
enum pp_df_cstate state)
{
return 0;
}
-static uint32_t atcturus_get_max_power_limit(struct smu_context *smu) {
- uint32_t od_limit, max_power_limit;
- struct smu_11_0_powerplay_table *powerplay_table = NULL;
- struct smu_table_context *table_context = &smu->smu_table;
- powerplay_table = table_context->power_play_table;
-
- max_power_limit = arcturus_get_pptable_power_limit(smu);
-
- if (!max_power_limit) {
- // If we couldn't get the table limit, fall back on first-read value
- if (!smu->default_power_limit)
- smu->default_power_limit = smu->power_limit;
- max_power_limit = smu->default_power_limit;
- }
-
- if (smu->od_enabled) {
- od_limit = le32_to_cpu(powerplay_table->overdrive_table.max[SMU_11_0_ODSETTING_POWERPERCENTAGE]);
-
- dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n", od_limit, smu->default_power_limit);
-
- max_power_limit *= (100 + od_limit);
- max_power_limit /= 100;
- }
-
- return max_power_limit;
-}
-
static const struct pptable_funcs arcturus_ppt_funcs = {
/* translate smu index into arcturus specific index */
.get_smu_msg_index = arcturus_get_smu_msg_index,
.allow_xgmi_power_down = arcturus_allow_xgmi_power_down,
.log_thermal_throttling_event = arcturus_log_thermal_throttling_event,
.set_thermal_range = arcturus_set_thermal_range,
- .get_max_power_limit = atcturus_get_max_power_limit,
};
void arcturus_set_ppt_funcs(struct smu_context *smu)
uint32_t pstate_mclk;
bool od_enabled;
- uint32_t power_limit;
- uint32_t default_power_limit;
uint32_t current_power_limit;
uint32_t max_power_limit;
int (*set_power_source)(struct smu_context *smu, enum smu_power_src_type power_src);
void (*log_thermal_throttling_event)(struct smu_context *smu);
int (*set_thermal_range)(struct smu_context *smu, struct smu_temperature_range range);
- uint32_t (*get_max_power_limit)(struct smu_context *smu);
};
typedef enum {
int smu_get_power_limit(struct smu_context *smu,
uint32_t *limit,
- bool def,
- bool lock_needed);
+ bool max_setting);
int smu_set_power_limit(struct smu_context *smu, uint32_t limit);
int smu_print_clk_levels(struct smu_context *smu, enum smu_clk_type clk_type, char *buf);
return ret;
}
-static uint32_t navi10_get_pptable_power_limit(struct smu_context *smu)
-{
- PPTable_t *pptable = smu->smu_table.driver_pptable;
- return pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0];
-}
-
static int navi10_get_power_limit(struct smu_context *smu)
{
struct smu_11_0_powerplay_table *powerplay_table =
return 0;
}
-static uint32_t navi10_get_max_power_limit(struct smu_context *smu) {
- uint32_t od_limit, max_power_limit;
- struct smu_11_0_powerplay_table *powerplay_table = NULL;
- struct smu_table_context *table_context = &smu->smu_table;
- powerplay_table = table_context->power_play_table;
-
- max_power_limit = navi10_get_pptable_power_limit(smu);
-
- if (!max_power_limit) {
- // If we couldn't get the table limit, fall back on first-read value
- if (!smu->default_power_limit)
- smu->default_power_limit = smu->power_limit;
- max_power_limit = smu->default_power_limit;
- }
-
- if (smu->od_enabled) {
- od_limit = le32_to_cpu(powerplay_table->overdrive_table.max[SMU_11_0_ODSETTING_POWERPERCENTAGE]);
-
- dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n", od_limit, smu->default_power_limit);
-
- max_power_limit *= (100 + od_limit);
- max_power_limit /= 100;
- }
-
- return max_power_limit;
-}
-
static const struct pptable_funcs navi10_ppt_funcs = {
.tables_init = navi10_tables_init,
.alloc_dpm_context = navi10_allocate_dpm_context,
.disable_umc_cdr_12gbps_workaround = navi10_disable_umc_cdr_12gbps_workaround,
.set_power_source = smu_v11_0_set_power_source,
.set_thermal_range = navi10_set_thermal_range,
- .get_max_power_limit = navi10_get_max_power_limit,
};
void navi10_set_ppt_funcs(struct smu_context *smu)
return ret;
}
-static uint32_t sienna_cichlid_get_pptable_power_limit(struct smu_context *smu)
-{
- PPTable_t *pptable = smu->smu_table.driver_pptable;
- return pptable->SocketPowerLimitAc[PPT_THROTTLER_PPT0];
-}
-
static int sienna_cichlid_get_power_limit(struct smu_context *smu)
{
struct smu_11_0_7_powerplay_table *powerplay_table =
return 0;
}
-static uint32_t sienna_cichlid_get_max_power_limit(struct smu_context *smu) {
- uint32_t od_limit, max_power_limit;
- struct smu_11_0_7_powerplay_table *powerplay_table = NULL;
- struct smu_table_context *table_context = &smu->smu_table;
- powerplay_table = table_context->power_play_table;
-
- max_power_limit = sienna_cichlid_get_pptable_power_limit(smu);
-
- if (!max_power_limit) {
- // If we couldn't get the table limit, fall back on first-read value
- if (!smu->default_power_limit)
- smu->default_power_limit = smu->power_limit;
- max_power_limit = smu->default_power_limit;
- }
-
- if (smu->od_enabled) {
- od_limit = le32_to_cpu(powerplay_table->overdrive_table.max[SMU_11_0_7_ODSETTING_POWERPERCENTAGE]);
-
- dev_dbg(smu->adev->dev, "ODSETTING_POWERPERCENTAGE: %d (default: %d)\n", od_limit, smu->default_power_limit);
-
- max_power_limit *= (100 + od_limit);
- max_power_limit /= 100;
- }
-
- return max_power_limit;
-}
-
static void sienna_cichlid_dump_pptable(struct smu_context *smu)
{
struct smu_table_context *table_context = &smu->smu_table;
.set_soft_freq_limited_range = sienna_cichlid_set_soft_freq_limited_range,
.override_pcie_parameters = smu_v11_0_override_pcie_parameters,
.set_thermal_range = sienna_cichlid_set_thermal_range,
- .get_max_power_limit = sienna_cichlid_get_max_power_limit,
};
void sienna_cichlid_set_ppt_funcs(struct smu_context *smu)
#define smu_set_thermal_range(smu, range) \
((smu)->ppt_funcs->set_thermal_range ? (smu)->ppt_funcs->set_thermal_range((smu), (range)) : 0)
-#define smu_get_max_power_limit(smu) \
- ((smu)->ppt_funcs->get_max_power_limit ? (smu)->ppt_funcs->get_max_power_limit((smu)) : 0)
#define smu_disable_umc_cdr_12gbps_workaround(smu) \
((smu)->ppt_funcs->disable_umc_cdr_12gbps_workaround ? (smu)->ppt_funcs->disable_umc_cdr_12gbps_workaround((smu)) : 0)