drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c- Extension
.c- Size
- 45892 bytes
- Lines
- 1495
- 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_v12_0_ppsmc.hsmu12_driver_if.hsmu_v12_0.hrenoir_ppt.hsmu_cmn.h
Detected Declarations
struct clk_feature_mapfunction renoir_init_smc_tablesfunction renoir_get_dpm_clk_limitedfunction renoir_get_profiling_clk_maskfunction renoir_get_dpm_ultimate_freqfunction renoir_od_edit_dpm_tablefunction renoir_set_fine_grain_gfx_freq_parametersfunction renoir_emit_clk_levelsfunction renoir_get_current_power_statefunction renoir_dpm_set_vcn_enablefunction renoir_dpm_set_jpeg_enablefunction renoir_force_dpm_limit_valuefunction renoir_unforce_dpm_levelsfunction renoir_get_dpm_clock_tablefunction renoir_force_clk_levelsfunction renoir_set_power_profile_modefunction renoir_set_peak_clock_by_devicefunction renior_set_dpm_profile_freqfunction renoir_set_performance_levelfunction renoir_set_watermarks_tablefunction renoir_get_power_profile_modefunction renoir_get_ss_power_percentfunction renoir_get_smu_metrics_datafunction renoir_read_sensorfunction renoir_is_dpm_runningfunction renoir_get_gpu_metricsfunction renoir_gfx_state_change_setfunction renoir_get_enabled_maskfunction renoir_set_ppt_funcs
Annotated Snippet
struct clk_feature_map {
enum smu_clk_type clk_type;
uint32_t feature;
} clk_feature_map[] = {
{SMU_GFXCLK, SMU_FEATURE_DPM_GFXCLK_BIT},
{SMU_MCLK, SMU_FEATURE_DPM_UCLK_BIT},
{SMU_SOCCLK, SMU_FEATURE_DPM_SOCCLK_BIT},
};
for (i = 0; i < ARRAY_SIZE(clk_feature_map); i++) {
if (!smu_cmn_feature_is_enabled(smu, clk_feature_map[i].feature))
continue;
clk_type = clk_feature_map[i].clk_type;
ret = renoir_get_dpm_ultimate_freq(smu, clk_type, &min_freq, &max_freq);
if (ret)
return ret;
ret = smu_v12_0_set_soft_freq_limited_range(smu, clk_type, min_freq, max_freq, false);
if (ret)
return ret;
}
return ret;
}
/*
* This interface get dpm clock table for dc
*/
static int renoir_get_dpm_clock_table(struct smu_context *smu, struct dpm_clocks *clock_table)
{
DpmClocks_t *table = smu->smu_table.clocks_table;
int i;
if (!clock_table || !table)
return -EINVAL;
for (i = 0; i < NUM_DCFCLK_DPM_LEVELS; i++) {
clock_table->DcfClocks[i].Freq = table->DcfClocks[i].Freq;
clock_table->DcfClocks[i].Vol = table->DcfClocks[i].Vol;
}
for (i = 0; i < NUM_SOCCLK_DPM_LEVELS; i++) {
clock_table->SocClocks[i].Freq = table->SocClocks[i].Freq;
clock_table->SocClocks[i].Vol = table->SocClocks[i].Vol;
}
for (i = 0; i < NUM_FCLK_DPM_LEVELS; i++) {
clock_table->FClocks[i].Freq = table->FClocks[i].Freq;
clock_table->FClocks[i].Vol = table->FClocks[i].Vol;
}
for (i = 0; i< NUM_MEMCLK_DPM_LEVELS; i++) {
clock_table->MemClocks[i].Freq = table->MemClocks[i].Freq;
clock_table->MemClocks[i].Vol = table->MemClocks[i].Vol;
}
for (i = 0; i < NUM_VCN_DPM_LEVELS; i++) {
clock_table->VClocks[i].Freq = table->VClocks[i].Freq;
clock_table->VClocks[i].Vol = table->VClocks[i].Vol;
}
for (i = 0; i < NUM_VCN_DPM_LEVELS; i++) {
clock_table->DClocks[i].Freq = table->DClocks[i].Freq;
clock_table->DClocks[i].Vol = table->DClocks[i].Vol;
}
return 0;
}
static int renoir_force_clk_levels(struct smu_context *smu,
enum smu_clk_type clk_type, uint32_t mask)
{
int ret = 0 ;
uint32_t soft_min_level = 0, soft_max_level = 0, min_freq = 0, max_freq = 0;
soft_min_level = mask ? (ffs(mask) - 1) : 0;
soft_max_level = mask ? (fls(mask) - 1) : 0;
switch (clk_type) {
case SMU_GFXCLK:
case SMU_SCLK:
if (soft_min_level > 2 || soft_max_level > 2) {
dev_info(smu->adev->dev, "Currently sclk only support 3 levels on APU\n");
return -EINVAL;
}
ret = renoir_get_dpm_ultimate_freq(smu, SMU_GFXCLK, &min_freq, &max_freq);
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_smu.h`, `smu_v12_0_ppsmc.h`, `smu12_driver_if.h`, `smu_v12_0.h`, `renoir_ppt.h`, `smu_cmn.h`.
- Detected declarations: `struct clk_feature_map`, `function renoir_init_smc_tables`, `function renoir_get_dpm_clk_limited`, `function renoir_get_profiling_clk_mask`, `function renoir_get_dpm_ultimate_freq`, `function renoir_od_edit_dpm_table`, `function renoir_set_fine_grain_gfx_freq_parameters`, `function renoir_emit_clk_levels`, `function renoir_get_current_power_state`, `function renoir_dpm_set_vcn_enable`.
- 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.