Skip to content

Commit 831f921

Browse files
AngeloGioacchino Del Regnobebarino
authored andcommitted
clk: mediatek: mt8195-topckgen: Refactor parents for top_dp/edp muxes
The top_dp and top_edp muxes can be both parented to either TVDPLL1 or TVDPLL2, two identically specced PLLs for the specific purpose of giving out pixel clock: this becomes a problem when the MediaTek DisplayPort Interface (DPI) driver tries to set the pixel clock rate. In the usecase of two simultaneous outputs (using two controllers), it was seen that one of the displays would sometimes display garbled output (if any at all) and this was because: - top_edp was set to TVDPLL1, outputting X GHz - top_dp was set to TVDPLL2, outputting Y GHz - mtk_dpi calls clk_set_rate(top_edp, Z GHz) - top_dp is switched to TVDPLL1 - TVDPLL1 changes its rate, top_edp outputs the wrong rate. - eDP display is garbled To solve this issue, remove all TVDPLL1 parents from `top_dp` and all TVDPLL2 parents from `top_edp`, plus, necessarily switch both clocks to use the new MUX_GATE_CLR_SET_UPD_INDEXED() macro to be able to use the right bit index for the new parents list. Reviewed-by: Alexandre Mergnat <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Fei Shao <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent a6a70a6 commit 831f921

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

drivers/clk/mediatek/clk-mt8195-topckgen.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,17 +415,28 @@ static const char * const pwrmcu_parents[] = {
415415
"mainpll_d4_d2"
416416
};
417417

418+
/*
419+
* Both DP/eDP can be parented to TVDPLL1 and TVDPLL2, but we force using
420+
* TVDPLL1 on eDP and TVDPLL2 on DP to avoid changing the "other" PLL rate
421+
* in dual output case, which would lead to corruption of functionality loss.
422+
*/
418423
static const char * const dp_parents[] = {
419424
"clk26m",
420-
"tvdpll1_d2",
421425
"tvdpll2_d2",
422-
"tvdpll1_d4",
423426
"tvdpll2_d4",
424-
"tvdpll1_d8",
425427
"tvdpll2_d8",
426-
"tvdpll1_d16",
427428
"tvdpll2_d16"
428429
};
430+
static const u8 dp_parents_idx[] = { 0, 2, 4, 6, 8 };
431+
432+
static const char * const edp_parents[] = {
433+
"clk26m",
434+
"tvdpll1_d2",
435+
"tvdpll1_d4",
436+
"tvdpll1_d8",
437+
"tvdpll1_d16"
438+
};
439+
static const u8 edp_parents_idx[] = { 0, 1, 3, 5, 7 };
429440

430441
static const char * const disp_pwm_parents[] = {
431442
"clk26m",
@@ -957,11 +968,11 @@ static const struct mtk_mux top_mtk_muxes[] = {
957968
MUX_GATE_CLR_SET_UPD_FLAGS(CLK_TOP_PWRMCU, "top_pwrmcu",
958969
pwrmcu_parents, 0x08C, 0x090, 0x094, 16, 3, 23, 0x08, 6,
959970
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
960-
MUX_GATE_CLR_SET_UPD(CLK_TOP_DP, "top_dp",
961-
dp_parents, 0x08C, 0x090, 0x094, 24, 4, 31, 0x08, 7),
971+
MUX_GATE_CLR_SET_UPD_INDEXED(CLK_TOP_DP, "top_dp",
972+
dp_parents, dp_parents_idx, 0x08C, 0x090, 0x094, 24, 4, 31, 0x08, 7),
962973
/* CLK_CFG_10 */
963-
MUX_GATE_CLR_SET_UPD(CLK_TOP_EDP, "top_edp",
964-
dp_parents, 0x098, 0x09C, 0x0A0, 0, 4, 7, 0x08, 8),
974+
MUX_GATE_CLR_SET_UPD_INDEXED(CLK_TOP_EDP, "top_edp",
975+
edp_parents, edp_parents_idx, 0x098, 0x09C, 0x0A0, 0, 4, 7, 0x08, 8),
965976
MUX_GATE_CLR_SET_UPD(CLK_TOP_DPI, "top_dpi",
966977
dp_parents, 0x098, 0x09C, 0x0A0, 8, 4, 15, 0x08, 9),
967978
MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_PWM0, "top_disp_pwm0",

0 commit comments

Comments
 (0)