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

* Re: [PATCH] drm/msm/dsi: workaround for display enabled by bootloader
       [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>
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Anholt @ 2017-10-17 20:16 UTC (permalink / raw)
  To: Rob Clark, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 678 bytes --]

Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH] drm/msm/dsi: workaround for display enabled by bootloader
       [not found]     ` <874lqxttrl.fsf-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
@ 2017-10-17 20:33       ` Rob Clark
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Clark @ 2017-10-17 20:33 UTC (permalink / raw)
  To: Eric Anholt
  Cc: linux-arm-msm, freedreno, Stephen Boyd,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Tue, Oct 17, 2017 at 4:16 PM, Eric Anholt <eric@anholt.net> wrote:
> Rob Clark <robdclark@gmail.com> writes:
>
>> 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?

+sboyd

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

BR,
-R
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[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.