Skip to content

Commit 682439f

Browse files
Samson Tamalexdeucher
authored andcommitted
drm/amd/display: filter out invalid bits in pipe_fuses
[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 <Alvin.Lee2@amd.com> Acked-by: Alan Liu <HaoPing.Liu@amd.com> Signed-off-by: Samson Tam <Samson.Tam@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org # 6.1.x
1 parent 8f586cc commit 682439f

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,14 @@ static struct resource_funcs dcn32_res_pool_funcs = {
20792079
.restore_mall_state = dcn32_restore_mall_state,
20802080
};
20812081

2082+
static uint32_t read_pipe_fuses(struct dc_context *ctx)
2083+
{
2084+
uint32_t value = REG_READ(CC_DC_PIPE_DIS);
2085+
/* DCN32 support max 4 pipes */
2086+
value = value & 0xf;
2087+
return value;
2088+
}
2089+
20822090

20832091
static bool dcn32_resource_construct(
20842092
uint8_t num_virtual_links,
@@ -2122,7 +2130,7 @@ static bool dcn32_resource_construct(
21222130
pool->base.res_cap = &res_cap_dcn32;
21232131
/* max number of pipes for ASIC before checking for pipe fuses */
21242132
num_pipes = pool->base.res_cap->num_timing_generator;
2125-
pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
2133+
pipe_fuses = read_pipe_fuses(ctx);
21262134

21272135
for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
21282136
if (pipe_fuses & 1 << i)

drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,14 @@ static struct resource_funcs dcn321_res_pool_funcs = {
16321632
.restore_mall_state = dcn32_restore_mall_state,
16331633
};
16341634

1635+
static uint32_t read_pipe_fuses(struct dc_context *ctx)
1636+
{
1637+
uint32_t value = REG_READ(CC_DC_PIPE_DIS);
1638+
/* DCN321 support max 4 pipes */
1639+
value = value & 0xf;
1640+
return value;
1641+
}
1642+
16351643

16361644
static bool dcn321_resource_construct(
16371645
uint8_t num_virtual_links,
@@ -1674,7 +1682,7 @@ static bool dcn321_resource_construct(
16741682
pool->base.res_cap = &res_cap_dcn321;
16751683
/* max number of pipes for ASIC before checking for pipe fuses */
16761684
num_pipes = pool->base.res_cap->num_timing_generator;
1677-
pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
1685+
pipe_fuses = read_pipe_fuses(ctx);
16781686

16791687
for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
16801688
if (pipe_fuses & 1 << i)

0 commit comments

Comments
 (0)