dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Robert Ijtsma" <robertijtsma@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/msm/dp: clear AUX_TRANS_CTRL on reset and enable HPD_REFTIMER
Date: Thu, 26 Nov 2026 14:39:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-235735@kernel.org> (raw)
In-Reply-To: <20261126-drm-msm-dp-aux-resume-v2-1-3324420b6770@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/msm/dp: unreachable is_edp fallback in
  msm_dp_aux_should_reset()
- [Medium] drm/msm/dp: msm_dp_aux_transfer() skips phy_calibrate() on
  DP_AUX_ERR_TOUT
--

commit c2e9bc4891741d368936607a2c4a882af3e31c41
Author: Robert Ijtsma <robertijtsma@gmail.com>

drm/msm/dp: clear AUX_TRANS_CTRL on reset and enable HPD_REFTIMER

This commit clears REG_DP_AUX_TRANS_CTRL during AUX reset, manages
DP_DP_HPD_REFTIMER_ENABLE across msm_dp_aux_enable() and
msm_dp_aux_disable(), and resets the AUX controller on transfer errors and
DP_AUX_ERR_TOUT timeouts even when internal HPD is disabled.

> diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c
> index b52393dcc0670..9a996fe7dbddb 100644
> --- a/drivers/gpu/drm/msm/dp/dp_aux.c
> +++ b/drivers/gpu/drm/msm/dp/dp_aux.c

[ ... ]

> @@ -101,11 +108,23 @@ static void msm_dp_aux_enable(struct msm_dp_aux_private *aux)
>  
>  static void msm_dp_aux_disable(struct msm_dp_aux_private *aux)
>  {
> -	u32 aux_ctrl;
> +	u32 aux_ctrl, reftimer;
>  
>  	aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL);
>  	aux_ctrl &= ~DP_AUX_CTRL_ENABLE;
>  	msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl);
> +
> +	reftimer = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER);
> +	reftimer &= ~DP_DP_HPD_REFTIMER_ENABLE;
> +	msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reftimer);
> +}
> +
> +static bool msm_dp_aux_should_reset(struct msm_dp_aux_private *aux)
> +{
> +	if (msm_dp_read_aux(aux, REG_DP_DP_HPD_CTRL) & DP_DP_HPD_CTRL_HPD_EN)
> +		return msm_dp_aux_is_link_connected(&aux->msm_dp_aux);
> +
> +	return aux->is_edp || aux->enable_xfers;
>  }

[Severity: Medium]
Can aux->is_edp ever be reached in msm_dp_aux_should_reset()?

For eDP instances, msm_dp_pm_runtime_resume() unconditionally calls
msm_dp_aux_hpd_enable(), which sets DP_DP_HPD_CTRL_HPD_EN in
REG_DP_DP_HPD_CTRL:

drivers/gpu/drm/msm/dp/dp_display.c:msm_dp_pm_runtime_resume() {
	...
	msm_dp_display_host_init(dp);
	if (dp->msm_dp_display.is_edp) {
		msm_dp_aux_hpd_enable(dp->aux);
		msm_dp_display_host_phy_init(dp);
	}
	...
}

Because DP_DP_HPD_CTRL_HPD_EN is always set while eDP is active,
msm_dp_aux_should_reset() always takes the first branch and checks
msm_dp_aux_is_link_connected().  On eDP boards where the SoC internal HPD
pin is not wired (such as panels using no-hpd or GPIO HPD),
msm_dp_aux_is_link_connected() returns 0 and skips resetting the AUX
controller on transfer failures or timeouts.  Should aux->is_edp be
checked before testing DP_DP_HPD_CTRL_HPD_EN?

> @@ -412,7 +431,7 @@ static ssize_t msm_dp_aux_transfer(struct drm_dp_aux *msm_dp_aux,
>  				phy_calibrate(aux->phy);
>  		}
>  		/* reset aux if link is in connected state */
> -		if (msm_dp_aux_is_link_connected(msm_dp_aux))
> +		if (msm_dp_aux_should_reset(aux))
>  			msm_dp_aux_reset(aux);
>  	} else {
>  		aux->retry_cnt = 0;
> @@ -432,6 +451,8 @@ static ssize_t msm_dp_aux_transfer(struct drm_dp_aux *msm_dp_aux,
>  			msg->reply = aux->native ? DP_AUX_NATIVE_REPLY_NACK : DP_AUX_I2C_REPLY_NACK;
>  			break;
>  		case DP_AUX_ERR_TOUT:
> +			if (msm_dp_aux_should_reset(aux))
> +				msm_dp_aux_reset(aux);
>  			ret = -ETIMEDOUT;
>  			break;
>  		}

[Severity: Medium]
Does handling DP_AUX_ERR_TOUT in the else branch bypass phy_calibrate()
across repeated AUX timeouts?

With DP_DP_HPD_REFTIMER_ENABLE now always enabled in msm_dp_aux_enable(),
wire timeouts raise DP_INTR_TIMEOUT and complete aux->comp with
aux->aux_error_num = DP_AUX_ERR_TOUT before the software timeout in
msm_dp_aux_cmd_fifo_tx(), so msm_dp_aux_cmd_fifo_tx() returns ret >= 0.
The else branch then zeroes aux->retry_cnt = 0 before entering
case DP_AUX_ERR_TOUT, and because msm_dp_aux_reset() now resets the
controller cleanly for the next attempt, subsequent timeouts also complete
via DP_AUX_ERR_TOUT without ever incrementing aux->retry_cnt or calling
phy_calibrate(aux->phy) every MAX_AUX_RETRIES native attempts.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-drm-msm-dp-aux-resume-v2-1-3324420b6770@gmail.com?part=1

      reply	other threads:[~2026-11-26 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 14:10 [PATCH v2] drm/msm/dp: clear AUX_TRANS_CTRL on reset and enable HPD_REFTIMER Robert Ijtsma via B4 Relay
2026-11-26 14:39 ` 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-235735@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robertijtsma@gmail.com \
    --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