]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/mediatek: mtk_dpi: Explicitly manage TVD clock in power on/off
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 17 Feb 2025 15:48:02 +0000 (16:48 +0100)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Sun, 2 Mar 2025 14:00:55 +0000 (14:00 +0000)
In preparation for adding support for MT8195's HDMI reserved
DPI, add calls to clk_prepare_enable() / clk_disable_unprepare()
for the TVD clock: in this particular case, the aforementioned
clock is not (and cannot be) parented to neither pixel or engine
clocks hence it won't get enabled automatically by the clock
framework.

Please note that on all of the currently supported MediaTek
platforms, the TVD clock is always a parent of either pixel or
engine clocks, and this means that the common clock framework
is already enabling this clock before the children.
On such platforms, this commit will only increase the refcount
of the TVD clock without any functional change.

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20250217154836.108895-10-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dpi.c

index 897ae591e61de6c276244dbc1c656c19cda03339..14364d96f4d7349381bf79349450d54cf477dce8 100644 (file)
@@ -499,6 +499,7 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
 
        mtk_dpi_disable(dpi);
        clk_disable_unprepare(dpi->pixel_clk);
+       clk_disable_unprepare(dpi->tvd_clk);
        clk_disable_unprepare(dpi->engine_clk);
 }
 
@@ -515,6 +516,12 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
                goto err_refcount;
        }
 
+       ret = clk_prepare_enable(dpi->tvd_clk);
+       if (ret) {
+               dev_err(dpi->dev, "Failed to enable tvd pll: %d\n", ret);
+               goto err_engine;
+       }
+
        ret = clk_prepare_enable(dpi->pixel_clk);
        if (ret) {
                dev_err(dpi->dev, "Failed to enable pixel clock: %d\n", ret);
@@ -524,6 +531,8 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
        return 0;
 
 err_pixel:
+       clk_disable_unprepare(dpi->tvd_clk);
+err_engine:
        clk_disable_unprepare(dpi->engine_clk);
 err_refcount:
        dpi->refcount--;