drivers/gpu/drm/radeon/ci_dpm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/ci_dpm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/ci_dpm.c- Extension
.c- Size
- 177120 bytes
- Lines
- 5964
- 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
linux/firmware.hlinux/pci.hlinux/seq_file.hatom.hci_dpm.hcik.hcikd.hr600_dpm.hradeon.hradeon_asic.hradeon_ucode.hsi_dpm.h
Detected Declarations
function ci_initialize_powertune_defaultsfunction ci_convert_to_vidfunction ci_populate_bapm_vddc_vid_siddfunction ci_populate_vddc_vidfunction ci_populate_svi_load_linefunction ci_populate_tdc_limitfunction ci_populate_dw8function ci_populate_fuzzy_fanfunction ci_min_max_v_gnbl_pm_lid_from_bapm_vddcfunction ci_populate_bapm_vddc_base_leakage_siddfunction ci_populate_bapm_parameters_in_dpm_tablefunction ci_populate_pm_basefunction ci_do_enable_didtfunction ci_program_pt_config_registersfunction ci_enable_didtfunction ci_enable_power_containmentfunction ci_enable_smc_cacfunction ci_enable_thermal_based_sclk_dpmfunction ci_power_control_set_levelfunction ci_dpm_powergate_uvdfunction ci_dpm_vblank_too_shortfunction ci_apply_state_adjust_rulesfunction ci_thermal_set_temperature_rangefunction ci_thermal_enable_alertfunction ci_fan_ctrl_set_static_modefunction ci_thermal_setup_fan_tablefunction ci_fan_ctrl_start_smc_fan_controlfunction ci_fan_ctrl_stop_smc_fan_controlfunction ci_fan_ctrl_get_fan_speed_percentfunction ci_fan_ctrl_set_fan_speed_percentfunction ci_fan_ctrl_set_modefunction ci_fan_ctrl_get_modefunction ci_fan_ctrl_get_fan_speed_rpmfunction ci_fan_ctrl_set_fan_speed_rpmfunction ci_fan_ctrl_set_default_modefunction ci_thermal_start_smc_fan_controlfunction ci_thermal_initializefunction ci_thermal_start_thermal_controllerfunction ci_thermal_stop_thermal_controllerfunction ci_read_smc_soft_registerfunction ci_write_smc_soft_registerfunction ci_init_fps_limitsfunction ci_update_sclk_tfunction ci_get_leakage_voltagesfunction ci_set_dpm_event_sourcesfunction ci_enable_auto_throttle_sourcefunction ci_enable_vr_hot_gpio_interruptfunction ci_unfreeze_sclk_mclk_dpm
Annotated Snippet
if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_EVV) {
lo_vid[i] = ci_convert_to_vid(rdev->pm.dpm.dyn_state.cac_leakage_table.entries[i].vddc1);
hi_vid[i] = ci_convert_to_vid(rdev->pm.dpm.dyn_state.cac_leakage_table.entries[i].vddc2);
hi2_vid[i] = ci_convert_to_vid(rdev->pm.dpm.dyn_state.cac_leakage_table.entries[i].vddc3);
} else {
lo_vid[i] = ci_convert_to_vid(rdev->pm.dpm.dyn_state.cac_leakage_table.entries[i].vddc);
hi_vid[i] = ci_convert_to_vid((u16)rdev->pm.dpm.dyn_state.cac_leakage_table.entries[i].leakage);
}
}
return 0;
}
static int ci_populate_vddc_vid(struct radeon_device *rdev)
{
struct ci_power_info *pi = ci_get_pi(rdev);
u8 *vid = pi->smc_powertune_table.VddCVid;
u32 i;
if (pi->vddc_voltage_table.count > 8)
return -EINVAL;
for (i = 0; i < pi->vddc_voltage_table.count; i++)
vid[i] = ci_convert_to_vid(pi->vddc_voltage_table.entries[i].value);
return 0;
}
static int ci_populate_svi_load_line(struct radeon_device *rdev)
{
struct ci_power_info *pi = ci_get_pi(rdev);
const struct ci_pt_defaults *pt_defaults = pi->powertune_defaults;
pi->smc_powertune_table.SviLoadLineEn = pt_defaults->svi_load_line_en;
pi->smc_powertune_table.SviLoadLineVddC = pt_defaults->svi_load_line_vddc;
pi->smc_powertune_table.SviLoadLineTrimVddC = 3;
pi->smc_powertune_table.SviLoadLineOffsetVddC = 0;
return 0;
}
static int ci_populate_tdc_limit(struct radeon_device *rdev)
{
struct ci_power_info *pi = ci_get_pi(rdev);
const struct ci_pt_defaults *pt_defaults = pi->powertune_defaults;
u16 tdc_limit;
tdc_limit = rdev->pm.dpm.dyn_state.cac_tdp_table->tdc * 256;
pi->smc_powertune_table.TDC_VDDC_PkgLimit = cpu_to_be16(tdc_limit);
pi->smc_powertune_table.TDC_VDDC_ThrottleReleaseLimitPerc =
pt_defaults->tdc_vddc_throttle_release_limit_perc;
pi->smc_powertune_table.TDC_MAWt = pt_defaults->tdc_mawt;
return 0;
}
static int ci_populate_dw8(struct radeon_device *rdev)
{
struct ci_power_info *pi = ci_get_pi(rdev);
const struct ci_pt_defaults *pt_defaults = pi->powertune_defaults;
int ret;
ret = ci_read_smc_sram_dword(rdev,
SMU7_FIRMWARE_HEADER_LOCATION +
offsetof(SMU7_Firmware_Header, PmFuseTable) +
offsetof(SMU7_Discrete_PmFuses, TdcWaterfallCtl),
(u32 *)&pi->smc_powertune_table.TdcWaterfallCtl,
pi->sram_end);
if (ret)
return -EINVAL;
else
pi->smc_powertune_table.TdcWaterfallCtl = pt_defaults->tdc_waterfall_ctl;
return 0;
}
static int ci_populate_fuzzy_fan(struct radeon_device *rdev)
{
struct ci_power_info *pi = ci_get_pi(rdev);
if ((rdev->pm.dpm.fan.fan_output_sensitivity & (1 << 15)) ||
(rdev->pm.dpm.fan.fan_output_sensitivity == 0))
rdev->pm.dpm.fan.fan_output_sensitivity =
rdev->pm.dpm.fan.default_fan_output_sensitivity;
pi->smc_powertune_table.FuzzyFan_PwmSetDelta =
cpu_to_be16(rdev->pm.dpm.fan.fan_output_sensitivity);
return 0;
}
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/pci.h`, `linux/seq_file.h`, `atom.h`, `ci_dpm.h`, `cik.h`, `cikd.h`, `r600_dpm.h`.
- Detected declarations: `function ci_initialize_powertune_defaults`, `function ci_convert_to_vid`, `function ci_populate_bapm_vddc_vid_sidd`, `function ci_populate_vddc_vid`, `function ci_populate_svi_load_line`, `function ci_populate_tdc_limit`, `function ci_populate_dw8`, `function ci_populate_fuzzy_fan`, `function ci_min_max_v_gnbl_pm_lid_from_bapm_vddc`, `function ci_populate_bapm_vddc_base_leakage_sidd`.
- 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.