drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/smumgr/tonga_smumgr.c- Extension
.c- Size
- 110871 bytes
- Lines
- 3268
- 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
pp_debug.hlinux/types.hlinux/kernel.hlinux/pci.hlinux/slab.hlinux/gfp.hsmumgr.htonga_smumgr.hsmu_ucode_xfer_vi.htonga_ppsmc.hsmu/smu_7_1_2_d.hsmu/smu_7_1_2_sh_mask.hcgs_common.hsmu7_smumgr.hsmu7_dyn_defaults.hsmu7_hwmgr.hhardwaremanager.hppatomctrl.hatombios.hpppcielanes.hpp_endian.hgmc/gmc_8_1_d.hgmc/gmc_8_1_sh_mask.hbif/bif_5_0_d.hbif/bif_5_0_sh_mask.hdce/dce_10_0_d.hdce/dce_10_0_sh_mask.h
Detected Declarations
function tonga_start_in_protection_modefunction tonga_start_in_non_protection_modefunction tonga_start_smufunction tonga_smu_initfunction tonga_get_dependency_volt_by_clkfunction tonga_populate_smc_vddc_tablefunction tonga_populate_smc_vdd_gfx_tablefunction tonga_populate_smc_vdd_ci_tablefunction tonga_populate_smc_mvdd_tablefunction tonga_populate_cac_tablesfunction tonga_populate_smc_voltage_tablesfunction tonga_populate_ulv_levelfunction tonga_populate_ulv_statefunction tonga_populate_smc_link_levelfunction tonga_calculate_sclk_paramsfunction tonga_populate_single_graphic_levelfunction tonga_populate_all_graphic_levelsfunction tonga_calculate_mclk_paramsfunction tonga_get_mclk_frequency_ratiofunction tonga_get_ddr3_mclk_frequency_ratiofunction tonga_populate_single_memory_levelfunction tonga_populate_all_memory_levelsfunction tonga_populate_mvdd_valuefunction tonga_populate_smc_acpi_levelfunction tonga_populate_smc_uvd_levelfunction tonga_populate_smc_vce_levelfunction tonga_populate_smc_acp_levelfunction tonga_populate_memory_timing_parametersfunction tonga_program_memory_timing_parametersfunction tonga_populate_smc_boot_levelfunction tonga_populate_clock_stretcher_data_tablefunction tonga_populate_vr_configfunction tonga_init_arb_table_indexfunction tonga_populate_bapm_parameters_in_dpm_tablefunction tonga_populate_svi_load_linefunction tonga_populate_tdc_limitfunction tonga_populate_dw8function tonga_populate_temperature_scalerfunction tonga_populate_fuzzy_fanfunction tonga_populate_gnb_lpmlfunction tonga_populate_bapm_vddc_base_leakage_siddfunction tonga_populate_pm_fusesfunction tonga_populate_mc_reg_addressfunction tonga_convert_mc_registersfunction tonga_convert_mc_reg_table_entry_to_smcfunction tonga_convert_mc_reg_table_to_smcfunction tonga_update_and_upload_mc_reg_tablefunction tonga_populate_initial_mc_reg_table
Annotated Snippet
if (allowed_clock_voltage_table->entries[i].clk >= clock) {
voltage->VddGfx = phm_get_voltage_index(
pptable_info->vddgfx_lookup_table,
allowed_clock_voltage_table->entries[i].vddgfx);
voltage->Vddc = phm_get_voltage_index(
pptable_info->vddc_lookup_table,
allowed_clock_voltage_table->entries[i].vddc);
if (allowed_clock_voltage_table->entries[i].vddci)
voltage->Vddci =
phm_get_voltage_id(&data->vddci_voltage_table, allowed_clock_voltage_table->entries[i].vddci);
else
voltage->Vddci =
phm_get_voltage_id(&data->vddci_voltage_table,
allowed_clock_voltage_table->entries[i].vddc - VDDC_VDDCI_DELTA);
if (allowed_clock_voltage_table->entries[i].mvdd)
*mvdd = (uint32_t) allowed_clock_voltage_table->entries[i].mvdd;
voltage->Phases = 1;
return 0;
}
}
/* sclk is bigger than max sclk in the dependence table */
voltage->VddGfx = phm_get_voltage_index(pptable_info->vddgfx_lookup_table,
allowed_clock_voltage_table->entries[i-1].vddgfx);
voltage->Vddc = phm_get_voltage_index(pptable_info->vddc_lookup_table,
allowed_clock_voltage_table->entries[i-1].vddc);
if (allowed_clock_voltage_table->entries[i-1].vddci)
voltage->Vddci = phm_get_voltage_id(&data->vddci_voltage_table,
allowed_clock_voltage_table->entries[i-1].vddci);
if (allowed_clock_voltage_table->entries[i-1].mvdd)
*mvdd = (uint32_t) allowed_clock_voltage_table->entries[i-1].mvdd;
return 0;
}
static int tonga_populate_smc_vddc_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{
unsigned int count;
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->voltage_control) {
table->VddcLevelCount = data->vddc_voltage_table.count;
for (count = 0; count < table->VddcLevelCount; count++) {
table->VddcTable[count] =
PP_HOST_TO_SMC_US(data->vddc_voltage_table.entries[count].value * VOLTAGE_SCALE);
}
CONVERT_FROM_HOST_TO_SMC_UL(table->VddcLevelCount);
}
return 0;
}
static int tonga_populate_smc_vdd_gfx_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{
unsigned int count;
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->vdd_gfx_control) {
table->VddGfxLevelCount = data->vddgfx_voltage_table.count;
for (count = 0; count < data->vddgfx_voltage_table.count; count++) {
table->VddGfxTable[count] =
PP_HOST_TO_SMC_US(data->vddgfx_voltage_table.entries[count].value * VOLTAGE_SCALE);
}
CONVERT_FROM_HOST_TO_SMC_UL(table->VddGfxLevelCount);
}
return 0;
}
static int tonga_populate_smc_vdd_ci_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
uint32_t count;
table->VddciLevelCount = data->vddci_voltage_table.count;
for (count = 0; count < table->VddciLevelCount; count++) {
if (SMU7_VOLTAGE_CONTROL_BY_SVID2 == data->vddci_control) {
table->VddciTable[count] =
PP_HOST_TO_SMC_US(data->vddci_voltage_table.entries[count].value * VOLTAGE_SCALE);
} else if (SMU7_VOLTAGE_CONTROL_BY_GPIO == data->vddci_control) {
table->SmioTable1.Pattern[count].Voltage =
PP_HOST_TO_SMC_US(data->vddci_voltage_table.entries[count].value * VOLTAGE_SCALE);
/* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level. */
Annotation
- Immediate include surface: `pp_debug.h`, `linux/types.h`, `linux/kernel.h`, `linux/pci.h`, `linux/slab.h`, `linux/gfp.h`, `smumgr.h`, `tonga_smumgr.h`.
- Detected declarations: `function tonga_start_in_protection_mode`, `function tonga_start_in_non_protection_mode`, `function tonga_start_smu`, `function tonga_smu_init`, `function tonga_get_dependency_volt_by_clk`, `function tonga_populate_smc_vddc_table`, `function tonga_populate_smc_vdd_gfx_table`, `function tonga_populate_smc_vdd_ci_table`, `function tonga_populate_smc_mvdd_table`, `function tonga_populate_cac_tables`.
- 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.