From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Douglas Anderson <dianders@chromium.org>,
dri-devel@lists.freedesktop.org
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Sankeerth Billakanti <quic_sbillaka@quicinc.com>,
Philip Chen <philipchen@chromium.org>,
Robert Foss <robert.foss@linaro.org>,
Stephen Boyd <swboyd@chromium.org>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
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: [PATCH v3 2/4] drm/panel-edp: Take advantage of wait_hpd_asserted() in struct drm_dp_aux
Date: Thu, 2 Jun 2022 18:12:10 +0300 [thread overview]
Message-ID: <eb66c55c-cecb-0af0-8800-0a9e59d67a9b@linaro.org> (raw)
In-Reply-To: <20220418101725.v3.2.Icea616f57331fbaa3d48c529f300c9a8ebd37fb5@changeid>
On 18/04/2022 20:17, 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>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Change is_hpd_asserted() to wait_hpd_asserted()
>
> drivers/gpu/drm/panel/panel-edp.c | 33 +++++++++++++++++++++----------
> 1 file changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
> index 1732b4f56e38..086e0bf52fb9 100644
> --- a/drivers/gpu/drm/panel/panel-edp.c
> +++ b/drivers/gpu/drm/panel/panel-edp.c
> @@ -417,6 +417,11 @@ 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->wait_hpd_asserted));
> +}
> +
> static int panel_edp_prepare_once(struct panel_edp *p)
> {
> struct device *dev = p->base.dev;
> @@ -441,17 +446,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,
> - hpd_asserted, hpd_asserted,
> - 1000, hpd_wait_us);
> - if (hpd_asserted < 0)
> - err = hpd_asserted;
> + if (p->hpd_gpio) {
> + err = readx_poll_timeout(gpiod_get_value_cansleep,
> + p->hpd_gpio, hpd_asserted,
> + hpd_asserted, 1000, hpd_wait_us);
> + if (hpd_asserted < 0)
> + err = hpd_asserted;
> + } else {
> + err = p->aux->wait_hpd_asserted(p->aux, hpd_wait_us);
> + }
I'm close to thinking that this construct deserves a separate helper.
>
> if (err) {
> if (err != -ETIMEDOUT)
> @@ -532,18 +541,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-06-02 15:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 17:17 [PATCH v3 0/4] drm/dp: Introduce wait_hpd_asserted() for the DP AUX bus Douglas Anderson
2022-04-18 17:17 ` [PATCH v3 1/4] drm/dp: Add wait_hpd_asserted() callback to struct drm_dp_aux Douglas Anderson
2022-05-12 1:58 ` Stephen Boyd
2022-05-12 23:24 ` Doug Anderson
2022-05-20 0:34 ` Stephen Boyd
2022-05-20 15:45 ` Doug Anderson
2022-06-02 10:22 ` Dmitry Baryshkov
2022-04-18 17:17 ` [PATCH v3 2/4] drm/panel-edp: Take advantage of wait_hpd_asserted() in " Douglas Anderson
2022-06-02 15:12 ` Dmitry Baryshkov [this message]
2022-06-14 21:57 ` Doug Anderson
2022-04-18 17:17 ` [PATCH v3 3/4] drm/panel: atna33xc20: " Douglas Anderson
2022-06-02 14:49 ` Dmitry Baryshkov
2022-04-18 17:17 ` [PATCH v3 4/4] drm/bridge: parade-ps8640: Provide " Douglas Anderson
2022-06-02 14:56 ` Dmitry Baryshkov
2022-05-03 23:26 ` [PATCH v3 0/4] drm/dp: Introduce wait_hpd_asserted() for the DP AUX bus 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=eb66c55c-cecb-0af0-8800-0a9e59d67a9b@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
all inboxes | Powered by JetHome®