drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c- Extension
.c- Size
- 33048 bytes
- Lines
- 1155
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
amdgpu.hamdgpu_smu.hsmu_v13_0.hsmu13_driver_if_v13_0_5.hsmu_v13_0_5_ppt.hsmu_v13_0_5_ppsmc.hsmu_v13_0_5_pmfw.hsmu_cmn.h
Detected Declarations
function smu_v13_0_5_init_smc_tablesfunction smu_v13_0_5_fini_smc_tablesfunction smu_v13_0_5_system_features_controlfunction smu_v13_0_5_dpm_set_vcn_enablefunction smu_v13_0_5_dpm_set_jpeg_enablefunction smu_v13_0_5_is_dpm_runningfunction smu_v13_0_5_mode_resetfunction smu_v13_0_5_mode2_resetfunction smu_v13_0_5_get_smu_metrics_datafunction smu_v13_0_5_read_sensorfunction smu_v13_0_5_set_watermarks_tablefunction smu_v13_0_5_get_gpu_metricsfunction smu_v13_0_5_set_default_dpm_tablesfunction smu_v13_0_5_od_edit_dpm_tablefunction smu_v13_0_5_get_current_clk_freqfunction smu_v13_0_5_get_dpm_level_countfunction smu_v13_0_5_get_dpm_freq_by_indexfunction smu_v13_0_5_clk_dpm_is_enabledfunction smu_v13_0_5_get_dpm_ultimate_freqfunction smu_v13_0_5_set_soft_freq_limited_rangefunction smu_v13_0_5_emit_clk_levelsfunction smu_v13_0_5_force_clk_levelsfunction smu_v13_0_5_get_dpm_profile_freqfunction smu_v13_0_5_set_performance_levelfunction smu_v13_0_5_set_fine_grain_gfx_freq_parametersfunction smu_v13_0_5_init_msg_ctlfunction smu_v13_0_5_set_ppt_funcs
Annotated Snippet
if (ret) {
dev_err(smu->adev->dev, "Failed to update WMTABLE!");
return ret;
}
smu->watermarks_bitmap |= WATERMARKS_LOADED;
}
return 0;
}
static ssize_t smu_v13_0_5_get_gpu_metrics(struct smu_context *smu,
void **table)
{
struct gpu_metrics_v2_1 *gpu_metrics =
(struct gpu_metrics_v2_1 *)smu_driver_table_ptr(
smu, SMU_DRIVER_TABLE_GPU_METRICS);
SmuMetrics_t metrics;
int ret = 0;
ret = smu_cmn_get_metrics_table(smu, &metrics, true);
if (ret)
return ret;
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 1);
gpu_metrics->temperature_gfx = metrics.GfxTemperature;
gpu_metrics->temperature_soc = metrics.SocTemperature;
gpu_metrics->average_gfx_activity = metrics.GfxActivity;
gpu_metrics->average_mm_activity = metrics.UvdActivity;
gpu_metrics->average_socket_power = metrics.CurrentSocketPower;
gpu_metrics->average_gfx_power = metrics.Power[0];
gpu_metrics->average_soc_power = metrics.Power[1];
gpu_metrics->average_gfxclk_frequency = metrics.GfxclkFrequency;
gpu_metrics->average_socclk_frequency = metrics.SocclkFrequency;
gpu_metrics->average_uclk_frequency = metrics.MemclkFrequency;
gpu_metrics->average_fclk_frequency = metrics.MemclkFrequency;
gpu_metrics->average_vclk_frequency = metrics.VclkFrequency;
gpu_metrics->average_dclk_frequency = metrics.DclkFrequency;
gpu_metrics->throttle_status = metrics.ThrottlerStatus;
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
*table = (void *)gpu_metrics;
smu_driver_table_update_cache_time(smu, SMU_DRIVER_TABLE_GPU_METRICS);
return sizeof(struct gpu_metrics_v2_1);
}
static int smu_v13_0_5_set_default_dpm_tables(struct smu_context *smu)
{
struct smu_table_context *smu_table = &smu->smu_table;
return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, smu_table->clocks_table, false);
}
static int smu_v13_0_5_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type,
long input[], uint32_t size)
{
struct smu_dpm_context *smu_dpm = &(smu->smu_dpm);
int ret = 0;
/* Only allowed in manual mode */
if (smu_dpm->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
return -EINVAL;
switch (type) {
case PP_OD_EDIT_SCLK_VDDC_TABLE:
if (size != 2) {
dev_err(smu->adev->dev, "Input parameter number not correct\n");
return -EINVAL;
}
if (input[0] == 0) {
if (input[1] < smu->gfx_default_hard_min_freq) {
dev_warn(smu->adev->dev,
"Fine grain setting minimum sclk (%ld) MHz is less than the minimum allowed (%d) MHz\n",
input[1], smu->gfx_default_hard_min_freq);
return -EINVAL;
}
smu->gfx_actual_hard_min_freq = input[1];
} else if (input[0] == 1) {
if (input[1] > smu->gfx_default_soft_max_freq) {
dev_warn(smu->adev->dev,
"Fine grain setting maximum sclk (%ld) MHz is greater than the maximum allowed (%d) MHz\n",
input[1], smu->gfx_default_soft_max_freq);
return -EINVAL;
}
smu->gfx_actual_soft_max_freq = input[1];
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_smu.h`, `smu_v13_0.h`, `smu13_driver_if_v13_0_5.h`, `smu_v13_0_5_ppt.h`, `smu_v13_0_5_ppsmc.h`, `smu_v13_0_5_pmfw.h`, `smu_cmn.h`.
- Detected declarations: `function smu_v13_0_5_init_smc_tables`, `function smu_v13_0_5_fini_smc_tables`, `function smu_v13_0_5_system_features_control`, `function smu_v13_0_5_dpm_set_vcn_enable`, `function smu_v13_0_5_dpm_set_jpeg_enable`, `function smu_v13_0_5_is_dpm_running`, `function smu_v13_0_5_mode_reset`, `function smu_v13_0_5_mode2_reset`, `function smu_v13_0_5_get_smu_metrics_data`, `function smu_v13_0_5_read_sensor`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.