From: xubilv Date: Fri, 14 Jul 2017 08:27:15 +0000 (+0800) Subject: drm/rockchip: dw-mipi-dsi: organize dw_mipi_dsi_encoder_disable function X-Git-Tag: release-20171130_firefly~4^2~142 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=83ae1328aff164ed5aa14e9113aa0a54d98bd42b;p=firefly-linux-kernel-4.4.55.git drm/rockchip: dw-mipi-dsi: organize dw_mipi_dsi_encoder_disable function Change-Id: I4c5ba54748bd1965a9f2cdea924efa6d449677a1 Signed-off-by: xubilv --- diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 70d194a208e3..14d3026b1489 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -719,12 +719,6 @@ static void dw_mipi_dsi_set_mode(struct dw_mipi_dsi *dsi, } } -static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi) -{ - dsi_write(dsi, DSI_PWR_UP, RESET); - dsi_write(dsi, DSI_PHY_RSTZ, PHY_RSTZ); -} - static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi) { dsi_write(dsi, DSI_PWR_UP, RESET); @@ -868,34 +862,46 @@ static void dw_mipi_dsi_encoder_mode_set(struct drm_encoder *encoder, drm_mode_copy(&dsi->mode, adjusted_mode); } -static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) +static void rockchip_dsi_pre_disable(struct dw_mipi_dsi *dsi) { - struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder); - - drm_panel_disable(dsi->panel); - if (clk_prepare_enable(dsi->pclk)) { dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__); return; } dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE); - drm_panel_unprepare(dsi->panel); - dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE); +} - /* - * This is necessary to make sure the peripheral will be driven - * normally when the display is enabled again later. - */ - msleep(120); +static void rockchip_dsi_disable(struct dw_mipi_dsi *dsi) +{ + /* host */ + dsi_write(dsi, DSI_LPCLK_CTRL, 0); + dsi_write(dsi, DSI_PWR_UP, RESET); + + /* phy */ + dsi_write(dsi, DSI_PHY_RSTZ, PHY_RSTZ); + if (dsi->phy) + phy_power_off(dsi->phy); - dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE); - dw_mipi_dsi_disable(dsi); - phy_power_off(dsi->phy); pm_runtime_put(dsi->dev); clk_disable_unprepare(dsi->pclk); } +static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder) +{ + struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder); + + if (dsi->panel) + drm_panel_disable(dsi->panel); + + rockchip_dsi_pre_disable(dsi); + + if (dsi->panel) + drm_panel_unprepare(dsi->panel); + + rockchip_dsi_disable(dsi); +} + static bool dw_mipi_dsi_encoder_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode)