Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org,
	Archit Taneja <architt@codeaurora.org>,
	Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
	freedreno@lists.freedesktop.org
Subject: [PATCH] drm/msm/dsi: workaround for display enabled by bootloader
Date: Tue, 17 Oct 2017 10:38:45 -0400	[thread overview]
Message-ID: <20171017143918.12518-1-robdclark@gmail.com> (raw)

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

             reply	other threads:[~2017-10-17 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 14:38 Rob Clark [this message]
     [not found] ` <20171017143918.12518-1-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 20:16   ` [PATCH] drm/msm/dsi: workaround for display enabled by bootloader Eric Anholt
     [not found]     ` <874lqxttrl.fsf-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
2017-10-17 20:33       ` Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171017143918.12518-1-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox