linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: Thierry Reding <thierry.reding@gmail.com>,
	Rob Herring <robh+dt@kernel.org>, Sam Ravnborg <sam@ravnborg.org>
Cc: devicetree@vger.kernel.org, Steev Klimaszewski <steev@kali.org>,
	dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Linus W <linus.walleij@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Maxime Ripard <mripard@kernel.org>,
	Douglas Anderson <dianders@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 13/15] drm/panel-edp: Fix "prepare_to_enable" if panel doesn't handle HPD
Date: Tue, 14 Sep 2021 13:22:00 -0700	[thread overview]
Message-ID: <20210914132020.v5.13.Ia8288d36df4b12770af59ae3ff73ef7e08fb4e2e@changeid> (raw)
In-Reply-To: <20210914202202.1702601-1-dianders@chromium.org>

While cleaning up the descriptions of the delay for eDP panels I
realized that we'd have a bug if any panels need the
"prepare_to_enable" but HPD handling isn't happening in the panel
driver. Let's put in a stopgap to at least make us not violate
timings. This is not perfectly optimal but trying to do better is
hard. At the moment only 2 panels specify this delay and only 30 ms is
at stake. These panels are also currently hooked up with "hpd-gpios"
so effectively this "fix" is just a theoretical fix and won't actually
do anything for any devices currently supported in mainline.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---

(no changes since v4)

Changes in v4:
- panel-simple-edp => panel-edp

Changes in v3:
- Fix "prepare_to_enable" patch new for v3.

 drivers/gpu/drm/panel/panel-edp.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index 80a37a4e5750..a83ef9905ea7 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -508,12 +508,32 @@ static int panel_edp_prepare(struct drm_panel *panel)
 static int panel_edp_enable(struct drm_panel *panel)
 {
 	struct panel_edp *p = to_panel_edp(panel);
+	unsigned int delay;
 
 	if (p->enabled)
 		return 0;
 
-	if (p->desc->delay.enable)
-		msleep(p->desc->delay.enable);
+	delay = p->desc->delay.enable;
+
+	/*
+	 * If there is a "prepare_to_enable" delay then that's supposed to be
+	 * the delay from HPD going high until we can turn the backlight on.
+	 * However, we can only count this if HPD is handled by the panel
+	 * driver, not if it goes to a dedicated pin on the controller.
+	 * If we aren't handling the HPD pin ourselves then the best we
+	 * can do is assume that HPD went high immediately before we were
+	 * called (and link training took zero time).
+	 *
+	 * NOTE: if we ever end up in this "if" statement then we're
+	 * guaranteed that the panel_edp_wait() call below will do no delay.
+	 * It already handles that case, though, so we don't need any special
+	 * code for it.
+	 */
+	if (p->desc->delay.prepare_to_enable && !p->hpd_gpio && !p->no_hpd)
+		delay = max(delay, p->desc->delay.prepare_to_enable);
+
+	if (delay)
+		msleep(delay);
 
 	panel_edp_wait(p->prepared_time, p->desc->delay.prepare_to_enable);
 
-- 
2.33.0.309.g3052b89438-goog


  parent reply	other threads:[~2021-09-14 20:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 20:21 [PATCH v5 00/15] eDP: Support probing eDP panels dynamically instead of hardcoding Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 01/15] dt-bindings: drm/panel-simple-edp: Introduce generic eDP panels Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 02/15] drm/edid: Break out reading block 0 of the EDID Douglas Anderson
2021-10-04 15:42   ` Geert Uytterhoeven
2021-10-04 16:26     ` Doug Anderson
2021-10-04 17:13       ` Geert Uytterhoeven
2021-09-14 20:21 ` [PATCH v5 03/15] drm/edid: Allow querying/working with the panel ID from " Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 04/15] drm/edid: Use new encoded panel id style for quirks matching Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 05/15] ARM: configs: Everyone who had PANEL_SIMPLE now gets PANEL_EDP Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 06/15] arm64: defconfig: " Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 07/15] drm/panel-edp: Split eDP panels out of panel-simple Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 08/15] drm/panel-edp: Move some wayward panels to the eDP driver Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 09/15] drm/panel-simple: Non-eDP panels don't need "HPD" handling Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 10/15] drm/panel-edp: Split the delay structure out Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 11/15] drm/panel-edp: Better describe eDP panel delays Douglas Anderson
2021-09-14 20:21 ` [PATCH v5 12/15] drm/panel-edp: hpd_reliable shouldn't be subtraced from hpd_absent Douglas Anderson
2021-09-14 20:22 ` Douglas Anderson [this message]
2021-09-14 20:22 ` [PATCH v5 14/15] drm/panel-edp: Don't re-read the EDID every time we power off the panel Douglas Anderson
2021-09-14 20:22 ` [PATCH v5 15/15] drm/panel-edp: Implement generic "edp-panel"s probed by EDID Douglas Anderson
2021-09-14 22:12 ` [PATCH v5 00/15] eDP: Support probing eDP panels dynamically instead of hardcoding Linus Walleij
2021-09-20 16:42   ` Doug Anderson
2021-09-24  8:03     ` Jani Nikula
2021-09-24  9:10       ` Andrzej Hajda
2021-09-24 13:59         ` Doug Anderson
2021-09-24 14:55           ` Doug Anderson

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=20210914132020.v5.13.Ia8288d36df4b12770af59ae3ff73ef7e08fb4e2e@changeid \
    --to=dianders@chromium.org \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=steev@kali.org \
    --cc=thierry.reding@gmail.com \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).