]> Git Repo - linux.git/commitdiff
drm/amd/display: filter out invalid bits in pipe_fuses
authorSamson Tam <[email protected]>
Wed, 19 Apr 2023 22:17:14 +0000 (18:17 -0400)
committerAlex Deucher <[email protected]>
Thu, 4 May 2023 03:10:02 +0000 (23:10 -0400)
[Why]
Reading pipe_fuses from register may have invalid bits set, which may
 affect the num_pipes erroneously.

[How]
Add read_pipes_fuses() call and filter bits based on expected number
 of pipes.

Reviewed-by: Alvin Lee <[email protected]>
Acked-by: Alan Liu <[email protected]>
Signed-off-by: Samson Tam <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected] # 6.1.x
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c

index a876e6eb6cd886112d835365dac5b195ab08a729..22dd1ebea618b583ab560511e1fa4a2f6eae2e91 100644 (file)
@@ -2079,6 +2079,14 @@ static struct resource_funcs dcn32_res_pool_funcs = {
        .restore_mall_state = dcn32_restore_mall_state,
 };
 
+static uint32_t read_pipe_fuses(struct dc_context *ctx)
+{
+       uint32_t value = REG_READ(CC_DC_PIPE_DIS);
+       /* DCN32 support max 4 pipes */
+       value = value & 0xf;
+       return value;
+}
+
 
 static bool dcn32_resource_construct(
        uint8_t num_virtual_links,
@@ -2122,7 +2130,7 @@ static bool dcn32_resource_construct(
        pool->base.res_cap = &res_cap_dcn32;
        /* max number of pipes for ASIC before checking for pipe fuses */
        num_pipes  = pool->base.res_cap->num_timing_generator;
-       pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
+       pipe_fuses = read_pipe_fuses(ctx);
 
        for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
                if (pipe_fuses & 1 << i)
index e5ab7f3077c40066bd0eba692d223d78bdbd7970..a60ddb343d13b53739b93e640e600cdf1612b9f8 100644 (file)
@@ -1632,6 +1632,14 @@ static struct resource_funcs dcn321_res_pool_funcs = {
        .restore_mall_state = dcn32_restore_mall_state,
 };
 
+static uint32_t read_pipe_fuses(struct dc_context *ctx)
+{
+       uint32_t value = REG_READ(CC_DC_PIPE_DIS);
+       /* DCN321 support max 4 pipes */
+       value = value & 0xf;
+       return value;
+}
+
 
 static bool dcn321_resource_construct(
        uint8_t num_virtual_links,
@@ -1674,7 +1682,7 @@ static bool dcn321_resource_construct(
        pool->base.res_cap = &res_cap_dcn321;
        /* max number of pipes for ASIC before checking for pipe fuses */
        num_pipes  = pool->base.res_cap->num_timing_generator;
-       pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
+       pipe_fuses = read_pipe_fuses(ctx);
 
        for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
                if (pipe_fuses & 1 << i)
This page took 0.138374 seconds and 4 git commands to generate.