Skip to contentSkip to conversation

drm/msm/dsi: workaround for display enabled by bootloader

PATCH In review Rob Clark 3 participants 3 messages Oct 17, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

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

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.

---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/gpu/drm/msm/dsi/dsi_host.c +34 -0
index 0f7324a686ca..589818d027e4 100644
@@ -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;
 }
Signature · 1 line
2.13.6

A message that is not in the archive (sent off-list or not yet received): 20171017143918.12518-1-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 8 lines · Rob Clark

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.

Hmm. Couldn't the clk_set_rate() just turn off the clock and then make the rate change when there are no refs on the clk currently?

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · Eric Anholt
Quoted 5 lines · Rob Clark

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.

Quoted 6 lines
Quoted 3 lines

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.

Hmm. Couldn't the clk_set_rate() just turn off the clock and then make the rate change when there are no refs on the clk currently?

+sboyd

I *assume* the reasoning is something about parent clocks?

BR,
-R
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno