]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/mediatek: Modify dpi power on/off sequence.
authorXinlei Lee <xinlei.lee@mediatek.com>
Wed, 9 Nov 2022 10:00:59 +0000 (18:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:02 +0000 (11:41 +0100)
[ Upstream commit ff446c0f6290185cefafe3b376bb86063a3a9f6a ]

Modify dpi power on/off sequence so that the first gpio operation will
take effect.

Fixes: 9b4142b9155c ("drm/mediatek: set dpi pin mode to gpio low to avoid leakage current")
Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/mediatek/mtk_dpi.c

index 4a64d8aed9da97cbaa609e1c0b81473040066d10..7c68a393391508d09c345bbd02f62a149f605a70 100644 (file)
@@ -364,9 +364,6 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
        if (--dpi->refcount != 0)
                return;
 
-       if (dpi->pinctrl && dpi->pins_gpio)
-               pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
-
        mtk_dpi_disable(dpi);
        clk_disable_unprepare(dpi->pixel_clk);
        clk_disable_unprepare(dpi->engine_clk);
@@ -391,9 +388,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
                goto err_pixel;
        }
 
-       if (dpi->pinctrl && dpi->pins_dpi)
-               pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
-
        return 0;
 
 err_pixel:
@@ -529,12 +523,18 @@ static void mtk_dpi_encoder_disable(struct drm_encoder *encoder)
        struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
 
        mtk_dpi_power_off(dpi);
+
+       if (dpi->pinctrl && dpi->pins_gpio)
+               pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);
 }
 
 static void mtk_dpi_encoder_enable(struct drm_encoder *encoder)
 {
        struct mtk_dpi *dpi = mtk_dpi_from_encoder(encoder);
 
+       if (dpi->pinctrl && dpi->pins_dpi)
+               pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);
+
        mtk_dpi_power_on(dpi);
        mtk_dpi_set_display_mode(dpi, &dpi->mode);
        mtk_dpi_enable(dpi);