Skip to content

Commit 7aa6c24

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: g12a: Limit the HDMI PLL OD to /4
GXBB has the HDMI PLL OD in the HHI_HDMI_PLL_CNTL2 register while for G12A/G12B/SM1 the OD has moved to HHI_HDMI_PLL_CNTL0. At first glance the rest of the OD setup seems identical. However, looking at the downstream kernel sources as well as testing shows that G12A/G12B/SM1 only supports three OD values: - register value 0 means: divide by 1 - register value 1 means: divide by 2 - register value 2 means: divide by 4 Downstream sources are also only using OD register values 0, 1 and 2 for G12A/G12B/SM1 (while for GXBB the downstream kernel sources are also using value 3 which means: divide by 8). Add clk_div_table and have it replace the CLK_DIVIDER_POWER_OF_TWO flag to make the kernel's view of this register match with how the hardware actually works. Fixes: 085a4ea ("clk: meson: g12a: add peripheral clock controller") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20260105204710.447779-3-martin.blumenstingl@googlemail.com Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
1 parent 5b1a439 commit 7aa6c24

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

drivers/clk/meson/g12a.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,23 @@ static struct clk_regmap g12a_hdmi_pll_dco = {
777777
},
778778
};
779779

780+
/*
781+
* G12/SM1 hdmi OD dividers are POWER_OF_TWO dividers but limited to /4.
782+
* A divider value of 3 should map to /8 but instead map /4 so ignore it.
783+
*/
784+
static const struct clk_div_table g12a_hdmi_pll_od_div_table[] = {
785+
{ .val = 0, .div = 1 },
786+
{ .val = 1, .div = 2 },
787+
{ .val = 2, .div = 4 },
788+
{ /* sentinel */ }
789+
};
790+
780791
static struct clk_regmap g12a_hdmi_pll_od = {
781792
.data = &(struct clk_regmap_div_data){
782793
.offset = HHI_HDMI_PLL_CNTL0,
783794
.shift = 16,
784795
.width = 2,
785-
.flags = CLK_DIVIDER_POWER_OF_TWO,
796+
.table = g12a_hdmi_pll_od_div_table,
786797
},
787798
.hw.init = &(struct clk_init_data){
788799
.name = "hdmi_pll_od",
@@ -800,7 +811,7 @@ static struct clk_regmap g12a_hdmi_pll_od2 = {
800811
.offset = HHI_HDMI_PLL_CNTL0,
801812
.shift = 18,
802813
.width = 2,
803-
.flags = CLK_DIVIDER_POWER_OF_TWO,
814+
.table = g12a_hdmi_pll_od_div_table,
804815
},
805816
.hw.init = &(struct clk_init_data){
806817
.name = "hdmi_pll_od2",
@@ -818,7 +829,7 @@ static struct clk_regmap g12a_hdmi_pll = {
818829
.offset = HHI_HDMI_PLL_CNTL0,
819830
.shift = 20,
820831
.width = 2,
821-
.flags = CLK_DIVIDER_POWER_OF_TWO,
832+
.table = g12a_hdmi_pll_od_div_table,
822833
},
823834
.hw.init = &(struct clk_init_data){
824835
.name = "hdmi_pll",

0 commit comments

Comments
 (0)