[PATCH] drm/msm/dsi: workaround for display enabled by bootloader

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bootloader enabled display, when the driver is built-in (rather than a
module loaded after CCF/genpd disable "unused" clocks/powerdomains)
causes problems since the driver thinks the clocks are off, but in fact
they are on.  This causes (for example) clk_set_rate() to fail.

A better solution would be to support display handover from bootloader,
but that will require some CCF+genpd changes before that is possible.
So until then, we need this workaround.

Signed-off-by: Rob Clark <robdclark@xxxxxxxxx>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 0f7324a686ca..589818d027e4 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -418,6 +418,40 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
 				__func__, ret);
 		}
 	}
+
+	/*
+	 * If the bootloader enables the display, and the driver is
+	 * built-in (as opposed to module, loaded after clk/genpd
+	 * framework disables "unused" clocks and power domains, we
+	 * would already have clocks enabled.  But kms thinks that
+	 * everything is disabled.  This causes problems, for ex,
+	 * when trying to clk_set_rate() on bootloader enabled
+	 * clocks.
+	 *
+	 * Work around this for now, until we have a better solution
+	 * in place, by doing an extra enable/disable.  This forces
+	 * things to a disabled state.
+	 */
+	if (cfg_hnd->major == MSM_DSI_VER_MAJOR_6G) {
+		clk_prepare_enable(msm_host->byte_clk);
+		clk_prepare_enable(msm_host->pixel_clk);
+		clk_prepare_enable(msm_host->esc_clk);
+
+		clk_disable_unprepare(msm_host->esc_clk);
+		clk_disable_unprepare(msm_host->pixel_clk);
+		clk_disable_unprepare(msm_host->byte_clk);
+	} else {
+		clk_prepare_enable(msm_host->byte_clk);
+		clk_prepare_enable(msm_host->esc_clk);
+		clk_prepare_enable(msm_host->src_clk);
+		clk_prepare_enable(msm_host->pixel_clk);
+
+		clk_disable_unprepare(msm_host->pixel_clk);
+		clk_disable_unprepare(msm_host->src_clk);
+		clk_disable_unprepare(msm_host->esc_clk);
+		clk_disable_unprepare(msm_host->byte_clk);
+	}
+
 exit:
 	return ret;
 }
-- 
2.13.6

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux