drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c- Extension
.c- Size
- 24167 bytes
- Lines
- 857
- 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
amdgpu.hamdgpu_jpeg.hamdgpu_pm.hsoc15.hsoc15d.hjpeg_v2_0.hvcn/vcn_2_0_0_offset.hvcn/vcn_2_0_0_sh_mask.hivsrcid/vcn/irqsrcs_vcn_2_0.h
Detected Declarations
function jpeg_v2_0_early_initfunction jpeg_v2_0_sw_initfunction jpeg_v2_0_sw_finifunction jpeg_v2_0_hw_initfunction jpeg_v2_0_hw_finifunction jpeg_v2_0_suspendfunction jpeg_v2_0_resumefunction jpeg_v2_0_disable_power_gatingfunction jpeg_v2_0_enable_power_gatingfunction jpeg_v2_0_disable_clock_gatingfunction jpeg_v2_0_enable_clock_gatingfunction jpeg_v2_0_startfunction jpeg_v2_0_stopfunction jpeg_v2_0_dec_ring_get_rptrfunction jpeg_v2_0_dec_ring_get_wptrfunction jpeg_v2_0_dec_ring_set_wptrfunction jpeg_v2_0_dec_ring_insert_startfunction jpeg_v2_0_dec_ring_insert_endfunction jpeg_v2_0_dec_ring_emit_fencefunction jpeg_v2_0_dec_ring_emit_ibfunction jpeg_v2_0_dec_ring_emit_reg_waitfunction jpeg_v2_0_dec_ring_emit_vm_flushfunction jpeg_v2_0_dec_ring_emit_wregfunction jpeg_v2_0_dec_ring_nopfunction jpeg_v2_0_is_idlefunction jpeg_v2_0_wait_for_idlefunction jpeg_v2_0_set_clockgating_statefunction jpeg_v2_0_set_powergating_statefunction jpeg_v2_0_set_interrupt_statefunction jpeg_v2_0_process_interruptfunction jpeg_v2_0_ring_resetfunction jpeg_v2_0_set_dec_ring_funcsfunction jpeg_v2_0_set_irq_funcs
Annotated Snippet
if (r) {
drm_err(adev_to_drm(adev), "failed to disable JPEG power gating\n");
return r;
}
}
/* Removing the anti hang mechanism to indicate the UVDJ tile is ON */
data = RREG32(SOC15_REG_OFFSET(JPEG, 0, mmUVD_JPEG_POWER_STATUS)) & ~0x1;
WREG32(SOC15_REG_OFFSET(JPEG, 0, mmUVD_JPEG_POWER_STATUS), data);
return 0;
}
static int jpeg_v2_0_enable_power_gating(struct amdgpu_device *adev)
{
if (adev->pg_flags & AMD_PG_SUPPORT_JPEG) {
uint32_t data;
int r = 0;
data = RREG32(SOC15_REG_OFFSET(JPEG, 0, mmUVD_JPEG_POWER_STATUS));
data &= ~UVD_JPEG_POWER_STATUS__JPEG_POWER_STATUS_MASK;
data |= 0x1; //UVD_JPEG_POWER_STATUS__JPEG_POWER_STATUS_TILES_OFF;
WREG32(SOC15_REG_OFFSET(JPEG, 0, mmUVD_JPEG_POWER_STATUS), data);
data = 2 << UVD_PGFSM_CONFIG__UVDJ_PWR_CONFIG__SHIFT;
WREG32(SOC15_REG_OFFSET(JPEG, 0, mmUVD_PGFSM_CONFIG), data);
r = SOC15_WAIT_ON_RREG(JPEG, 0, mmUVD_PGFSM_STATUS,
(2 << UVD_PGFSM_STATUS__UVDJ_PWR_STATUS__SHIFT),
UVD_PGFSM_STATUS__UVDJ_PWR_STATUS_MASK);
if (r) {
drm_err(adev_to_drm(adev), "failed to enable JPEG power gating\n");
return r;
}
}
return 0;
}
static void jpeg_v2_0_disable_clock_gating(struct amdgpu_device *adev)
{
uint32_t data;
data = RREG32_SOC15(JPEG, 0, mmJPEG_CGC_CTRL);
if (adev->cg_flags & AMD_CG_SUPPORT_JPEG_MGCG)
data |= 1 << JPEG_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
else
data &= ~JPEG_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
data |= 1 << JPEG_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT;
data |= 4 << JPEG_CGC_CTRL__CLK_OFF_DELAY__SHIFT;
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_CTRL, data);
data = RREG32_SOC15(JPEG, 0, mmJPEG_CGC_GATE);
data &= ~(JPEG_CGC_GATE__JPEG_DEC_MASK
| JPEG_CGC_GATE__JPEG2_DEC_MASK
| JPEG_CGC_GATE__JPEG_ENC_MASK
| JPEG_CGC_GATE__JMCIF_MASK
| JPEG_CGC_GATE__JRBBM_MASK);
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_GATE, data);
}
static void jpeg_v2_0_enable_clock_gating(struct amdgpu_device *adev)
{
uint32_t data;
data = RREG32_SOC15(JPEG, 0, mmJPEG_CGC_CTRL);
if (adev->cg_flags & AMD_CG_SUPPORT_JPEG_MGCG)
data |= 1 << JPEG_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
else
data |= 0 << JPEG_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
data |= 1 << JPEG_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT;
data |= 4 << JPEG_CGC_CTRL__CLK_OFF_DELAY__SHIFT;
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_CTRL, data);
data = RREG32_SOC15(JPEG, 0, mmJPEG_CGC_GATE);
data |= (JPEG_CGC_GATE__JPEG_DEC_MASK
|JPEG_CGC_GATE__JPEG2_DEC_MASK
|JPEG_CGC_GATE__JPEG_ENC_MASK
|JPEG_CGC_GATE__JMCIF_MASK
|JPEG_CGC_GATE__JRBBM_MASK);
WREG32_SOC15(JPEG, 0, mmJPEG_CGC_GATE, data);
}
/**
* jpeg_v2_0_start - start JPEG block
*
* @adev: amdgpu_device pointer
Annotation
- Immediate include surface: `amdgpu.h`, `amdgpu_jpeg.h`, `amdgpu_pm.h`, `soc15.h`, `soc15d.h`, `jpeg_v2_0.h`, `vcn/vcn_2_0_0_offset.h`, `vcn/vcn_2_0_0_sh_mask.h`.
- Detected declarations: `function jpeg_v2_0_early_init`, `function jpeg_v2_0_sw_init`, `function jpeg_v2_0_sw_fini`, `function jpeg_v2_0_hw_init`, `function jpeg_v2_0_hw_fini`, `function jpeg_v2_0_suspend`, `function jpeg_v2_0_resume`, `function jpeg_v2_0_disable_power_gating`, `function jpeg_v2_0_enable_power_gating`, `function jpeg_v2_0_disable_clock_gating`.
- 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.