drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c- Extension
.c- Size
- 10061 bytes
- Lines
- 357
- 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
vega20_thermal.hvega20_hwmgr.hvega20_smumgr.hvega20_ppsmc.hvega20_inc.hsoc15_common.hpp_debug.h
Detected Declarations
function filesfunction vega20_fan_ctrl_stop_smc_fan_controlfunction vega20_enable_fan_control_featurefunction vega20_fan_ctrl_start_smc_fan_controlfunction vega20_fan_ctrl_set_static_modefunction vega20_get_current_rpmfunction vega20_fan_ctrl_get_fan_speed_pwmfunction vega20_fan_ctrl_set_fan_speed_pwmfunction vega20_fan_ctrl_get_fan_speed_infofunction vega20_fan_ctrl_get_fan_speed_rpmfunction vega20_fan_ctrl_set_fan_speed_rpmfunction vega20_thermal_get_temperaturefunction vega20_thermal_set_temperature_rangefunction vega20_thermal_enable_alertfunction vega20_thermal_disable_alertfunction vega20_thermal_stop_thermal_controllerfunction vega20_thermal_setup_fan_tablefunction vega20_start_thermal_controller
Annotated Snippet
#include "vega20_thermal.h"
#include "vega20_hwmgr.h"
#include "vega20_smumgr.h"
#include "vega20_ppsmc.h"
#include "vega20_inc.h"
#include "soc15_common.h"
#include "pp_debug.h"
static int vega20_disable_fan_control_feature(struct pp_hwmgr *hwmgr)
{
struct vega20_hwmgr *data = hwmgr->backend;
int ret = 0;
if (data->smu_features[GNLD_FAN_CONTROL].supported) {
ret = vega20_enable_smc_features(
hwmgr, false,
data->smu_features[GNLD_FAN_CONTROL].
smu_feature_bitmap);
PP_ASSERT_WITH_CODE(!ret,
"Disable FAN CONTROL feature Failed!",
return ret);
data->smu_features[GNLD_FAN_CONTROL].enabled = false;
}
return ret;
}
int vega20_fan_ctrl_stop_smc_fan_control(struct pp_hwmgr *hwmgr)
{
struct vega20_hwmgr *data = hwmgr->backend;
if (data->smu_features[GNLD_FAN_CONTROL].supported)
return vega20_disable_fan_control_feature(hwmgr);
return 0;
}
static int vega20_enable_fan_control_feature(struct pp_hwmgr *hwmgr)
{
struct vega20_hwmgr *data = hwmgr->backend;
int ret = 0;
if (data->smu_features[GNLD_FAN_CONTROL].supported) {
ret = vega20_enable_smc_features(
hwmgr, true,
data->smu_features[GNLD_FAN_CONTROL].
smu_feature_bitmap);
PP_ASSERT_WITH_CODE(!ret,
"Enable FAN CONTROL feature Failed!",
return ret);
data->smu_features[GNLD_FAN_CONTROL].enabled = true;
}
return ret;
}
int vega20_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr)
{
struct vega20_hwmgr *data = hwmgr->backend;
if (data->smu_features[GNLD_FAN_CONTROL].supported)
return vega20_enable_fan_control_feature(hwmgr);
return 0;
}
static int vega20_fan_ctrl_set_static_mode(struct pp_hwmgr *hwmgr, uint32_t mode)
{
struct amdgpu_device *adev = hwmgr->adev;
WREG32_SOC15(THM, 0, mmCG_FDO_CTRL2,
REG_SET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL2),
CG_FDO_CTRL2, TMIN, 0));
WREG32_SOC15(THM, 0, mmCG_FDO_CTRL2,
REG_SET_FIELD(RREG32_SOC15(THM, 0, mmCG_FDO_CTRL2),
CG_FDO_CTRL2, FDO_PWM_MODE, mode));
return 0;
}
static int vega20_get_current_rpm(struct pp_hwmgr *hwmgr, uint32_t *current_rpm)
{
int ret = 0;
PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc(hwmgr,
PPSMC_MSG_GetCurrentRpm,
current_rpm)) == 0,
"Attempt to get current RPM from SMC Failed!",
return ret);
Annotation
- Immediate include surface: `vega20_thermal.h`, `vega20_hwmgr.h`, `vega20_smumgr.h`, `vega20_ppsmc.h`, `vega20_inc.h`, `soc15_common.h`, `pp_debug.h`.
- Detected declarations: `function files`, `function vega20_fan_ctrl_stop_smc_fan_control`, `function vega20_enable_fan_control_feature`, `function vega20_fan_ctrl_start_smc_fan_control`, `function vega20_fan_ctrl_set_static_mode`, `function vega20_get_current_rpm`, `function vega20_fan_ctrl_get_fan_speed_pwm`, `function vega20_fan_ctrl_set_fan_speed_pwm`, `function vega20_fan_ctrl_get_fan_speed_info`, `function vega20_fan_ctrl_get_fan_speed_rpm`.
- 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.