drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr_smu_msg.c- Extension
.c- Size
- 9893 bytes
- Lines
- 339
- 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
dcn30_clk_mgr_smu_msg.hclk_mgr_internal.hreg_helper.hdm_helpers.hdalsmc.hdcn30_smu11_driver_if.hlogger_types.h
Detected Declarations
function filesfunction dcn30_smu_wait_for_responsefunction dcn30_smu_send_msg_with_paramfunction dcn30_smu_test_messagefunction dcn30_smu_get_smu_versionfunction dcn30_smu_check_driver_if_versionfunction dcn30_smu_check_msg_header_versionfunction dcn30_smu_set_dram_addr_highfunction dcn30_smu_set_dram_addr_lowfunction dcn30_smu_transfer_wm_table_smu_2_dramfunction dcn30_smu_transfer_wm_table_dram_2_smufunction dcn30_smu_set_hard_min_by_freqfunction dcn30_smu_set_hard_max_by_freqfunction dcn30_smu_get_dpm_freq_by_indexfunction dcn30_smu_get_dc_mode_max_dpm_freqfunction dcn30_smu_set_min_deep_sleep_dcef_clkfunction dcn30_smu_set_num_of_displaysfunction dcn30_smu_set_display_refresh_from_mallfunction dcn30_smu_set_external_client_df_cstate_allowfunction dcn30_smu_set_pme_workaround
Annotated Snippet
#include "dcn30_clk_mgr_smu_msg.h"
#include "clk_mgr_internal.h"
#include "reg_helper.h"
#include "dm_helpers.h"
#include "dalsmc.h"
#include "dcn30_smu11_driver_if.h"
#define mmDAL_MSG_REG 0x1628A
#define mmDAL_ARG_REG 0x16273
#define mmDAL_RESP_REG 0x16274
#define REG(reg_name) \
mm ## reg_name
#include "logger_types.h"
#undef DC_LOGGER
#define DC_LOGGER \
CTX->logger
#define smu_print(str, ...) {DC_LOG_SMU(str, ##__VA_ARGS__); }
/*
* Function to be used instead of REG_WAIT macro because the wait ends when
* the register is NOT EQUAL to zero, and because the translation in msg_if.h
* won't work with REG_WAIT.
*/
static uint32_t dcn30_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, unsigned int delay_us, unsigned int max_retries)
{
const uint32_t initial_max_retries = max_retries;
uint32_t reg = 0;
do {
reg = REG_READ(DAL_RESP_REG);
if (reg)
break;
if (delay_us >= 1000)
msleep(delay_us/1000);
else if (delay_us > 0)
udelay(delay_us);
} while (max_retries--);
/* handle DALSMC_Result_CmdRejectedBusy? */
TRACE_SMU_MSG_DELAY(0, 0, delay_us * (initial_max_retries - max_retries), clk_mgr->base.ctx);
return reg;
}
static bool dcn30_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, uint32_t msg_id, uint32_t param_in, uint32_t *param_out)
{
uint32_t result;
/* Wait for response register to be ready */
dcn30_smu_wait_for_response(clk_mgr, 10, 200000);
/* Clear response register */
REG_WRITE(DAL_RESP_REG, 0);
/* Set the parameter register for the SMU message */
REG_WRITE(DAL_ARG_REG, param_in);
/* Trigger the message transaction by writing the message ID */
REG_WRITE(DAL_MSG_REG, msg_id);
TRACE_SMU_MSG(msg_id, param_in, clk_mgr->base.ctx);
result = dcn30_smu_wait_for_response(clk_mgr, 10, 200000);
if (IS_SMU_TIMEOUT(result)) {
dm_helpers_smu_timeout(CTX, msg_id, param_in, 10 * 200000);
}
/* Wait for response */
if (result == DALSMC_Result_OK) {
if (param_out)
*param_out = REG_READ(DAL_ARG_REG);
return true;
}
return false;
}
/* Test message should return input + 1 */
bool dcn30_smu_test_message(struct clk_mgr_internal *clk_mgr, uint32_t input)
{
uint32_t response = 0;
Annotation
- Immediate include surface: `dcn30_clk_mgr_smu_msg.h`, `clk_mgr_internal.h`, `reg_helper.h`, `dm_helpers.h`, `dalsmc.h`, `dcn30_smu11_driver_if.h`, `logger_types.h`.
- Detected declarations: `function files`, `function dcn30_smu_wait_for_response`, `function dcn30_smu_send_msg_with_param`, `function dcn30_smu_test_message`, `function dcn30_smu_get_smu_version`, `function dcn30_smu_check_driver_if_version`, `function dcn30_smu_check_msg_header_version`, `function dcn30_smu_set_dram_addr_high`, `function dcn30_smu_set_dram_addr_low`, `function dcn30_smu_transfer_wm_table_smu_2_dram`.
- 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.