drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c- Extension
.c- Size
- 71391 bytes
- Lines
- 2211
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hamdgpu.hamdgpu_cs.hamdgpu_vcn.hamdgpu_pm.hsoc15.hsoc15d.hsoc15_common.hvcn/vcn_1_0_offset.hvcn/vcn_1_0_sh_mask.hmmhub/mmhub_9_1_offset.hmmhub/mmhub_9_1_sh_mask.hivsrcid/vcn/irqsrcs_vcn_1_0.hjpeg_v1_0.hvcn_v1_0.h
Detected Declarations
function vcn_v1_0_early_initfunction vcn_v1_0_sw_initfunction vcn_v1_0_sw_finifunction vcn_v1_0_hw_initfunction vcn_v1_0_hw_finifunction vcn_v1_0_suspendfunction vcn_v1_0_resumefunction vcn_v1_0_mc_resume_spg_modefunction vcn_v1_0_mc_resume_dpg_modefunction vcn_v1_0_disable_clock_gatingfunction vcn_v1_0_enable_clock_gatingfunction vcn_v1_0_clock_gating_dpg_modefunction vcn_1_0_disable_static_power_gatingfunction vcn_1_0_enable_static_power_gatingfunction vcn_v1_0_start_spg_modefunction vcn_v1_0_start_dpg_modefunction vcn_v1_0_startfunction vcn_v1_0_stop_spg_modefunction vcn_v1_0_stop_dpg_modefunction vcn_v1_0_stopfunction vcn_v1_0_pause_dpg_modefunction vcn_v1_0_is_idlefunction vcn_v1_0_wait_for_idlefunction vcn_v1_0_set_clockgating_statefunction vcn_v1_0_dec_ring_get_rptrfunction vcn_v1_0_dec_ring_get_wptrfunction vcn_v1_0_dec_ring_set_wptrfunction vcn_v1_0_dec_ring_insert_startfunction vcn_v1_0_dec_ring_insert_endfunction vcn_v1_0_dec_ring_emit_fencefunction vcn_v1_0_dec_ring_emit_ibfunction vcn_v1_0_dec_ring_emit_reg_waitfunction vcn_v1_0_dec_ring_emit_vm_flushfunction vcn_v1_0_dec_ring_emit_wregfunction vcn_v1_0_enc_ring_get_rptrfunction vcn_v1_0_enc_ring_get_wptrfunction vcn_v1_0_enc_ring_set_wptrfunction vcn_v1_0_enc_ring_emit_fencefunction vcn_v1_0_enc_ring_insert_endfunction vcn_v1_0_enc_ring_emit_ibfunction vcn_v1_0_enc_ring_emit_reg_waitfunction vcn_v1_0_enc_ring_emit_vm_flushfunction vcn_v1_0_enc_ring_emit_wregfunction vcn_v1_0_set_interrupt_statefunction vcn_v1_0_process_interruptfunction vcn_v1_0_dec_ring_insert_nopfunction vcn_v1_0_set_pg_statefunction vcn_v1_0_idle_work_handler
Annotated Snippet
RREG32_SOC15(VCN, 0, mmUVD_STATUS))) {
vinst->set_pg_state(vinst, AMD_PG_STATE_GATE);
}
return 0;
}
/**
* vcn_v1_0_suspend - suspend VCN block
*
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
*
* HW fini and suspend VCN block
*/
static int vcn_v1_0_suspend(struct amdgpu_ip_block *ip_block)
{
int r;
struct amdgpu_device *adev = ip_block->adev;
bool idle_work_unexecuted;
idle_work_unexecuted = cancel_delayed_work_sync(&adev->vcn.inst[0].idle_work);
if (idle_work_unexecuted) {
if (adev->pm.dpm_enabled)
amdgpu_dpm_enable_vcn(adev, false, 0);
}
r = vcn_v1_0_hw_fini(ip_block);
if (r)
return r;
r = amdgpu_vcn_suspend(adev, 0);
return r;
}
/**
* vcn_v1_0_resume - resume VCN block
*
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
*
* Resume firmware and hw init VCN block
*/
static int vcn_v1_0_resume(struct amdgpu_ip_block *ip_block)
{
int r;
r = amdgpu_vcn_resume(ip_block->adev, 0);
if (r)
return r;
r = vcn_v1_0_hw_init(ip_block);
return r;
}
/**
* vcn_v1_0_mc_resume_spg_mode - memory controller programming
*
* @vinst: VCN instance
*
* Let the VCN memory controller know it's offsets
*/
static void vcn_v1_0_mc_resume_spg_mode(struct amdgpu_vcn_inst *vinst)
{
struct amdgpu_device *adev = vinst->adev;
uint32_t size = AMDGPU_GPU_PAGE_ALIGN(adev->vcn.inst[0].fw->size + 4);
uint32_t offset;
/* cache window 0: fw */
if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_lo));
WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
(adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_hi));
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0, 0);
offset = 0;
} else {
WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
lower_32_bits(adev->vcn.inst->gpu_addr));
WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
upper_32_bits(adev->vcn.inst->gpu_addr));
offset = size;
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0,
AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
}
WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE0, size);
/* cache window 1: stack */
WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW,
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_cs.h`, `amdgpu_vcn.h`, `amdgpu_pm.h`, `soc15.h`, `soc15d.h`, `soc15_common.h`.
- Detected declarations: `function vcn_v1_0_early_init`, `function vcn_v1_0_sw_init`, `function vcn_v1_0_sw_fini`, `function vcn_v1_0_hw_init`, `function vcn_v1_0_hw_fini`, `function vcn_v1_0_suspend`, `function vcn_v1_0_resume`, `function vcn_v1_0_mc_resume_spg_mode`, `function vcn_v1_0_mc_resume_dpg_mode`, `function vcn_v1_0_disable_clock_gating`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.