diff mbox series

[1/1] drm/mediatek: fine tune the dsi panel's power sequence

Message ID 20191106080930.11770-2-jitao.shi@mediatek.com (mailing list archive)
State New, archived
Headers show
Series fine tune the dsi panel's power sequence | expand

Commit Message

Jitao Shi Nov. 6, 2019, 8:09 a.m. UTC
Add the drm_panel_prepare_power and drm_panel_unprepare_power control.
Turn on panel power(drm_panel_prepare_power) and control before dsi
enable. And then dsi enable, send dcs cmd in drm_panel_prepare, last
turn on backlight.

Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 224afb666881..b635724b209b 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -563,10 +563,15 @@  static int mtk_dsi_poweron(struct mtk_dsi *dsi)
 	dsi->data_rate = DIV_ROUND_UP_ULL(pixel_clock * total_bits,
 					  htotal * dsi->lanes);
 
+	if (dsi->panel) {
+		if (drm_panel_prepare_power(dsi->panel))
+			DRM_INFO("can't prepare power the panel\n");
+	}
+
 	ret = clk_set_rate(dsi->hs_clk, dsi->data_rate);
 	if (ret < 0) {
 		dev_err(dev, "Failed to set data rate: %d\n", ret);
-		goto err_refcount;
+		goto err_prepare_power;
 	}
 
 	phy_power_on(dsi->phy);
@@ -605,13 +610,18 @@  static int mtk_dsi_poweron(struct mtk_dsi *dsi)
 	}
 
 	return 0;
+
 err_disable_digital_clk:
 	clk_disable_unprepare(dsi->digital_clk);
 err_disable_engine_clk:
 	clk_disable_unprepare(dsi->engine_clk);
 err_phy_power_off:
 	phy_power_off(dsi->phy);
-err_refcount:
+err_prepare_power:
+	if (dsi->panel) {
+		if (drm_panel_unprepare_power(dsi->panel))
+			DRM_INFO("Can't unprepare power the panel\n");
+	}
 	dsi->refcount--;
 	return ret;
 }
@@ -652,6 +662,11 @@  static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
 	clk_disable_unprepare(dsi->digital_clk);
 
 	phy_power_off(dsi->phy);
+
+	if (dsi->panel) {
+		if (drm_panel_unprepare_power(dsi->panel))
+			DRM_INFO("Can't unprepare power the panel\n");
+	}
 }
 
 static void mtk_output_dsi_enable(struct mtk_dsi *dsi)