drm/amd/display: Add DCE BIOS_SCRATCH_0 register
authorTimur Kristóf <timur.kristof@gmail.com>
Fri, 26 Sep 2025 18:01:57 +0000 (20:01 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Oct 2025 14:09:42 +0000 (10:09 -0400)
The BIOS uses this register to write the results of the
DAC_LoadDetection command, so we'll need to read this
in order to make DAC load detection work.

As a reference, I used the mmBIOS_SCRATCH_0 definition from
the amdgpu legacy display code.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c

index 545ce1e..50c8906 100644 (file)
@@ -168,6 +168,7 @@ struct dc_vbios_funcs {
 };
 
 struct bios_registers {
+       uint32_t BIOS_SCRATCH_0;
        uint32_t BIOS_SCRATCH_3;
        uint32_t BIOS_SCRATCH_6;
 };
index 85ea219..d40d91e 100644 (file)
@@ -78,6 +78,7 @@
 #endif
 
 #ifndef mmBIOS_SCRATCH_2
+       #define mmBIOS_SCRATCH_0 0x05C9
        #define mmBIOS_SCRATCH_2 0x05CB
        #define mmBIOS_SCRATCH_3 0x05CC
        #define mmBIOS_SCRATCH_6 0x05CF
@@ -369,6 +370,7 @@ static const struct dce_abm_mask abm_mask = {
 #define DCFE_MEM_PWR_CTRL_REG_BASE 0x1b03
 
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0,
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3,
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
 };
index 9e14ffb..cd54382 100644 (file)
@@ -82,6 +82,7 @@
 #endif
 
 #ifndef mmBIOS_SCRATCH_2
+       #define mmBIOS_SCRATCH_0 0x05C9
        #define mmBIOS_SCRATCH_2 0x05CB
        #define mmBIOS_SCRATCH_3 0x05CC
        #define mmBIOS_SCRATCH_6 0x05CF
@@ -377,6 +378,7 @@ static const struct dce110_clk_src_mask cs_mask = {
 };
 
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0,
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3,
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
 };
index 62977bc..3f0a6bc 100644 (file)
@@ -76,6 +76,7 @@
 #endif
 
 #ifndef mmBIOS_SCRATCH_2
+       #define mmBIOS_SCRATCH_0 0x05C9
        #define mmBIOS_SCRATCH_2 0x05CB
        #define mmBIOS_SCRATCH_3 0x05CC
        #define mmBIOS_SCRATCH_6 0x05CF
@@ -385,6 +386,7 @@ static const struct dce110_clk_src_mask cs_mask = {
 };
 
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0,
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3,
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
 };
index 0770ea3..b1570b6 100644 (file)
@@ -491,6 +491,7 @@ static struct dce_i2c_hw *dce120_i2c_hw_create(
        return dce_i2c_hw;
 }
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0 + NBIO_BASE(mmBIOS_SCRATCH_0_BASE_IDX),
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3 + NBIO_BASE(mmBIOS_SCRATCH_3_BASE_IDX),
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6 + NBIO_BASE(mmBIOS_SCRATCH_6_BASE_IDX)
 };
index 6e89b70..f015293 100644 (file)
@@ -80,6 +80,7 @@
 
 
 #ifndef mmBIOS_SCRATCH_2
+       #define mmBIOS_SCRATCH_0 0x05C9
        #define mmBIOS_SCRATCH_2 0x05CB
        #define mmBIOS_SCRATCH_3 0x05CC
        #define mmBIOS_SCRATCH_6 0x05CF
@@ -368,6 +369,7 @@ static const struct dce110_clk_src_mask cs_mask = {
 };
 
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0,
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3,
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
 };
index a1ad739..8687104 100644 (file)
@@ -78,6 +78,7 @@
 
 
 #ifndef mmBIOS_SCRATCH_2
+       #define mmBIOS_SCRATCH_0 0x05C9
        #define mmBIOS_SCRATCH_2 0x05CB
        #define mmBIOS_SCRATCH_3 0x05CC
        #define mmBIOS_SCRATCH_6 0x05CF
@@ -369,6 +370,7 @@ static const struct dce110_clk_src_mask cs_mask = {
 };
 
 static const struct bios_registers bios_regs = {
+       .BIOS_SCRATCH_0 = mmBIOS_SCRATCH_0,
        .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3,
        .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
 };