All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dsi: workaround for display enabled by bootloader
@ 2017-10-17 14:38 Rob Clark
       [not found] ` <20171017143918.12518-1-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2017-10-17 14:38 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, Archit Taneja, Rob Clark, David Airlie, freedreno

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@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-17 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 14:38 [PATCH] drm/msm/dsi: workaround for display enabled by bootloader Rob Clark
     [not found] ` <20171017143918.12518-1-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 20:16   ` Eric Anholt
     [not found]     ` <874lqxttrl.fsf-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2017-10-17 20:33       ` Rob Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.