All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
	linux-kernel@vger.kernel.org,
	Neil Armstrong <narmstrong@baylibre.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Robert Foss <robert.foss@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: [RFC PATCH 6/6] drm/bridge: parade-ps8640: Provide is_hpd_asserted() in struct drm_dp_aux
Date: Fri,  8 Apr 2022 19:36:28 -0700	[thread overview]
Message-ID: <20220408193536.RFC.6.Ie827321ce263be52fdb8c1276f6f8cc00d78029f@changeid> (raw)
In-Reply-To: <20220409023628.2104952-1-dianders@chromium.org>

This implements the callback added by the patch ("drm/dp: Add
is_hpd_asserted() callback to struct drm_dp_aux").

With this change and all the two "DP AUX Endpoint" drivers changed to
use is_hpd_asserted(), we no longer need to have an long delay in the
AUX transfer function. It's up to the panel code to make sure that the
panel is powered now. If someone tried to call the aux transfer
function without making sure the panel is powered we'll just get a
normal transfer failure.

We'll still keep the "ensure" for HPD in the pre_enable()
function. Though it's probably not actually needed there, this driver
is used in the old mode (pre-DP AUX Endpoints) and it may be important
for those cases. If nothing else, it shouldn't cause any big problems.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/parade-ps8640.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
index 96e883985608..13c3cb5d34f3 100644
--- a/drivers/gpu/drm/bridge/parade-ps8640.c
+++ b/drivers/gpu/drm/bridge/parade-ps8640.c
@@ -190,6 +190,22 @@ static int ps8640_ensure_hpd(struct ps8640 *ps_bridge)
 	return ret;
 }
 
+static bool ps8640_is_hpd_asserted(struct drm_dp_aux *aux)
+{
+	struct ps8640 *ps_bridge = aux_to_ps8640(aux);
+	struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL];
+	struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev;
+	unsigned int status = 0;
+
+	pm_runtime_get_sync(dev);
+	regmap_read(map, PAGE2_GPIO_H, &status);
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_put_autosuspend(dev);
+
+	/* GPIO9 signals HPD. See ps8640_ensure_hpd() */
+	return status & PS_GPIO9;
+}
+
 static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
 				       struct drm_dp_aux_msg *msg)
 {
@@ -324,9 +340,7 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
 	int ret;
 
 	pm_runtime_get_sync(dev);
-	ret = ps8640_ensure_hpd(ps_bridge);
-	if (!ret)
-		ret = ps8640_aux_transfer_msg(aux, msg);
+	ret = ps8640_aux_transfer_msg(aux, msg);
 	pm_runtime_mark_last_busy(dev);
 	pm_runtime_put_autosuspend(dev);
 
@@ -679,6 +693,7 @@ static int ps8640_probe(struct i2c_client *client)
 	ps_bridge->aux.name = "parade-ps8640-aux";
 	ps_bridge->aux.dev = dev;
 	ps_bridge->aux.transfer = ps8640_aux_transfer;
+	ps_bridge->aux.is_hpd_asserted = ps8640_is_hpd_asserted;
 	drm_dp_aux_init(&ps_bridge->aux);
 
 	pm_runtime_enable(dev);
-- 
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: 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>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 6/6] drm/bridge: parade-ps8640: Provide is_hpd_asserted() in struct drm_dp_aux
Date: Fri,  8 Apr 2022 19:36:28 -0700	[thread overview]
Message-ID: <20220408193536.RFC.6.Ie827321ce263be52fdb8c1276f6f8cc00d78029f@changeid> (raw)
In-Reply-To: <20220409023628.2104952-1-dianders@chromium.org>

This implements the callback added by the patch ("drm/dp: Add
is_hpd_asserted() callback to struct drm_dp_aux").

With this change and all the two "DP AUX Endpoint" drivers changed to
use is_hpd_asserted(), we no longer need to have an long delay in the
AUX transfer function. It's up to the panel code to make sure that the
panel is powered now. If someone tried to call the aux transfer
function without making sure the panel is powered we'll just get a
normal transfer failure.

We'll still keep the "ensure" for HPD in the pre_enable()
function. Though it's probably not actually needed there, this driver
is used in the old mode (pre-DP AUX Endpoints) and it may be important
for those cases. If nothing else, it shouldn't cause any big problems.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/bridge/parade-ps8640.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c
index 96e883985608..13c3cb5d34f3 100644
--- a/drivers/gpu/drm/bridge/parade-ps8640.c
+++ b/drivers/gpu/drm/bridge/parade-ps8640.c
@@ -190,6 +190,22 @@ static int ps8640_ensure_hpd(struct ps8640 *ps_bridge)
 	return ret;
 }
 
+static bool ps8640_is_hpd_asserted(struct drm_dp_aux *aux)
+{
+	struct ps8640 *ps_bridge = aux_to_ps8640(aux);
+	struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL];
+	struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev;
+	unsigned int status = 0;
+
+	pm_runtime_get_sync(dev);
+	regmap_read(map, PAGE2_GPIO_H, &status);
+	pm_runtime_mark_last_busy(dev);
+	pm_runtime_put_autosuspend(dev);
+
+	/* GPIO9 signals HPD. See ps8640_ensure_hpd() */
+	return status & PS_GPIO9;
+}
+
 static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
 				       struct drm_dp_aux_msg *msg)
 {
@@ -324,9 +340,7 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
 	int ret;
 
 	pm_runtime_get_sync(dev);
-	ret = ps8640_ensure_hpd(ps_bridge);
-	if (!ret)
-		ret = ps8640_aux_transfer_msg(aux, msg);
+	ret = ps8640_aux_transfer_msg(aux, msg);
 	pm_runtime_mark_last_busy(dev);
 	pm_runtime_put_autosuspend(dev);
 
@@ -679,6 +693,7 @@ static int ps8640_probe(struct i2c_client *client)
 	ps_bridge->aux.name = "parade-ps8640-aux";
 	ps_bridge->aux.dev = dev;
 	ps_bridge->aux.transfer = ps8640_aux_transfer;
+	ps_bridge->aux.is_hpd_asserted = ps8640_is_hpd_asserted;
 	drm_dp_aux_init(&ps_bridge->aux);
 
 	pm_runtime_enable(dev);
-- 
2.35.1.1178.g4f1659d476-goog


  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 ` [RFC PATCH 5/6] drm/panel: atna33xc20: " Douglas Anderson
2022-04-09  2:36   ` Douglas Anderson
2022-04-09  2:36 ` Douglas Anderson [this message]
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=20220408193536.RFC.6.Ie827321ce263be52fdb8c1276f6f8cc00d78029f@changeid \
    --to=dianders@chromium.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.hajda@intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hsinyi@chromium.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=philipchen@chromium.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=robert.foss@linaro.org \
    --cc=swboyd@chromium.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 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.