Skip to content

Commit ebbf49d

Browse files
AngeloGioacchino Del Regnobebarino
authored andcommitted
clk: mediatek: mt8188-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. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Alexandre Mergnat <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Tested-by: Fei Shao <[email protected]> Reviewed-by: Fei Shao <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 831f921 commit ebbf49d

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -475,29 +475,28 @@ static const char * const sspm_parents[] = {
475475
"mainpll_d4_d2"
476476
};
477477

478+
/*
479+
* Both DP/eDP can be parented to TVDPLL1 and TVDPLL2, but we force using
480+
* TVDPLL1 on eDP and TVDPLL2 on DP to avoid changing the "other" PLL rate
481+
* in dual output case, which would lead to corruption of functionality loss.
482+
*/
478483
static const char * const dp_parents[] = {
479484
"clk26m",
480-
"tvdpll1_d2",
481485
"tvdpll2_d2",
482-
"tvdpll1_d4",
483486
"tvdpll2_d4",
484-
"tvdpll1_d8",
485487
"tvdpll2_d8",
486-
"tvdpll1_d16",
487488
"tvdpll2_d16"
488489
};
490+
static const u8 dp_parents_idx[] = { 0, 2, 4, 6, 8 };
489491

490492
static const char * const edp_parents[] = {
491493
"clk26m",
492494
"tvdpll1_d2",
493-
"tvdpll2_d2",
494495
"tvdpll1_d4",
495-
"tvdpll2_d4",
496496
"tvdpll1_d8",
497-
"tvdpll2_d8",
498-
"tvdpll1_d16",
499-
"tvdpll2_d16"
497+
"tvdpll1_d16"
500498
};
499+
static const u8 edp_parents_idx[] = { 0, 1, 3, 5, 7 };
501500

502501
static const char * const dpi_parents[] = {
503502
"clk26m",
@@ -1038,10 +1037,12 @@ static const struct mtk_mux top_mtk_muxes[] = {
10381037
MUX_GATE_CLR_SET_UPD(CLK_TOP_SSPM, "top_sspm",
10391038
sspm_parents, 0x080, 0x084, 0x088, 24, 4, 31, 0x08, 3),
10401039
/* CLK_CFG_9 */
1041-
MUX_GATE_CLR_SET_UPD(CLK_TOP_DP, "top_dp",
1042-
dp_parents, 0x08C, 0x090, 0x094, 0, 4, 7, 0x08, 4),
1043-
MUX_GATE_CLR_SET_UPD(CLK_TOP_EDP, "top_edp",
1044-
edp_parents, 0x08C, 0x090, 0x094, 8, 4, 15, 0x08, 5),
1040+
MUX_GATE_CLR_SET_UPD_INDEXED(CLK_TOP_DP, "top_dp",
1041+
dp_parents, dp_parents_idx, 0x08C, 0x090, 0x094,
1042+
0, 4, 7, 0x08, 4),
1043+
MUX_GATE_CLR_SET_UPD_INDEXED(CLK_TOP_EDP, "top_edp",
1044+
edp_parents, edp_parents_idx, 0x08C, 0x090, 0x094,
1045+
8, 4, 15, 0x08, 5),
10451046
MUX_GATE_CLR_SET_UPD(CLK_TOP_DPI, "top_dpi",
10461047
dpi_parents, 0x08C, 0x090, 0x094, 16, 4, 23, 0x08, 6),
10471048
MUX_GATE_CLR_SET_UPD(CLK_TOP_DISP_PWM0, "top_disp_pwm0",

0 commit comments

Comments
 (0)