From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Douglas Anderson <dianders@chromium.org>,
dri-devel@lists.freedesktop.org
Cc: Robert Foss <robert.foss@linaro.org>,
Hsin-Yi Wang <hsinyi@chromium.org>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Sankeerth Billakanti <quic_sbillaka@quicinc.com>,
Philip Chen <philipchen@chromium.org>,
Stephen Boyd <swboyd@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
Sam Ravnborg <sam@ravnborg.org>,
Thierry Reding <thierry.reding@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 4/6] drm/panel-edp: Take advantage of is_hpd_asserted() in struct drm_dp_aux
Date: Fri, 15 Apr 2022 03:51:00 +0300 [thread overview]
Message-ID: <027b3ca1-fbd3-7bce-1ca0-ec92a5f23fee@linaro.org> (raw)
In-Reply-To: <20220408193536.RFC.4.Icea616f57331fbaa3d48c529f300c9a8ebd37fb5@changeid>
On 09/04/2022 05:36, Douglas Anderson wrote:
> Let's add support for being able to read the HPD pin even if it's
> hooked directly to the controller. This will allow us to get more
> accurate delays also lets us take away the waiting in the AUX transfer
> functions of the eDP controller drivers.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
> drivers/gpu/drm/panel/panel-edp.c | 37 ++++++++++++++++++++++++++-----
> 1 file changed, 31 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
> index 1732b4f56e38..4a143eb9544b 100644
> --- a/drivers/gpu/drm/panel/panel-edp.c
> +++ b/drivers/gpu/drm/panel/panel-edp.c
> @@ -417,6 +417,19 @@ static int panel_edp_get_hpd_gpio(struct device *dev, struct panel_edp *p)
> return 0;
> }
>
> +static bool panel_edp_can_read_hpd(struct panel_edp *p)
> +{
> + return !p->no_hpd && (p->hpd_gpio || (p->aux && p->aux->is_hpd_asserted));
> +}
> +
> +static bool panel_edp_read_hpd(struct panel_edp *p)
> +{
> + if (p->hpd_gpio)
> + return gpiod_get_value_cansleep(p->hpd_gpio);
> +
> + return p->aux->is_hpd_asserted(p->aux);
> +}
> +
> static int panel_edp_prepare_once(struct panel_edp *p)
> {
> struct device *dev = p->base.dev;
> @@ -441,13 +454,21 @@ static int panel_edp_prepare_once(struct panel_edp *p)
> if (delay)
> msleep(delay);
>
> - if (p->hpd_gpio) {
> + if (panel_edp_can_read_hpd(p)) {
> if (p->desc->delay.hpd_absent)
> hpd_wait_us = p->desc->delay.hpd_absent * 1000UL;
> else
> hpd_wait_us = 2000000;
>
> - err = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio,
> + /*
> + * Extra max delay, mostly to account for ps8640. ps8640
> + * is crazy and the bridge chip driver itself has over 200 ms
> + * of delay if it needs to do the pm_runtime resume of the
> + * bridge chip to read the HPD.
> + */
> + hpd_wait_us += 3000000;
I think this should come in a separate commit and ideally this should be
configurable somehow. Other hosts wouldn't need such 'additional' delay.
With this change removed:
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> +
> + err = readx_poll_timeout(panel_edp_read_hpd, p,
> hpd_asserted, hpd_asserted,
> 1000, hpd_wait_us);
> if (hpd_asserted < 0)
> @@ -532,18 +553,22 @@ static int panel_edp_enable(struct drm_panel *panel)
> /*
> * 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.
> + * However, we can only count this if HPD is readable by the panel
> + * driver.
> + *
> * 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).
> + * called (and link training took zero time). Note that "no-hpd"
> + * actually counts as handling HPD ourselves since we're doing the
> + * worst case delay (in prepare) ourselves.
> *
> * 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)
> + if (p->desc->delay.prepare_to_enable &&
> + !panel_edp_can_read_hpd(p) && !p->no_hpd)
> delay = max(delay, p->desc->delay.prepare_to_enable);
>
> if (delay)
--
With best wishes
Dmitry
next prev parent reply other threads:[~2022-04-15 0:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-09 2:36 [RFC PATCH 0/6] drm/dp: Improvements for DP AUX channel Douglas Anderson
2022-04-09 2:36 ` [RFC PATCH 1/6] drm/dp: Helpers to make it easier for drivers to use DP AUX bus properly Douglas Anderson
2022-04-11 8:34 ` Jani Nikula
2022-04-11 13:37 ` Doug Anderson
2022-04-14 23:51 ` Stephen Boyd
2022-04-15 21:13 ` Doug Anderson
2022-04-15 0:46 ` Dmitry Baryshkov
2022-04-15 21:13 ` Doug Anderson
2022-04-15 22:44 ` Dmitry Baryshkov
2022-04-16 0:09 ` Doug Anderson
2022-04-16 0:54 ` Dmitry Baryshkov
2022-04-18 23:10 ` Doug Anderson
2022-05-03 22:45 ` Doug Anderson
2022-05-03 23:23 ` Doug Anderson
2022-04-09 2:36 ` [RFC PATCH 2/6] drm/bridge: parade-ps8640: Break probe in two to handle DP AUX better Douglas Anderson
2022-04-09 2:36 ` [RFC PATCH 3/6] drm/dp: Add is_hpd_asserted() callback to struct drm_dp_aux Douglas Anderson
2022-04-15 0:48 ` Dmitry Baryshkov
2022-04-09 2:36 ` [RFC PATCH 4/6] drm/panel-edp: Take advantage of is_hpd_asserted() in " Douglas Anderson
2022-04-15 0:51 ` Dmitry Baryshkov [this message]
2022-04-15 21:17 ` Doug Anderson
2022-04-15 22:11 ` Dmitry Baryshkov
2022-04-16 0:12 ` Doug Anderson
2022-04-16 0:14 ` Dmitry Baryshkov
2022-04-18 17:18 ` Doug Anderson
2022-04-09 2:36 ` [RFC PATCH 5/6] drm/panel: atna33xc20: " Douglas Anderson
2022-04-09 2:36 ` [RFC PATCH 6/6] drm/bridge: parade-ps8640: Provide " Douglas 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=027b3ca1-fbd3-7bce-1ca0-ec92a5f23fee@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hsinyi@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philipchen@chromium.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_sbillaka@quicinc.com \
--cc=robert.foss@linaro.org \
--cc=sam@ravnborg.org \
--cc=swboyd@chromium.org \
--cc=thierry.reding@gmail.com \
/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).