drivers/gpu/drm/radeon/uvd_v1_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/uvd_v1_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/uvd_v1_0.c- Extension
.c- Size
- 13656 bytes
- Lines
- 543
- 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
linux/firmware.hradeon.hradeon_asic.hr600d.h
Detected Declarations
function filesfunction uvd_v1_0_get_wptrfunction uvd_v1_0_set_wptrfunction uvd_v1_0_fence_emitfunction uvd_v1_0_resumefunction uvd_v1_0_initfunction uvd_v1_0_finifunction uvd_v1_0_startfunction uvd_v1_0_stopfunction uvd_v1_0_ring_testfunction commandfunction uvd_v1_0_ib_executefunction uvd_v1_0_ib_test
Annotated Snippet
switch (rdev->family) {
case CHIP_RV610:
case CHIP_RV630:
case CHIP_RV620:
/* 64byte granularity workaround */
WREG32(MC_CONFIG, 0);
WREG32(MC_CONFIG, 1 << 4);
WREG32(RS_DQ_RD_RET_CONF, 0x3f);
WREG32(MC_CONFIG, 0x1f);
fallthrough;
case CHIP_RV670:
case CHIP_RV635:
/* write clean workaround */
WREG32_P(UVD_VCPU_CNTL, 0x10, ~0x10);
break;
default:
/* TODO: Do we need more? */
break;
}
drm_info(&rdev->ddev, "UVD initialized successfully.\n");
}
return r;
}
/**
* uvd_v1_0_fini - stop the hardware block
*
* @rdev: radeon_device pointer
*
* Stop the UVD block, mark ring as not ready any more
*/
void uvd_v1_0_fini(struct radeon_device *rdev)
{
struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
uvd_v1_0_stop(rdev);
ring->ready = false;
}
/**
* uvd_v1_0_start - start UVD block
*
* @rdev: radeon_device pointer
*
* Setup and start the UVD block
*/
int uvd_v1_0_start(struct radeon_device *rdev)
{
struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX];
uint32_t rb_bufsz;
int i, j, r;
/* disable byte swapping */
u32 lmi_swap_cntl = 0;
u32 mp_swap_cntl = 0;
/* disable clock gating */
WREG32(UVD_CGC_GATE, 0);
/* disable interupt */
WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1));
/* Stall UMC and register bus before resetting VCPU */
WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8));
WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3));
mdelay(1);
/* put LMI, VCPU, RBC etc... into reset */
WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET |
LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET |
CXW_SOFT_RESET | TAP_SOFT_RESET | LMI_UMC_SOFT_RESET);
mdelay(5);
/* take UVD block out of reset */
WREG32_P(SRBM_SOFT_RESET, 0, ~SOFT_RESET_UVD);
mdelay(5);
/* initialize UVD memory controller */
WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) |
(1 << 21) | (1 << 9) | (1 << 20));
#ifdef __BIG_ENDIAN
/* swap (8 in 32) RB and IB */
lmi_swap_cntl = 0xa;
mp_swap_cntl = 0;
Annotation
- Immediate include surface: `linux/firmware.h`, `radeon.h`, `radeon_asic.h`, `r600d.h`.
- Detected declarations: `function files`, `function uvd_v1_0_get_wptr`, `function uvd_v1_0_set_wptr`, `function uvd_v1_0_fence_emit`, `function uvd_v1_0_resume`, `function uvd_v1_0_init`, `function uvd_v1_0_fini`, `function uvd_v1_0_start`, `function uvd_v1_0_stop`, `function uvd_v1_0_ring_test`.
- 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.