drm: mediatek: Modify dpi power on/off sequence.
Subsystems (3)
PATCH v4 1/1 drm: mediatek: Modify dpi power on/off sequence.
From: Xinlei Lee <[email protected]>
Modify dpi power on/off sequence so that the first gpio operation will take effect.
---
change note:
v3: Moved pull-down pin control after mtk_dpi_power_off.
v2: Remove the empty line between Fixes: and S-o-b.
v1: Rebase on linus/master v6.1-rc1. Change nothing.
Because dpi power_on/off is protected by dpi->refcount, the first time it cannot be powered on and off successfully, it will cause leakage.
---
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +6 -6
@@ -461,9 +461,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);
@@ -488,9 +485,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:
@@ -721,12 +715,18 @@ static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)struct mtk_dpi *dpi =bridge_to_dpi (bridge);mtk_dpi_power_off (dpi); + +if (dpi->pinctrl && dpi->pins_gpio) +pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); }static void mtk_dpi_bridge_enable (struct drm_bridge *bridge) {struct mtk_dpi *dpi =bridge_to_dpi (bridge); +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);
Signature · 1 line
2.18.0
Hi, Xinlei:
<[email protected]> 於 2022年11月9日 週三 下午6:01寫道:
Quoted 4 lines
From: Xinlei Lee <[email protected]>
Modify dpi power on/off sequence so that the first gpio operation will take effect.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
Quoted 64 lines
Fixes 6bd4763fd532 ("drm/mediatek: set dpi pin mode to gpio low to avoid leakage current")Signed-off-by Xinlei Lee <[email protected]>---
change note:
v3: Moved pull-down pin control aftermtk_dpi_power_off.v2: Remove the empty line between Fixes: and S-o-b.
v1: Rebase on linus/master v6.1-rc1. Change nothing.
Because dpi power_on/off is protected by
dpi->refcount, the first time it cannot be powered on and off successfully, it will cause leakage.
------ drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/mediatek/mtk_dpi.c +6
-7@@ -461,9 +461,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);@@ -488,9 +485,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:@@ -721,12 +715,18 @@ static void mtk_dpi_bridge_disable(struct drm_bridge *bridge)struct mtk_dpi *dpi =bridge_to_dpi (bridge);mtk_dpi_power_off (dpi); + +if (dpi->pinctrl && dpi->pins_gpio) +pinctrl_select_state (dpi->pinctrl, dpi->pins_gpio); }static void mtk_dpi_bridge_enable (struct drm_bridge *bridge) {struct mtk_dpi *dpi =bridge_to_dpi (bridge); +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); --2.18.0