dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexandre Marquet" <tb@a-marquet.fr>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/4] drm/bridge: analogix_dp: deassert DP_PHY_PD on power-on for exynos
Date: Sun, 06 Dec 2026 00:05:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-252014@kernel.org> (raw)
In-Reply-To: <20261206-drm-misc-next-manta-auxbus-v2-1-390b739ce0db@a-marquet.fr>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] drm/bridge: analogix_dp: inconsistent DP_INC_BG/DP_EXP_BG
  handling
- [Medium] drm/bridge: analogix_dp: race on ANALOGIX_DP_PHY_PD across
  usleep_range()
- [Low] drm/bridge: analogix_dp: duplicate phy_pd_addr selection
- [Low] drm/bridge: analogix_dp: missing Fixes trailer for commit
  3efe2ace7f5b
--

commit e3a21064f453e8400203ca43063c75345a3ecad6
Author: Alexandre Marquet <tb@a-marquet.fr>

> drm/bridge: analogix_dp: deassert DP_PHY_PD on power-on for exynos
>
> On exynos platforms at least, calling
> analogix_dp_set_analog_power_down() to power on (with enable=false)
> AUX_BLOCK or CH[0-3] currently produces no effect, unless the function
> is first called to power on everything (by setting block to POWER_ALL or
> ANALOG_TOTAL). The reason for this is that DP_PHY_PD being asserted
> (which is its default state) renders every other register bit
> ineffective.
>
> This is particularly an issue for DP AUX channel initialization, that
> tends to happen before anything else (e.g., to request EDID), and thus,
> before anything has any chance to request a power on of the whole analog
> section of the chip.
>
> This commit allows analogix_dp_set_analog_power_down() to power on any
> block, by deasserting DP_PHY_PD if needed. Care is also taken to release
> the bandgap power-down bit DP_INC_BG, as appropriate, on power-on.
>
> Signed-off-by: Alexandre Marquet <tb@a-marquet.fr>

[Severity: Low]
This fixes the early AUX power-on regression introduced when commit
3efe2ace7f5b ("drm/bridge: analogix_dp: move basic controller init into
runtime PM") removed analogix_dp_init_analog_func() from
analogix_dp_init_dp().  Should this include:

  Fixes: 3efe2ace7f5b ("drm/bridge: analogix_dp: move basic controller init into runtime PM")

> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> index c1344a3f013ab..894be581a3902 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> @@ -245,6 +245,47 @@ void analogix_dp_set_pll_power_down(struct analogix_dp_device *dp, bool enable)
>  	writel(reg, dp->reg_base + pd_addr);
>  }
>  
> +static void analogix_dp_set_aux_ch_power_down(struct analogix_dp_device *dp,
> +					      u32 mask,
> +					      bool enable)
> +{
> +	u32 reg;
> +	u32 phy_pd_addr = ANALOGIX_DP_PHY_PD;
> +
> +	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
> +		phy_pd_addr = ANALOGIX_DP_PD;

[Severity: Low]
This isn't a bug, but analogix_dp_set_analog_power_down() is the only
caller and already computes phy_pd_addr.  Passing phy_pd_addr as an
argument would avoid duplicating the Rockchip check.

> +
> +	reg = readl(dp->reg_base + phy_pd_addr);
> +	if (enable) {
> +		reg |= mask;
> +	} else {
> +		if (dp->plat_data && (dp->plat_data->dev_type == EXYNOS_DP)) {
> +			/* Make sure to release the bandgap power-down bit */
> +			if (reg & DP_INC_BG) {
> +				reg |= AUX_PD | CH0_PD | CH1_PD | CH2_PD | CH3_PD;
> +				writel(reg, dp->reg_base + phy_pd_addr);
> +				usleep_range(10, 15);
> +				reg &= ~DP_INC_BG;
> +				writel(reg, dp->reg_base + phy_pd_addr);
> +				usleep_range(10, 15);
> +			}
> +
> +			/* On exynos, register AUX_PD and CH[0-3]_PD have no
> +			 * effect if DP_PHY_PD is asserted. So, when powering
> +			 * any of them up, we need to deassert DP_PHY_PD first.
> +			 */
> +			if (reg & DP_PHY_PD) {
> +				reg |= AUX_PD | CH0_PD | CH1_PD | CH2_PD | CH3_PD;
> +				reg &= ~DP_PHY_PD;
> +			}
> +		}

[Severity: Medium]
As reported by Inki Dae on v1 [1], does this leave DP_EXP_BG set when
powering on AUX_BLOCK or CH[0-3]_BLOCK after POWER_ALL power-down?

POWER_ALL with enable=true (such as in analogix_dp_enable_psr()) writes
DP_ALL_PD (0xff), setting both DP_INC_BG and DP_EXP_BG.  This path
clears DP_INC_BG and DP_PHY_PD but leaves DP_EXP_BG set, unlike
POWER_ALL with enable=false which clears both via writel(0x00, ...).

In addition, case ANALOG_TOTAL uses DP_INC_BG as Rockchip's master
analog power-down bit (while Exynos uses DP_PHY_PD), so guarding the
DP_INC_BG release only under EXYNOS_DP leaves Rockchip unhandled if
bits 7:6 are Rockchip-only.

> +
> +		reg &= ~mask;
> +	}
> +
> +	writel(reg, dp->reg_base + phy_pd_addr);
> +}

[Severity: Medium]
Can a concurrent AUX error recovery race with POWER_ALL power-on across
the two usleep_range(10, 15) calls and power down CH0..CH3?

CPU0                                  CPU1
analogix_dp_bridge_atomic_enable()
  analogix_dp_set_bridge()
    ...POWER_ALL, 0
    writel(DP_ALL_PD, ...)
    usleep_range(10, 15)
                                      analogix_dpaux_transfer()
                                        analogix_dp_transfer()
                                          analogix_dp_init_aux()
                                            ...AUX_BLOCK, false
                                            reg = readl(...) /* 0xff */
                                            usleep_range(10, 15)
                                            writel(0x7f, ...)
                                            usleep_range(10, 15)
    writel(0x7f, ...)
    usleep_range(10, 15)
    writel(0x00, ...)
                                            writel(0x4f, ...)
                                            <-- powers down CH0..CH3

Nonblocking atomic commits run analogix_dp_set_bridge() without modeset
locks, while AUX transfers (such as EDID probing or /dev/drm_dp_aux*)
hold only dp->aux.hw_mutex.

Holding the stale register snapshot across two usleep_range(10, 15)
calls lets CPU1 overwrite CPU0's 0x00 with 0x4f and power down the
main-link lanes, causing link training failures or a blank display.
Serializing ANALOGIX_DP_PHY_PD updates with a mutex would prevent this.

[1] https://lore.kernel.org/r/CAAQKjZPYAn98+8Wtjesr7GCh1s_pX8mWizW=HoY5Pj9xO9St=Q@mail.gmail.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206-drm-misc-next-manta-auxbus-v2-0-390b739ce0db@a-marquet.fr?part=1

  reply	other threads:[~2026-12-06  0:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 23:44 [PATCH v2 0/4] DRM Google Nexus 10 display support Alexandre Marquet via B4 Relay
2026-12-05 23:44 ` [PATCH v2 1/4] drm/bridge: analogix_dp: deassert DP_PHY_PD on power-on for exynos Alexandre Marquet via B4 Relay
2026-12-06  0:05   ` sashiko-bot [this message]
2026-12-05 23:44 ` [PATCH v2 2/4] drm/exynos: exynos_dp: change poweron/off to encoder enable/disable Alexandre Marquet via B4 Relay
2026-12-05 23:57   ` sashiko-bot
2026-12-05 23:44 ` [PATCH v2 3/4] drm/panel-edp: put panel delays in lexical order Alexandre Marquet via B4 Relay
2026-12-05 23:44 ` [PATCH v2 4/4] drm/panel-edp: Add SEC LTL101DL02-002 panel Alexandre Marquet via B4 Relay

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-252014@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tb@a-marquet.fr \
    /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