dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damon Ding" <damon.ding@rock-chips.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 17/18] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge
Date: Tue, 27 Oct 2026 13:53:28 +0000	[thread overview]
Message-ID: <sashiko-outbox-186671@kernel.org> (raw)
In-Reply-To: <20261027132810.1746118-18-damon.ding@rock-chips.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/bridge: analogix_dp: invalid status in analogix_dp_bridge_detect()
--

commit fec557a2a8eaddda095ccdaffc8d84d2a1bbe03a
Author: Damon Ding <damon.ding@rock-chips.com>

drm/bridge: analogix_dp: Handle HPD notification from downstream bridge

This commit adds an hpd_notify_mode to analogix_dp when a downstream bridge
in the chain provides HPD notifications without detection. In this mode, the
driver caches the connection state from the .hpd_notify callback, mutes and
skips initializing native HPD interrupts, and returns connector->status from
analogix_dp_bridge_detect().

Link: https://lore.kernel.org/all/5609825.iZASKD2KPV@diego/

> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 44d431a89ff6f..12c6650da3a46 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c

[ ... ]

> @@ -925,6 +926,9 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne
>  	enum drm_connector_status status = connector_status_disconnected;
>  	int ret;
>  
> +	if (dp->hpd_notify_mode)
> +		return connector->status;

[Severity: Medium]
Can returning connector->status directly from analogix_dp_bridge_detect()
cause regressions before the first HPD notification arrives or when connector
forcing is used via sysfs?

First, drm_connector_init_only() initializes connector->status to
connector_status_unknown. In rockchip_drm_bind() and exynos_drm_bind(),
drm_kms_helper_poll_init() calls display_connector_hpd_enable(), which only
schedules conn->hpd_work asynchronously via schedule_work(&conn->hpd_work)
(and when drm_kms_helper.poll=0 or with bridges like aux-hpd-bridge, no
initial HPD work is scheduled). When drm_client_setup() ->
drm_client_modeset_probe() -> drm_helper_probe_single_connector_modes() (or a
userspace DRM_IOCTL_MODE_GETCONNECTOR call) runs before conn->hpd_work
completes, analogix_dp_bridge_detect() returns connector_status_unknown.

In drivers/gpu/drm/drm_probe_helper.c:drm_helper_probe_single_connector_modes():

	if (connector->status == connector_status_disconnected) {
		...
		goto exit;
	}

	count = drm_helper_probe_get_modes(connector);

	if (count == 0 && (connector->status == connector_status_connected ||
			   connector->status == connector_status_unknown)) {
		count = drm_add_modes_noedid(connector, 1024, 768);

Because the status is connector_status_unknown instead of
connector_status_disconnected, drm_helper_probe_single_connector_modes() adds
fallback no-EDID modes and drm_client attempts to enable the disconnected
display. In analogix_dp_bridge_atomic_enable() -> analogix_dp_set_bridge(),
analogix_dp_detect_hpd() then checks analogix_dp_get_plug_in_status(), where
dp->connection_notified is still false, timing out after 5 retries (~500ms)
and logging an error.

Second, if a user forces the connector state via /sys/class/drm/.../status,
drm_helper_probe_single_connector_modes() sets connector->status to the
forced value without calling .detect_ctx() or .hpd_notify(), leaving
dp->connection_notified out of sync (so forcing "on" still fails in
analogix_dp_get_plug_in_status()). When the user later writes "detect" to
restore normal detection, status_store() clears connector->force while
connector->status still holds the forced state. Then
drm_bridge_connector_detect_ctx() runs:

	if (detect) {
		status = detect->funcs->detect(detect, connector);
		...
		drm_bridge_connector_hpd_notify(connector, status);
	}

Because analogix_dp_bridge_detect() returns the stale forced
connector->status, drm_bridge_connector_hpd_notify() passes that forced
status back into analogix_dp_bridge_notify(), overwriting
dp->connection_notified and leaving the connector stuck in the forced state
until a physical HPD edge occurs.

Would it be better to avoid setting DRM_BRIDGE_OP_DETECT on this bridge when
downstream HPD is used, or have analogix_dp_bridge_detect() return a valid
connected/disconnected status without letting the detect path's
drm_bridge_connector_hpd_notify() call overwrite the state from downstream
HPD notifications?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261027132810.1746118-1-damon.ding@rock-chips.com?part=17

  reply	other threads:[~2026-10-27 13:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261027133735eucas1p217fbce1514e5d83c14e64d8d0b1ae867@eucas1p2.samsung.com>
2026-10-27 13:27 ` [PATCH v5 00/18] Add HPD support for Rockchip Analogix DP Damon Ding
2026-10-27 13:27   ` [PATCH v5 01/18] drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE Damon Ding
2026-10-27 13:27   ` [PATCH v5 02/18] drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data field Damon Ding
2026-10-27 13:27   ` [PATCH v5 03/18] drm/bridge: analogix_dp: Restrict forced connected status to panel endpoints Damon Ding
2026-10-27 13:27   ` [PATCH v5 04/18] drm/bridge: analogix_dp: Return bitmask from analogix_dp_get_irq_type() Damon Ding
2026-10-27 13:27   ` [PATCH v5 05/18] drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq Damon Ding
2026-10-27 13:27   ` [PATCH v5 06/18] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Damon Ding
2026-10-27 13:27   ` [PATCH v5 07/18] drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ bitmask Damon Ding
2026-10-27 13:28   ` [PATCH v5 08/18] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask Damon Ding
2026-10-27 13:28   ` [PATCH v5 09/18] drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt() Damon Ding
2026-10-27 13:28   ` [PATCH v5 10/18] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme Damon Ding
2026-10-27 13:28   ` [PATCH v5 11/18] drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD Damon Ding
2026-10-27 13:28   ` [PATCH v5 12/18] drm/rockchip: analogix_dp: Unbind bridge when connector init fails Damon Ding
2026-10-27 13:28   ` [PATCH v5 13/18] drm/exynos: exynos_dp: " Damon Ding
2026-10-27 13:28   ` [PATCH v5 14/18] drm/bridge: analogix_dp: Move IRQ enable/disable to bind/unbind Damon Ding
2026-10-27 13:53     ` sashiko-bot
2026-10-27 13:28   ` [PATCH v5 15/18] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Damon Ding
2026-10-27 13:28   ` [PATCH v5 16/18] drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug reporting Damon Ding
2026-10-27 13:50     ` sashiko-bot
2026-10-27 13:28   ` [PATCH v5 17/18] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-10-27 13:53     ` sashiko-bot [this message]
2026-10-27 13:28   ` [PATCH v5 18/18] MAINTAINERS: Add entry for Analogix DP controller bridge Damon Ding
2026-10-29  8:29   ` [PATCH v5 00/18] Add HPD support for Rockchip Analogix DP Marek Szyprowski
2026-10-29 10:18     ` Damon Ding

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=sashiko-outbox-186671@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon.ding@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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