Skip to content

Commit 5359d5b

Browse files
Nicholas Susantoalexdeucher
authored andcommitted
drm/amd/display: Refactor dccg35_get_other_enabled_symclk_fe
[Why] Function used to check the number of FEs connected to the current BE. This was then used to determine if the symclk could be disabled, if all FEs were disconnected. However, the function would skip over the primary FE and return 0 when the primary FE was still connected. This caused black screens on driver disable with an MST daisy chain hooked up. [How] Refactor the function to correctly return the number of FEs connected to the input BE. Also, rename it for clarity. Reviewed-by: Nicholas Kazlauskas <[email protected]> Signed-off-by: Nicholas Susanto <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 4481df3 commit 5359d5b

File tree

1 file changed

+25
-40
lines changed

1 file changed

+25
-40
lines changed

drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,47 +1932,32 @@ static void dccg35_enable_symclk_se(struct dccg *dccg, uint32_t stream_enc_inst,
19321932
}
19331933

19341934
/*get other front end connected to this backend*/
1935-
static uint8_t dccg35_get_other_enabled_symclk_fe(struct dccg *dccg, uint32_t stream_enc_inst, uint32_t link_enc_inst)
1935+
static uint8_t dccg35_get_number_enabled_symclk_fe_connected_to_be(struct dccg *dccg, uint32_t link_enc_inst)
19361936
{
19371937
uint8_t num_enabled_symclk_fe = 0;
1938-
uint32_t be_clk_en = 0, fe_clk_en[5] = {0}, be_clk_sel[5] = {0};
1938+
uint32_t fe_clk_en[5] = {0}, be_clk_sel[5] = {0};
19391939
struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
19401940

1941-
switch (link_enc_inst) {
1942-
case 0:
1943-
REG_GET_3(SYMCLKA_CLOCK_ENABLE, SYMCLKA_CLOCK_ENABLE, &be_clk_en,
1944-
SYMCLKA_FE_EN, &fe_clk_en[0],
1945-
SYMCLKA_FE_SRC_SEL, &be_clk_sel[0]);
1946-
break;
1947-
case 1:
1948-
REG_GET_3(SYMCLKB_CLOCK_ENABLE, SYMCLKB_CLOCK_ENABLE, &be_clk_en,
1949-
SYMCLKB_FE_EN, &fe_clk_en[1],
1950-
SYMCLKB_FE_SRC_SEL, &be_clk_sel[1]);
1951-
break;
1952-
case 2:
1953-
REG_GET_3(SYMCLKC_CLOCK_ENABLE, SYMCLKC_CLOCK_ENABLE, &be_clk_en,
1954-
SYMCLKC_FE_EN, &fe_clk_en[2],
1955-
SYMCLKC_FE_SRC_SEL, &be_clk_sel[2]);
1956-
break;
1957-
case 3:
1958-
REG_GET_3(SYMCLKD_CLOCK_ENABLE, SYMCLKD_CLOCK_ENABLE, &be_clk_en,
1959-
SYMCLKD_FE_EN, &fe_clk_en[3],
1960-
SYMCLKD_FE_SRC_SEL, &be_clk_sel[3]);
1961-
break;
1962-
case 4:
1963-
REG_GET_3(SYMCLKE_CLOCK_ENABLE, SYMCLKE_CLOCK_ENABLE, &be_clk_en,
1964-
SYMCLKE_FE_EN, &fe_clk_en[4],
1965-
SYMCLKE_FE_SRC_SEL, &be_clk_sel[4]);
1966-
break;
1967-
}
1968-
if (be_clk_en) {
1969-
/* for DPMST, this backend could be used by multiple front end.
1970-
only disable the backend if this stream_enc_ins is the last active stream enc connected to this back_end*/
1971-
uint8_t i;
1972-
for (i = 0; i != link_enc_inst && i < ARRAY_SIZE(fe_clk_en); i++) {
1973-
if (fe_clk_en[i] && be_clk_sel[i] == link_enc_inst)
1974-
num_enabled_symclk_fe++;
1975-
}
1941+
REG_GET_2(SYMCLKA_CLOCK_ENABLE, SYMCLKA_FE_EN, &fe_clk_en[0],
1942+
SYMCLKA_FE_SRC_SEL, &be_clk_sel[0]);
1943+
1944+
REG_GET_2(SYMCLKB_CLOCK_ENABLE, SYMCLKB_FE_EN, &fe_clk_en[1],
1945+
SYMCLKB_FE_SRC_SEL, &be_clk_sel[1]);
1946+
1947+
REG_GET_2(SYMCLKC_CLOCK_ENABLE, SYMCLKC_FE_EN, &fe_clk_en[2],
1948+
SYMCLKC_FE_SRC_SEL, &be_clk_sel[2]);
1949+
1950+
REG_GET_2(SYMCLKD_CLOCK_ENABLE, SYMCLKD_FE_EN, &fe_clk_en[3],
1951+
SYMCLKD_FE_SRC_SEL, &be_clk_sel[3]);
1952+
1953+
REG_GET_2(SYMCLKE_CLOCK_ENABLE, SYMCLKE_FE_EN, &fe_clk_en[4],
1954+
SYMCLKE_FE_SRC_SEL, &be_clk_sel[4]);
1955+
1956+
uint8_t i;
1957+
1958+
for (i = 0; i < ARRAY_SIZE(fe_clk_en); i++) {
1959+
if (fe_clk_en[i] && be_clk_sel[i] == link_enc_inst)
1960+
num_enabled_symclk_fe++;
19761961
}
19771962
return num_enabled_symclk_fe;
19781963
}
@@ -2020,9 +2005,9 @@ static void dccg35_disable_symclk_se(struct dccg *dccg, uint32_t stream_enc_inst
20202005
break;
20212006
}
20222007

2023-
/*check other enabled symclk fe */
2024-
num_enabled_symclk_fe = dccg35_get_other_enabled_symclk_fe(dccg, stream_enc_inst, link_enc_inst);
2025-
/*only turn off backend clk if other front end attachecd to this backend are all off,
2008+
/*check other enabled symclk fe connected to this be */
2009+
num_enabled_symclk_fe = dccg35_get_number_enabled_symclk_fe_connected_to_be(dccg, link_enc_inst);
2010+
/*only turn off backend clk if other front end attached to this backend are all off,
20262011
for mst, only turn off the backend if this is the last front end*/
20272012
if (num_enabled_symclk_fe == 0) {
20282013
switch (link_enc_inst) {

0 commit comments

Comments
 (0)