drivers/gpu/drm/amd/pm/powerplay/hwmgr/hardwaremanager.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/hwmgr/hardwaremanager.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/hwmgr/hardwaremanager.c- Extension
.c- Size
- 13833 bytes
- Lines
- 501
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
pp_debug.hlinux/errno.hhwmgr.hhardwaremanager.hpower_state.h
Detected Declarations
function phm_setup_asicfunction phm_power_down_asicfunction phm_set_power_statefunction phm_enable_dynamic_state_managementfunction phm_disable_dynamic_state_managementfunction phm_force_dpm_levelsfunction phm_apply_state_adjust_rulesfunction phm_apply_clock_adjust_rulesfunction phm_disable_clock_power_gatingsfunction phm_pre_display_configuration_changedfunction phm_display_configuration_changedfunction phm_notify_smc_display_config_after_ps_adjustmentfunction phm_stop_thermal_controllerfunction phm_register_irq_handlersfunction phm_start_thermal_controllerfunction phm_check_smc_update_required_for_display_configurationfunction phm_check_states_equalfunction phm_store_dal_configuration_datafunction phm_set_cpu_power_statefunction phm_get_performance_levelfunction phm_get_clock_infofunction phm_get_current_shallow_sleep_clocksfunction phm_get_clock_by_typefunction phm_get_clock_by_type_with_latencyfunction phm_get_clock_by_type_with_voltagefunction phm_set_watermarks_for_clocks_rangesfunction phm_display_clock_voltage_requestfunction phm_get_max_high_clocksfunction phm_disable_smc_firmware_ctffunction phm_set_active_display_count
Annotated Snippet
#include "pp_debug.h"
#include <linux/errno.h>
#include "hwmgr.h"
#include "hardwaremanager.h"
#include "power_state.h"
#define TEMP_RANGE_MIN (0)
#define TEMP_RANGE_MAX (80 * 1000)
#define PHM_FUNC_CHECK(hw) \
do { \
if ((hw) == NULL || (hw)->hwmgr_func == NULL) \
return -EINVAL; \
} while (0)
int phm_setup_asic(struct pp_hwmgr *hwmgr)
{
PHM_FUNC_CHECK(hwmgr);
if (NULL != hwmgr->hwmgr_func->asic_setup)
return hwmgr->hwmgr_func->asic_setup(hwmgr);
return 0;
}
int phm_power_down_asic(struct pp_hwmgr *hwmgr)
{
PHM_FUNC_CHECK(hwmgr);
if (NULL != hwmgr->hwmgr_func->power_off_asic)
return hwmgr->hwmgr_func->power_off_asic(hwmgr);
return 0;
}
int phm_set_power_state(struct pp_hwmgr *hwmgr,
const struct pp_hw_power_state *pcurrent_state,
const struct pp_hw_power_state *pnew_power_state)
{
struct phm_set_power_state_input states;
PHM_FUNC_CHECK(hwmgr);
states.pcurrent_state = pcurrent_state;
states.pnew_state = pnew_power_state;
if (NULL != hwmgr->hwmgr_func->power_state_set)
return hwmgr->hwmgr_func->power_state_set(hwmgr, &states);
return 0;
}
int phm_enable_dynamic_state_management(struct pp_hwmgr *hwmgr)
{
struct amdgpu_device *adev = NULL;
int ret = -EINVAL;
PHM_FUNC_CHECK(hwmgr);
adev = hwmgr->adev;
/* Skip for suspend/resume case */
if (!hwmgr->pp_one_vf && smum_is_dpm_running(hwmgr)
&& !amdgpu_passthrough(adev) && adev->in_suspend
&& adev->asic_type != CHIP_RAVEN) {
pr_info("dpm has been enabled\n");
return 0;
}
if (NULL != hwmgr->hwmgr_func->dynamic_state_management_enable)
ret = hwmgr->hwmgr_func->dynamic_state_management_enable(hwmgr);
return ret;
}
int phm_disable_dynamic_state_management(struct pp_hwmgr *hwmgr)
{
int ret = -EINVAL;
PHM_FUNC_CHECK(hwmgr);
if (!hwmgr->not_vf)
return 0;
if (!smum_is_dpm_running(hwmgr)) {
pr_info("dpm has been disabled\n");
return 0;
}
if (hwmgr->hwmgr_func->dynamic_state_management_disable)
ret = hwmgr->hwmgr_func->dynamic_state_management_disable(hwmgr);
Annotation
- Immediate include surface: `pp_debug.h`, `linux/errno.h`, `hwmgr.h`, `hardwaremanager.h`, `power_state.h`.
- Detected declarations: `function phm_setup_asic`, `function phm_power_down_asic`, `function phm_set_power_state`, `function phm_enable_dynamic_state_management`, `function phm_disable_dynamic_state_management`, `function phm_force_dpm_levels`, `function phm_apply_state_adjust_rules`, `function phm_apply_clock_adjust_rules`, `function phm_disable_clock_power_gatings`, `function phm_pre_display_configuration_changed`.
- 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.