From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org Cc: Robert Foss <robert.foss@linaro.org>, Hsin-Yi Wang <hsinyi@chromium.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Abhinav Kumar <quic_abhinavk@quicinc.com>, Sankeerth Billakanti <quic_sbillaka@quicinc.com>, Philip Chen <philipchen@chromium.org>, Stephen Boyd <swboyd@chromium.org>, Douglas Anderson <dianders@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: [RFC PATCH 5/6] drm/panel: atna33xc20: Take advantage of is_hpd_asserted() in struct drm_dp_aux Date: Fri, 8 Apr 2022 19:36:27 -0700 [thread overview] Message-ID: <20220408193536.RFC.5.I9ee239f6b95b944c8fa030f300ad222a7af9899d@changeid> (raw) In-Reply-To: <20220409023628.2104952-1-dianders@chromium.org> Let's add support for being able to read the HPD pin even if it's hooked directly to the controller. This will let us take away the waiting in the AUX transfer functions of the eDP controller drivers. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c index 20666b6217e7..f72bdd7ff7a1 100644 --- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c @@ -30,6 +30,7 @@ struct atana33xc20_panel { struct regulator *supply; struct gpio_desc *el_on3_gpio; + struct drm_dp_aux *aux; struct edid *edid; @@ -76,6 +77,19 @@ static int atana33xc20_suspend(struct device *dev) return 0; } +static bool atana33xc20_can_read_hpd(struct atana33xc20_panel *p) +{ + return !p->no_hpd && (p->hpd_gpio || p->aux->is_hpd_asserted); +} + +static bool panel_edp_read_hpd(struct atana33xc20_panel *p) +{ + if (p->hpd_gpio) + return gpiod_get_value_cansleep(p->hpd_gpio); + + return p->aux->is_hpd_asserted(p->aux); +} + static int atana33xc20_resume(struct device *dev) { struct atana33xc20_panel *p = dev_get_drvdata(dev); @@ -92,17 +106,24 @@ static int atana33xc20_resume(struct device *dev) /* * Handle HPD. Note: if HPD is hooked up to a dedicated pin on the - * eDP controller then "no_hpd" will be false _and_ "hpd_gpio" will be - * NULL. It's up to the controller driver to wait for HPD after - * preparing the panel in that case. + * eDP controller then it's possible that "no_hpd" will be false _and_ + * atana33xc20_can_read_hpd() will return false. It's up to the + * controller driver to wait for HPD after preparing the panel in that + * case. */ if (p->no_hpd) { /* T3 VCC to HPD high is max 200 ms */ msleep(200); - } else if (p->hpd_gpio) { - ret = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio, + } else if (atana33xc20_can_read_hpd(p)) { + /* + * Even though max HPD is 200 ms, we give an extra long timeout + * of 500 ms here. Why? 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. + */ + ret = readx_poll_timeout(panel_edp_read_hpd, p, hpd_asserted, hpd_asserted, - 1000, 200000); + 1000, 500000); if (!hpd_asserted) dev_warn(dev, "Timeout waiting for HPD\n"); } @@ -263,6 +284,8 @@ static int atana33xc20_probe(struct dp_aux_ep_device *aux_ep) return -ENOMEM; dev_set_drvdata(dev, panel); + panel->aux = aux_ep->aux; + panel->supply = devm_regulator_get(dev, "power"); if (IS_ERR(panel->supply)) return dev_err_probe(dev, PTR_ERR(panel->supply), -- 2.35.1.1178.g4f1659d476-goog
WARNING: multiple messages have this Message-ID (diff)
From: Douglas Anderson <dianders@chromium.org> To: dri-devel@lists.freedesktop.org Cc: Douglas Anderson <dianders@chromium.org>, Sankeerth Billakanti <quic_sbillaka@quicinc.com>, Philip Chen <philipchen@chromium.org>, David Airlie <airlied@linux.ie>, linux-kernel@vger.kernel.org, Abhinav Kumar <quic_abhinavk@quicinc.com>, Robert Foss <robert.foss@linaro.org>, Stephen Boyd <swboyd@chromium.org>, Thierry Reding <thierry.reding@gmail.com>, Hsin-Yi Wang <hsinyi@chromium.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Sam Ravnborg <sam@ravnborg.org> Subject: [RFC PATCH 5/6] drm/panel: atna33xc20: Take advantage of is_hpd_asserted() in struct drm_dp_aux Date: Fri, 8 Apr 2022 19:36:27 -0700 [thread overview] Message-ID: <20220408193536.RFC.5.I9ee239f6b95b944c8fa030f300ad222a7af9899d@changeid> (raw) In-Reply-To: <20220409023628.2104952-1-dianders@chromium.org> Let's add support for being able to read the HPD pin even if it's hooked directly to the controller. This will let us take away the waiting in the AUX transfer functions of the eDP controller drivers. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c index 20666b6217e7..f72bdd7ff7a1 100644 --- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c @@ -30,6 +30,7 @@ struct atana33xc20_panel { struct regulator *supply; struct gpio_desc *el_on3_gpio; + struct drm_dp_aux *aux; struct edid *edid; @@ -76,6 +77,19 @@ static int atana33xc20_suspend(struct device *dev) return 0; } +static bool atana33xc20_can_read_hpd(struct atana33xc20_panel *p) +{ + return !p->no_hpd && (p->hpd_gpio || p->aux->is_hpd_asserted); +} + +static bool panel_edp_read_hpd(struct atana33xc20_panel *p) +{ + if (p->hpd_gpio) + return gpiod_get_value_cansleep(p->hpd_gpio); + + return p->aux->is_hpd_asserted(p->aux); +} + static int atana33xc20_resume(struct device *dev) { struct atana33xc20_panel *p = dev_get_drvdata(dev); @@ -92,17 +106,24 @@ static int atana33xc20_resume(struct device *dev) /* * Handle HPD. Note: if HPD is hooked up to a dedicated pin on the - * eDP controller then "no_hpd" will be false _and_ "hpd_gpio" will be - * NULL. It's up to the controller driver to wait for HPD after - * preparing the panel in that case. + * eDP controller then it's possible that "no_hpd" will be false _and_ + * atana33xc20_can_read_hpd() will return false. It's up to the + * controller driver to wait for HPD after preparing the panel in that + * case. */ if (p->no_hpd) { /* T3 VCC to HPD high is max 200 ms */ msleep(200); - } else if (p->hpd_gpio) { - ret = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio, + } else if (atana33xc20_can_read_hpd(p)) { + /* + * Even though max HPD is 200 ms, we give an extra long timeout + * of 500 ms here. Why? 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. + */ + ret = readx_poll_timeout(panel_edp_read_hpd, p, hpd_asserted, hpd_asserted, - 1000, 200000); + 1000, 500000); if (!hpd_asserted) dev_warn(dev, "Timeout waiting for HPD\n"); } @@ -263,6 +284,8 @@ static int atana33xc20_probe(struct dp_aux_ep_device *aux_ep) return -ENOMEM; dev_set_drvdata(dev, panel); + panel->aux = aux_ep->aux; + panel->supply = devm_regulator_get(dev, "power"); if (IS_ERR(panel->supply)) return dev_err_probe(dev, PTR_ERR(panel->supply), -- 2.35.1.1178.g4f1659d476-goog
next prev parent reply other threads:[~2022-04-09 2:37 UTC|newest] Thread overview: 54+ 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 ` 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-09 2:36 ` Douglas Anderson 2022-04-09 5:11 ` kernel test robot 2022-04-11 8:34 ` Jani Nikula 2022-04-11 8:34 ` Jani Nikula 2022-04-11 13:37 ` Doug Anderson 2022-04-11 13:37 ` Doug Anderson 2022-04-14 23:51 ` Stephen Boyd 2022-04-14 23:51 ` Stephen Boyd 2022-04-15 21:13 ` Doug Anderson 2022-04-15 21:13 ` Doug Anderson 2022-04-15 0:46 ` Dmitry Baryshkov 2022-04-15 0:46 ` Dmitry Baryshkov 2022-04-15 21:13 ` Doug Anderson 2022-04-15 21:13 ` Doug Anderson 2022-04-15 22:44 ` Dmitry Baryshkov 2022-04-15 22:44 ` Dmitry Baryshkov 2022-04-16 0:09 ` Doug Anderson 2022-04-16 0:09 ` Doug Anderson 2022-04-16 0:54 ` Dmitry Baryshkov 2022-04-16 0:54 ` Dmitry Baryshkov 2022-04-18 23:10 ` Doug Anderson 2022-04-18 23:10 ` Doug Anderson 2022-05-03 22:45 ` Doug Anderson 2022-05-03 22:45 ` Doug Anderson 2022-05-03 23:23 ` 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 ` Douglas Anderson 2022-04-09 10:27 ` kernel test robot 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-09 2:36 ` Douglas Anderson 2022-04-15 0:48 ` Dmitry Baryshkov 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-09 2:36 ` Douglas Anderson 2022-04-15 0:51 ` Dmitry Baryshkov 2022-04-15 0:51 ` Dmitry Baryshkov 2022-04-15 21:17 ` Doug Anderson 2022-04-15 21:17 ` Doug Anderson 2022-04-15 22:11 ` Dmitry Baryshkov 2022-04-15 22:11 ` Dmitry Baryshkov 2022-04-16 0:12 ` Doug Anderson 2022-04-16 0:12 ` Doug Anderson 2022-04-16 0:14 ` Dmitry Baryshkov 2022-04-16 0:14 ` Dmitry Baryshkov 2022-04-18 17:18 ` Doug Anderson 2022-04-18 17:18 ` Doug Anderson 2022-04-09 2:36 ` Douglas Anderson [this message] 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 2022-04-09 2:36 ` 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=20220408193536.RFC.5.I9ee239f6b95b944c8fa030f300ad222a7af9899d@changeid \ --to=dianders@chromium.org \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dmitry.baryshkov@linaro.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.