Commit 36904adf authored by Thierry Reding's avatar Thierry Reding

drm/tegra: Stop CRTC at CRTC disable time

Previously output drivers would all stop the display controller in their
disable path. However with the transition to atomic modesetting the
display controller needs to be kept running until all planes have been
disabled so that software can properly determine (using VBLANK counts)
when it is safe to remove the framebuffers associated with the planes.

Moving this code into the display controller's disable path also gets
rid of the duplication of this into all output drivers.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 62b9e063
...@@ -940,6 +940,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) ...@@ -940,6 +940,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc)
struct tegra_dc *dc = to_tegra_dc(crtc); struct tegra_dc *dc = to_tegra_dc(crtc);
struct drm_device *drm = crtc->dev; struct drm_device *drm = crtc->dev;
struct drm_plane *plane; struct drm_plane *plane;
u32 value;
drm_for_each_legacy_plane(plane, &drm->mode_config.plane_list) { drm_for_each_legacy_plane(plane, &drm->mode_config.plane_list) {
if (plane->crtc == crtc) { if (plane->crtc == crtc) {
...@@ -953,6 +954,11 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) ...@@ -953,6 +954,11 @@ static void tegra_crtc_disable(struct drm_crtc *crtc)
} }
} }
/* stop the display controller */
value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
value &= ~DISP_CTRL_MODE_MASK;
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
drm_crtc_vblank_off(crtc); drm_crtc_vblank_off(crtc);
tegra_dc_commit(dc); tegra_dc_commit(dc);
} }
......
...@@ -769,10 +769,6 @@ static int tegra_output_dsi_disable(struct tegra_output *output) ...@@ -769,10 +769,6 @@ static int tegra_output_dsi_disable(struct tegra_output *output)
PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); PW4_ENABLE | PM0_ENABLE | PM1_ENABLE);
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL); tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
value &= ~DISP_CTRL_MODE_MASK;
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
value &= ~DSI_ENABLE; value &= ~DSI_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
......
...@@ -1033,10 +1033,6 @@ static int tegra_output_hdmi_disable(struct tegra_output *output) ...@@ -1033,10 +1033,6 @@ static int tegra_output_hdmi_disable(struct tegra_output *output)
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL); tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
*/ */
value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
value &= ~DISP_CTRL_MODE_MASK;
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
value &= ~HDMI_ENABLE; value &= ~HDMI_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
......
...@@ -143,10 +143,6 @@ static int tegra_output_rgb_disable(struct tegra_output *output) ...@@ -143,10 +143,6 @@ static int tegra_output_rgb_disable(struct tegra_output *output)
PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); PW4_ENABLE | PM0_ENABLE | PM1_ENABLE);
tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_POWER_CONTROL); tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_COMMAND);
value &= ~DISP_CTRL_MODE_MASK;
tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_COMMAND);
tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable));
tegra_dc_commit(rgb->dc); tegra_dc_commit(rgb->dc);
......
...@@ -1071,10 +1071,6 @@ static int tegra_output_sor_disable(struct tegra_output *output) ...@@ -1071,10 +1071,6 @@ static int tegra_output_sor_disable(struct tegra_output *output)
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL); tegra_dc_writel(dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
*/ */
value = tegra_dc_readl(dc, DC_CMD_DISPLAY_COMMAND);
value &= ~DISP_CTRL_MODE_MASK;
tegra_dc_writel(dc, value, DC_CMD_DISPLAY_COMMAND);
value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS); value = tegra_dc_readl(dc, DC_DISP_DISP_WIN_OPTIONS);
value &= ~SOR_ENABLE; value &= ~SOR_ENABLE;
tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS); tegra_dc_writel(dc, value, DC_DISP_DISP_WIN_OPTIONS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment