summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2025-12-08 18:38:52 +0530
committerAlex Deucher <alexander.deucher@amd.com>2026-03-02 16:43:10 -0500
commit366201e790f10ddc081ef787e2e345553b87459d (patch)
treec1ac552ffa98ddb3c1f915726417a7aad18e3816 /drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c
parentf4eb08f8b216c334752246fe24e1304477d78968 (diff)
downloadlwn-366201e790f10ddc081ef787e2e345553b87459d.tar.gz
lwn-366201e790f10ddc081ef787e2e345553b87459d.zip
drm/amdgpu: Add uvd indirect to register block
Add uvd indirect method to register access block and replace the existing calls from adev. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c
index 5debc5c39101..1f5d6be9a0fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_reg_access.c
@@ -38,6 +38,10 @@ void amdgpu_reg_access_init(struct amdgpu_device *adev)
spin_lock_init(&adev->reg.smc.lock);
adev->reg.smc.rreg = NULL;
adev->reg.smc.wreg = NULL;
+
+ spin_lock_init(&adev->reg.uvd_ctx.lock);
+ adev->reg.uvd_ctx.rreg = NULL;
+ adev->reg.uvd_ctx.wreg = NULL;
}
uint32_t amdgpu_reg_smc_rd32(struct amdgpu_device *adev, uint32_t reg)
@@ -58,6 +62,27 @@ void amdgpu_reg_smc_wr32(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
adev->reg.smc.wreg(adev, reg, v);
}
+uint32_t amdgpu_reg_uvd_ctx_rd32(struct amdgpu_device *adev, uint32_t reg)
+{
+ if (!adev->reg.uvd_ctx.rreg) {
+ dev_err_once(adev->dev,
+ "UVD_CTX register read not supported\n");
+ return 0;
+ }
+ return adev->reg.uvd_ctx.rreg(adev, reg);
+}
+
+void amdgpu_reg_uvd_ctx_wr32(struct amdgpu_device *adev, uint32_t reg,
+ uint32_t v)
+{
+ if (!adev->reg.uvd_ctx.wreg) {
+ dev_err_once(adev->dev,
+ "UVD_CTX register write not supported\n");
+ return;
+ }
+ adev->reg.uvd_ctx.wreg(adev, reg, v);
+}
+
/*
* register access helper functions.
*/