Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yashas D" <y-d@ti.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 2/2] drm: bridge: cdns-mhdp8546: Add no-hpd property
Date: Fri, 09 Oct 2026 06:54:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-164969@kernel.org> (raw)
In-Reply-To: <20261009064024.985688-3-y-d@ti.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/bridge: cdns-mhdp8546: no-hpd property inadvertently disables all SW event interrupts
- [Medium] drm/bridge: cdns-mhdp8546: .detect polling forces link training when disabled
--

commit 74d172bfd85fd1324471808ee819e4a124d26946
Author: Rahul T R <r-ravikumar@ti.com>
Subject: drm: bridge: cdns-mhdp8546: Add no-hpd property

Adds a no-hpd boolean property for boards where the hardware HPD line is
unavailable. When set, the driver uses DPCD AUX reads to poll monitor
presence via the .detect() callback instead of relying on HPD interrupts.

> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> index f47717bd10798..b02147a725a2d 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
[ ... ]
> @@ -698,7 +700,9 @@ static int cdns_mhdp_fw_activate(const struct firmware *fw,
>  	 * MHDP_HW_STOPPED happens only due to driver removal when
>  	 * bridge should already be detached.
>  	 */
> -	cdns_mhdp_bridge_hpd_enable(&mhdp->bridge);
> +
> +	if (!mhdp->no_hpd)
> +		cdns_mhdp_bridge_hpd_enable(&mhdp->bridge);

[Severity: High]
When no-hpd is set, cdns_mhdp_bridge_hpd_enable() is bypassed here.

Looking at cdns_mhdp_bridge_hpd_enable(), it unmasks all SW events, not just
HPD:

static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge)
{
        ...
        if (mhdp->bridge_attached)
                writel(readl(mhdp->regs + CDNS_APB_INT_MASK) &
                       ~CDNS_APB_INT_MASK_SW_EVENT_INT,
                       mhdp->regs + CDNS_APB_INT_MASK);
}

Since this bit controls all software event notifications from the firmware,
won't bypassing this cause features like HDCP to unconditionally time out when
they wait for SW events?

>  
>  	spin_unlock(&mhdp->start_lock);
>  
[ ... ]
> @@ -1523,6 +1532,19 @@ static int cdns_mhdp_attach(struct drm_bridge *bridge,
>  
>  	spin_unlock(&mhdp->start_lock);
>  
> +	if (mhdp->no_hpd) {
> +		/*
> +		 * In no-hpd mode there are no HPD interrupts to trigger
> +		 * detection. If firmware is already ready, do the initial
> +		 * AUX poll immediately. Otherwise fw_cb() will call
> +		 * cdns_mhdp_update_link_status() once firmware finishes
> +		 * loading and sees bridge_attached is true.
> +		 */
> +		if (hw_ready)
> +			cdns_mhdp_update_link_status(mhdp);
> +		return 0;
> +	}

[Severity: High]
This early return also bypasses the SW event interrupt unmasking during bridge
attach. Should CDNS_APB_INT_MASK_SW_EVENT_INT be unmasked independently of the
HPD configuration?

> +
>  	/* Enable SW event interrupts */
>  	if (hw_ready)
>  		cdns_mhdp_bridge_hpd_enable(bridge);
[ ... ]
> @@ -2100,7 +2132,29 @@ static int cdns_mhdp_update_link_status(struct cdns_mhdp_device *mhdp)
>  
>  	mutex_lock(&mhdp->link_mutex);
>  
> -	mhdp->plugged = cdns_mhdp_detect_hpd(mhdp, &hpd_pulse);
> +	if (mhdp->no_hpd) {
> +		u8 rev;
> +
> +		/*
> +		 * Use a side-effect-free capability register for presence
> +		 * detection. A successful AUX read means a sink is present;
> +		 * we do not need link training status registers here.
> +		 */
> +		ret = drm_dp_dpcd_read(&mhdp->aux, DP_DPCD_REV, &rev, 1);
> +		mhdp->plugged = (ret == 1);
> +		ret = mhdp->plugged ? 0 : -EIO;
> +		hpd_pulse = false;
> +
> +		/*
> +		 * If the monitor is still connected and the link is already
> +		 * up, there is nothing to do. Avoid falling through to
> +		 * cdns_mhdp_sst_enable() on every poll cycle.
> +		 */
> +		if (mhdp->plugged && old_plugged && mhdp->link_up)
> +			goto out;

[Severity: Medium]
During DPMS off or atomic_disable, the driver correctly powers down the link
and sets mhdp->link_up to false. 

When the 10-second polling calls .detect() while the bridge is disabled,
mhdp->link_up will be false. The short-circuit condition here evaluates to
false, causing the code to fall through to:

	if (!mhdp->link_up) {
		ret = cdns_mhdp_link_up(mhdp);
		if (ret < 0)
			goto out;
	}

Will this unconditionally perform full hardware link training and issue
DP_SET_POWER_D0 on every poll cycle, defeating power management while the
bridge is logically disabled?

> +	} else {
> +		mhdp->plugged = cdns_mhdp_detect_hpd(mhdp, &hpd_pulse);
> +	}
>  
>  	if (!mhdp->plugged) {
>  		cdns_mhdp_link_down(mhdp);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009064024.985688-1-y-d@ti.com?part=2

      reply	other threads:[~2026-10-09  6:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  6:40 [PATCH v7 0/2] Add no-hpd property to the cadence bridge Yashas D
2026-10-09  6:40 ` [PATCH v7 1/2] dt-bindings: display: bridge: cdns,mhdp8546: " Yashas D
2026-10-09  6:40 ` [PATCH v7 2/2] drm: bridge: cdns-mhdp8546: Add no-hpd property Yashas D
2026-10-09  6:54   ` sashiko-bot [this message]

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-164969@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=y-d@ti.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