Skip to content

Commit 116151b

Browse files
AngeloGioacchino Del Regnowens
authored andcommitted
clk: mediatek: clk-mt8192: Add clock mux notifier for mfg_pll_sel
Following the changes that were done for mt8183, add a clock notifier for the GPU PLL selector mux: this allows safe clock rate changes by temporarily reparenting the GPU to a safe clock (clk26m) while the MFGPLL is reprogrammed and stabilizes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20220927101128.44758-11-angelogioacchino.delregno@collabora.com Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
1 parent 341d203 commit 116151b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drivers/clk/mediatek/clk-mt8192.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,28 @@ static void clk_mt8192_top_init_early(struct device_node *node)
12241224
CLK_OF_DECLARE_DRIVER(mt8192_topckgen, "mediatek,mt8192-topckgen",
12251225
clk_mt8192_top_init_early);
12261226

1227+
/* Register mux notifier for MFG mux */
1228+
static int clk_mt8192_reg_mfg_mux_notifier(struct device *dev, struct clk *clk)
1229+
{
1230+
struct mtk_mux_nb *mfg_mux_nb;
1231+
int i;
1232+
1233+
mfg_mux_nb = devm_kzalloc(dev, sizeof(*mfg_mux_nb), GFP_KERNEL);
1234+
if (!mfg_mux_nb)
1235+
return -ENOMEM;
1236+
1237+
for (i = 0; i < ARRAY_SIZE(top_mtk_muxes); i++)
1238+
if (top_mtk_muxes[i].id == CLK_TOP_MFG_PLL_SEL)
1239+
break;
1240+
if (i == ARRAY_SIZE(top_mtk_muxes))
1241+
return -EINVAL;
1242+
1243+
mfg_mux_nb->ops = top_mtk_muxes[i].ops;
1244+
mfg_mux_nb->bypass_index = 0; /* Bypass to 26M crystal */
1245+
1246+
return devm_mtk_clk_mux_notifier_register(dev, clk, mfg_mux_nb);
1247+
}
1248+
12271249
static int clk_mt8192_top_probe(struct platform_device *pdev)
12281250
{
12291251
struct device_node *node = pdev->dev.of_node;
@@ -1247,6 +1269,12 @@ static int clk_mt8192_top_probe(struct platform_device *pdev)
12471269
if (r)
12481270
return r;
12491271

1272+
r = clk_mt8192_reg_mfg_mux_notifier(&pdev->dev,
1273+
top_clk_data->hws[CLK_TOP_MFG_PLL_SEL]->clk);
1274+
if (r)
1275+
return r;
1276+
1277+
12501278
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
12511279
top_clk_data);
12521280
}

0 commit comments

Comments
 (0)