mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
drm/amd/pm: Add smu interface for temp metrics
Add smu interface to get baseboard/gpuboard temperature metrics v2: Rename is_support to is_supported(Lijo) Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
83953ec1fe
commit
775c7e8e4d
|
|
@ -3831,6 +3831,33 @@ int smu_set_pm_policy(struct smu_context *smu, enum pp_pm_policy p_type,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t smu_sys_get_temp_metrics(void *handle, enum smu_temp_metric_type type, void *table)
|
||||
{
|
||||
struct smu_context *smu = handle;
|
||||
|
||||
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!smu->smu_temp.temp_funcs || !smu->smu_temp.temp_funcs->get_temp_metrics)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return smu->smu_temp.temp_funcs->get_temp_metrics(smu, type, table);
|
||||
}
|
||||
|
||||
static bool smu_temp_metrics_is_supported(void *handle, enum smu_temp_metric_type type)
|
||||
{
|
||||
struct smu_context *smu = handle;
|
||||
bool ret = false;
|
||||
|
||||
if (!smu->pm_enabled)
|
||||
return false;
|
||||
|
||||
if (smu->smu_temp.temp_funcs && smu->smu_temp.temp_funcs->temp_metrics_is_supported)
|
||||
ret = smu->smu_temp.temp_funcs->temp_metrics_is_supported(smu, type);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t smu_sys_get_xcp_metrics(void *handle, int xcp_id, void *table)
|
||||
{
|
||||
struct smu_context *smu = handle;
|
||||
|
|
@ -3903,6 +3930,8 @@ static const struct amd_pm_funcs swsmu_pm_funcs = {
|
|||
.get_dpm_clock_table = smu_get_dpm_clock_table,
|
||||
.get_smu_prv_buf_details = smu_get_prv_buffer_details,
|
||||
.get_xcp_metrics = smu_sys_get_xcp_metrics,
|
||||
.get_temp_metrics = smu_sys_get_temp_metrics,
|
||||
.temp_metrics_is_supported = smu_temp_metrics_is_supported,
|
||||
};
|
||||
|
||||
int smu_wait_for_event(struct smu_context *smu, enum smu_event_type event,
|
||||
|
|
|
|||
|
|
@ -396,6 +396,10 @@ struct smu_dpm_context {
|
|||
struct smu_dpm_policy_ctxt *dpm_policies;
|
||||
};
|
||||
|
||||
struct smu_temp_context {
|
||||
const struct smu_temp_funcs *temp_funcs;
|
||||
};
|
||||
|
||||
struct smu_power_gate {
|
||||
bool uvd_gated;
|
||||
bool vce_gated;
|
||||
|
|
@ -529,6 +533,7 @@ struct smu_context {
|
|||
struct smu_table_context smu_table;
|
||||
struct smu_dpm_context smu_dpm;
|
||||
struct smu_power_context smu_power;
|
||||
struct smu_temp_context smu_temp;
|
||||
struct smu_feature smu_feature;
|
||||
struct amd_pp_display_configuration *display_config;
|
||||
struct smu_baco_context smu_baco;
|
||||
|
|
@ -623,6 +628,28 @@ struct smu_context {
|
|||
|
||||
struct i2c_adapter;
|
||||
|
||||
/**
|
||||
* struct smu_temp_funcs - Callbacks used to get temperature data.
|
||||
*/
|
||||
struct smu_temp_funcs {
|
||||
/**
|
||||
* @get_temp_metrics: Calibrate voltage/frequency curve to fit the system's
|
||||
* power delivery and voltage margins. Required for adaptive
|
||||
* @type Temperature metrics type(baseboard/gpuboard)
|
||||
* Return: Size of &table
|
||||
*/
|
||||
ssize_t (*get_temp_metrics)(struct smu_context *smu,
|
||||
enum smu_temp_metric_type type, void *table);
|
||||
|
||||
/**
|
||||
* @temp_metrics_is_support: Get if specific temperature metrics is supported
|
||||
* @type Temperature metrics type(baseboard/gpuboard)
|
||||
* Return: true if supported else false
|
||||
*/
|
||||
bool (*temp_metrics_is_supported)(struct smu_context *smu, enum smu_temp_metric_type type);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pptable_funcs - Callbacks used to interact with the SMU.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user