Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nabige Aala" <nabige.aala@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, vkoul@kernel.org,
	neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v6 09/11] phy: qualcomm: qmp-combo: Add per-link-rate auxless/LFPS and drive level for Glymur
Date: Wed, 28 Oct 2026 10:53:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-187779@kernel.org> (raw)
In-Reply-To: <20261028-glymur-phy-v3-v6-9-1f1d2e565a66@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] phy: qcom-qmp-combo: ln_drv_lvl only set in qmp_v8_configure_dp_clocks()
- [High] phy: qcom-qmp-combo: auxless_silence overwrites auxless_setup at offset 0x0d8
--

commit 3ddd7cb28cc0addb91cfae9e70c366e9382047e4
Author: Ritesh Kumar <ritesh.kumar@oss.qualcomm.com>

phy: qualcomm: qmp-combo: Add per-link-rate auxless/LFPS and drive level for Glymur

This commit replaces fixed constants in qmp_v8_configure_dp_clocks() with
per-link-rate auxless setup/silence cycle and LFPS period values, and looks up
the PCS-level lane drive level from the ln_drv_lvl tables based on the maximum
voltage swing and pre-emphasis levels across active lanes.

> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 51d7102aefc38..10b3efe48721d 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3945,21 +3945,47 @@ static void qmp_v4_configure_dp_tx(struct qmp_combo *qmp)
>  static int qmp_v8_configure_dp_clocks(struct qmp_combo *qmp)
>  {
>  	const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
> -	unsigned long pixel_freq;
>  	const struct qmp_phy_cfg *cfg = qmp->cfg;
> +	unsigned long pixel_freq;
> +	u32 auxless_setup, auxless_silence, lfps_period;
> +	unsigned int v_level = 0, p_level = 0;
> +	u8 ln_drv_lvl;
> +	int i;
> +
> +	for (i = 0; i < dp_opts->lanes; i++) {
> +		v_level = max(v_level, dp_opts->voltage[i]);
> +		p_level = max(p_level, dp_opts->pre[i]);
> +	}
> +
> +	if (dp_opts->link_rate <= 2700)
> +		ln_drv_lvl = (*cfg->ln_drv_lvl_hbr_rbr)[v_level][p_level];
> +	else
> +		ln_drv_lvl = (*cfg->ln_drv_lvl_hbr3_hbr2)[v_level][p_level];
>  
>  	switch (dp_opts->link_rate) {
>  	case 1620:
>  		pixel_freq = 1620000000UL / 2;
> +		auxless_setup = 0x03;
> +		auxless_silence = 0x06;
> +		lfps_period = 0x00;
>  		break;
>  	case 2700:
>  		pixel_freq = 2700000000UL / 2;
> +		auxless_setup = 0x04;
> +		auxless_silence = 0x08;
> +		lfps_period = 0x11;
>  		break;
>  	case 5400:
>  		pixel_freq = 5400000000UL / 4;
> +		auxless_setup = 0x09;
> +		auxless_silence = 0x11;
> +		lfps_period = 0x33;
>  		break;
>  	case 8100:
>  		pixel_freq = 8100000000UL / 6;
> +		auxless_setup = 0x0f;
> +		auxless_silence = 0x1a;
> +		lfps_period = 0x55;
>  		break;
>  	default:
>  		/* Other link rates aren't supported */
> @@ -3969,18 +3995,17 @@ static int qmp_v8_configure_dp_clocks(struct qmp_combo *qmp)
>  	/* disable core reset tsync */
>  	writel(0x09, qmp->dp_dp_phy + QSERDES_DP_PHY_CFG);
>  
> -	writel(0x04, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_AUXLESS_SETUP_CYC);
> -	writel(0x08, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_AUXLESS_SILENCE_CYC);
> +	writel(auxless_setup, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_AUXLESS_SETUP_CYC);
> +	writel(auxless_silence, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_AUXLESS_SILENCE_CYC);

[Severity: High]
Does writing auxless_silence to QSERDES_V8_DP_PHY_AUXLESS_SILENCE_CYC
immediately overwrite the auxless_setup value written to
QSERDES_V8_DP_PHY_AUXLESS_SETUP_CYC?

In drivers/phy/qualcomm/phy-qcom-qmp-dp-phy-v8.h, both macros are defined to
the same register offset 0x0d8 (skipping 0x0dc before 0x0e0):

    #define QSERDES_V8_DP_PHY_AUXLESS_SETUP_CYC		0x0d8
    #define QSERDES_V8_DP_PHY_AUXLESS_SILENCE_CYC		0x0d8

As a result, both writel() calls in qmp_v8_configure_dp_clocks() target
qmp->dp_dp_phy + 0x0d8, clobbering auxless_setup with auxless_silence and
leaving offset 0x0dc unprogrammed.

>  	writel(0x08, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LFPS_CYC);
> -	writel(0x11, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LFPS_PERIOD);
> +	writel(lfps_period, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LFPS_PERIOD);
>  
>  	writel(0x3e, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_TSYNC_OVRD);
>  	writel(0x05, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_TX2_TX3_LANE_CTL);
>  	writel(0x05, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_TX0_TX1_LANE_CTL);
>  	writel(0x01, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_AUXLESS_CFG1);
> -	writel(0x11, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LFPS_PERIOD);
> -	writel(0x1f, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LN0_DRV_LVL);
> -	writel(0x1f, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LN1_DRV_LVL);
> +	writel(ln_drv_lvl, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LN0_DRV_LVL);
> +	writel(ln_drv_lvl, qmp->dp_dp_phy + QSERDES_V8_DP_PHY_LN1_DRV_LVL);

[Severity: High]
Are QSERDES_V8_DP_PHY_LN0_DRV_LVL and QSERDES_V8_DP_PHY_LN1_DRV_LVL ever
updated when voltage swing and pre-emphasis change during DisplayPort link
training, and can an invalid 0xff sentinel value be written to them?

In the MSM DisplayPort driver (drivers/gpu/drm/msm/dp/dp_ctrl.c),
msm_dp_ctrl_enable_mainlink_clocks() calls phy_power_on() before link training
starts, which runs:

    qmp_combo_dp_power_on()
      -> qmp_v8_configure_dp_phy()
        -> qmp_combo_configure_dp_phy_common()
          -> qmp_v8_configure_dp_clocks()

At that point, dp_opts->voltage[] and dp_opts->pre[] are 0 on initial link
bringup (or hold stale values from a prior attempt during
msm_dp_ctrl_reinitialize_mainlink() before msm_dp_link_reset_phy_params_vx_px()
resets them in msm_dp_ctrl_link_train_1()).

When link training subsequently adjusts voltage swing and pre-emphasis via
msm_dp_ctrl_update_phy_vx_px() -> msm_dp_ctrl_set_vx_px() -> phy_configure()
with set_voltages = 1, qmp_combo_dp_configure() only calls
cfg->configure_dp_tx(qmp):

    memcpy(&qmp->dp_opts, dp_opts, sizeof(*dp_opts));
    if (qmp->dp_opts.set_voltages) {
            cfg->configure_dp_tx(qmp);
            qmp->dp_opts.set_voltages = 0;
    }

For Glymur, cfg->configure_dp_tx is qmp_v4_configure_dp_tx() ->
qmp_combo_configure_dp_swing(), which updates QPHY_TX_TX_DRV_LVL and
QPHY_TX_TX_EMP_POST1_LVL on dp_tx and dp_tx2, but never updates
QSERDES_V8_DP_PHY_LN0_DRV_LVL or QSERDES_V8_DP_PHY_LN1_DRV_LVL.

In addition, qmp_dp_v8_ln_drv_lvl_hbr3_hbr2 and qmp_dp_v8_ln_drv_lvl_hbr_rbr
contain 0xff sentinel entries for unsupported combinations where
v_level + p_level > 3:

    static const u8 qmp_dp_v8_ln_drv_lvl_hbr3_hbr2[4][4] = {
            { 0x02, 0x12, 0x16, 0x1a },
            { 0x09, 0x19, 0x1f, 0xff },
            { 0x10, 0x1f, 0xff, 0xff },
            { 0x1f, 0xff, 0xff, 0xff }
    };

Unlike qmp_combo_configure_dp_swing(), which checks for 0xff before writing to
the hardware registers, qmp_v8_configure_dp_clocks() does not check whether
ln_drv_lvl is 0xff before programming QSERDES_V8_DP_PHY_LN0_DRV_LVL and
QSERDES_V8_DP_PHY_LN1_DRV_LVL.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261028-glymur-phy-v3-v6-0-1f1d2e565a66@oss.qualcomm.com?part=9

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

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

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 10:37 [PATCH v6 00/11] phy: qualcomm: qmp-combo: update DP PHY PLL programming on Glymur Nabige Aala
2026-10-28 10:37 ` [PATCH v6 01/11] phy: qualcomm: qmp-combo: Add DP COM v8 header and fix register layout Nabige Aala
2026-10-28 10:37 ` [PATCH v6 02/11] phy: qualcomm: qmp-combo: Update DP PHY common init tables Nabige Aala
2026-10-28 10:37 ` [PATCH v6 03/11] phy: qualcomm: qmp-combo: Update link rate specific DP PHY tables Nabige Aala
2026-10-28 10:38 ` [PATCH v6 04/11] phy: qualcomm: qmp-combo: Ignore Type-C orientation for Glymur DP mode Nabige Aala
2026-10-28 10:38 ` [PATCH v6 05/11] phy: qualcomm: qmp-combo: Add hardware-specific dp_aux_cfg2 and dp_phy_cfg1 fields Nabige Aala
2026-10-28 10:48   ` sashiko-bot
2026-10-28 10:38 ` [PATCH v6 06/11] phy: qualcomm: qmp-combo: Add v8 PCS-level drive level tables for Glymur Nabige Aala
2026-10-28 10:38 ` [PATCH v6 07/11] phy: qualcomm: qmp-combo: Extract common DP PHY init sequence Nabige Aala
2026-10-28 10:47   ` sashiko-bot
2026-10-28 10:38 ` [PATCH v6 08/11] phy: qualcomm: qmp-combo: Remove VCO_DIV programming from qmp_v8_configure_dp_clocks() Nabige Aala
2026-10-28 10:38 ` [PATCH v6 09/11] phy: qualcomm: qmp-combo: Add per-link-rate auxless/LFPS and drive level for Glymur Nabige Aala
2026-10-28 10:53   ` sashiko-bot [this message]
2026-10-28 10:38 ` [PATCH v6 10/11] phy: qualcomm: qmp-combo: Fix Glymur v8 DP PHY init and configure sequences Nabige Aala
2026-10-28 11:01   ` sashiko-bot
2026-10-28 10:38 ` [PATCH v6 11/11] phy: qualcomm: qmp-combo: Fix error propagation in qmp_combo_dp_power_on() Nabige Aala
2026-10-28 10:55   ` sashiko-bot

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-187779@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=nabige.aala@oss.qualcomm.com \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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