From: Max Krummenacher <max.oss.09@gmail.com>
To: Jayesh Choudhary <j-choudhary@ti.com>
Cc: dianders@chromium.org, andrzej.hajda@intel.com,
neil.armstrong@linaro.org, rfoss@kernel.org,
Laurent.pinchart@ideasonboard.com,
dri-devel@lists.freedesktop.org, tomi.valkeinen@ideasonboard.com,
max.krummenacher@toradex.com, jonas@kwiboo.se,
jernej.skrabec@gmail.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch, kieran.bingham+renesas@ideasonboard.com,
linux-kernel@vger.kernel.org, devarsht@ti.com
Subject: Re: [PATCH v2] drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type
Date: Tue, 13 May 2025 14:52:31 +0200 [thread overview]
Message-ID: <aCNAjz1wt2lPukXv@toolbox> (raw)
In-Reply-To: <20250508115433.449102-1-j-choudhary@ti.com>
Hi
On Thu, May 08, 2025 at 05:24:33PM +0530, Jayesh Choudhary wrote:
> By default, HPD was disabled on SN65DSI86 bridge. When the driver was
> added (commit "a095f15c00e27"), the HPD_DISABLE bit was set in pre-enable
> call which was moved to other function calls subsequently.
> Later on, commit "c312b0df3b13" added detect utility for DP mode. But with
> HPD_DISABLE bit set, all the HPD events are disabled[0] and the debounced
> state always return 1 (always connected state)
>
> Also, with the suspend and resume calls before every register access, the
> bridge starts with disconnected state and the HPD state is reflected
> correctly only after debounce time (400ms). However, adding this delay
> in the detect function causes frame drop and visible glitch in display.
>
> So to get the detect utility working properly for DP mode without any
> performance issues in display, instead of reading HPD state from the
> register, rely on aux communication. Use 'drm_dp_dpcd_read_link_status'
> to find if we have something connected at the sink.
>
> [0]: <https://www.ti.com/lit/gpn/SN65DSI86> (Pg. 32)
>
> Fixes: c312b0df3b13 ("drm/bridge: ti-sn65dsi86: Implement bridge connector operations for DP")
> Cc: Max Krummenacher <max.krummenacher@toradex.com>
> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
> ---
>
> v1 patch link which was sent as RFC:
> <https://patchwork.kernel.org/project/dri-devel/patch/20250424105432.255309-1-j-choudhary@ti.com/>
>
> Changelog v1->v2:
> - Drop additional property in bindings and use conditional.
> - Instead of register read for HPD state, use dpcd read which returns 0
> for success and error codes for no connection
> - Add relevant history for the required change in commit message
> - Drop RFC subject-prefix in v2 as v2 is in better state after discussion
> in v1 and Max's mail thread
> - Add "Cc:" tag
>
> This approach does not make suspend/resume no-op and no additional
> delay needs to be added in the detect hook which causes frame drops.
>
> Here, I am adding conditional to HPD_DISABLE bit even when we are
> not using the register read to get HPD state. This is to prevent
> unnecessary register updates in every resume call.
> (It was adding to latency and leading to ~2-3 frame drop every 10 sec)
>
> Tested and verified on TI's J784S4-EVM platform:
> - Display comes up
> - Detect utility works with a couple of seconds latency.
> But I guess without interrupt support, this is acceptable.
> - No frame-drop observed
>
> Discussion thread for Max's patch:
> <https://patchwork.kernel.org/project/dri-devel/patch/20250501074805.3069311-1-max.oss.09@gmail.com/>
>
> drivers/gpu/drm/bridge/ti-sn65dsi86.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 60224f476e1d..9489e78b6da3 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -352,8 +352,10 @@ static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata,
> * change this to be conditional on someone specifying that HPD should
> * be used.
> */
> - regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE,
> - HPD_DISABLE);
> +
> + if (pdata->bridge.type == DRM_MODE_CONNECTOR_eDP)
> + regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE,
> + HPD_DISABLE);
>
> pdata->comms_enabled = true;
>
> @@ -1194,13 +1196,14 @@ static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge)
> {
> struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge);
> int val = 0;
> + u8 link_status[DP_LINK_STATUS_SIZE];
>
> - pm_runtime_get_sync(pdata->dev);
> - regmap_read(pdata->regmap, SN_HPD_DISABLE_REG, &val);
> - pm_runtime_put_autosuspend(pdata->dev);
> + val = drm_dp_dpcd_read_link_status(&pdata->aux, link_status);
>
> - return val & HPD_DEBOUNCED_STATE ? connector_status_connected
> - : connector_status_disconnected;
> + if (val < 0)
> + return connector_status_disconnected;
> + else
> + return connector_status_connected;
> }
>
> static const struct drm_edid *ti_sn_bridge_edid_read(struct drm_bridge *bridge,
> --
> 2.34.1
>
This fixes the issues I have with detecting a not connected monitor on
boot.
As my HW has enable under software control but the power supplies not there
seem to be an issue to properly bring up the bridge after a disconnect and
then reconnect. I can work around that in the device tree by not adding the
optional enable gpio.
As such on a HW with a DP connector and a DP monitor:
Tested-by: Max Krummenacher <max.krummenacher@toradex.com>
next prev parent reply other threads:[~2025-05-13 12:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 11:54 [PATCH v2] drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type Jayesh Choudhary
2025-05-13 12:52 ` Max Krummenacher [this message]
2025-05-22 1:10 ` Doug Anderson
2025-05-22 13:14 ` Dmitry Baryshkov
2025-05-26 7:43 ` Jayesh Choudhary
2025-05-27 15:40 ` Doug Anderson
2025-05-26 8:41 ` Ernest Van Hoecke
2025-05-27 15:44 ` Doug Anderson
2025-05-28 12:18 ` Jayesh Choudhary
2025-05-28 12:41 ` Ernest Van Hoecke
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=aCNAjz1wt2lPukXv@toolbox \
--to=max.oss.09@gmail.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=devarsht@ti.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=j-choudhary@ti.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=max.krummenacher@toradex.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.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).