From: sashiko-bot@kernel.org
To: "Joonhoe Kim" <26rote@gmail.com>
Cc: linux-phy@lists.infradead.org, vkoul@kernel.org,
neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH] phy: qcom: qmp-combo: Leave the USB PCS alone in DP-only mode
Date: Thu, 22 Oct 2026 17:07:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-181846@kernel.org> (raw)
In-Reply-To: <20261022165219.1368-1-26rote@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] phy: qcom: qmp-combo: qmp_combo_typec_switch_set() powers USB in DP-only mode
--
commit ee86c0e81f4849ab16e1b11f61ee95b5a8b6c01a
Author: Joonhoe Kim <26rote@gmail.com>
phy: qcom: qmp-combo: Leave the USB PCS alone in DP-only mode
This commit skips powering on and off the USB PCS in qmp_combo_usb_init() and
qmp_combo_usb_exit() when the PHY is in QMPPHY_MODE_DP_ONLY while continuing
to track qmp->usb_init_count.
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 187f0cd11f6c3..6e3406d519d28 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -4459,10 +4459,12 @@ static int qmp_combo_usb_init(struct phy *phy)
> if (ret)
> return ret;
>
> - ret = qmp_combo_usb_power_on(phy);
> - if (ret) {
> - qmp_combo_com_exit(qmp, false);
> - return ret;
> + if (qmp->qmpphy_mode != QMPPHY_MODE_DP_ONLY) {
> + ret = qmp_combo_usb_power_on(phy);
> + if (ret) {
> + qmp_combo_com_exit(qmp, false);
> + return ret;
> + }
> }
>
> qmp->usb_init_count++;
> @@ -4484,9 +4486,11 @@ static int qmp_combo_usb_exit(struct phy *phy)
> return 0;
> }
>
> - ret = qmp_combo_usb_power_off(phy);
> - if (ret)
> - return ret;
> + if (qmp->qmpphy_mode != QMPPHY_MODE_DP_ONLY) {
> + ret = qmp_combo_usb_power_off(phy);
> + if (ret)
> + return ret;
> + }
>
> ret = qmp_combo_com_exit(qmp, false);
> if (ret)
[Severity: High]
With qmp_combo_usb_init() and qmp_combo_usb_exit() keeping qmp->usb_init_count
non-zero in QMPPHY_MODE_DP_ONLY while leaving the USB PCS powered off, do
qmp_combo_typec_switch_set() and qmp_combo_reconfigure_phy() in
drivers/phy/qualcomm/phy-qcom-qmp-combo.c also need to check for
QMPPHY_MODE_DP_ONLY before touching the USB PCS?
In drivers/phy/qualcomm/phy-qcom-qmp-combo.c, qmp_combo_typec_switch_set()
checks qmp->usb_init_count without checking qmp->qmpphy_mode:
drivers/phy/qualcomm/phy-qcom-qmp-combo.c:qmp_combo_typec_switch_set() {
...
if (qmp->init_count) {
if (qmp->usb_init_count || qmp->usb4_init_count)
qmp_combo_usb_power_off(qmp->usb_phy);
qmp_combo_com_exit(qmp, true);
qmp_combo_com_init(qmp, true);
if (qmp->usb_init_count || qmp->usb4_init_count)
qmp_combo_usb_power_on(qmp->usb_phy);
if (qmp->dp_init_count)
cfg->dp_aux_init(qmp);
}
...
}
When a DP-only monitor (pin assignment C or E) is unplugged,
qmp_combo_typec_switch_set() ignores TYPEC_ORIENTATION_NONE, and
qmp_combo_typec_mux_set() delays the mode change if the Type-C unplug mux
notification arrives before DRM powers off the DP PHY:
drivers/phy/qualcomm/phy-qcom-qmp-combo.c:qmp_combo_typec_mux_set() {
...
if (qmp->qmpphy_mode != QMPPHY_MODE_USB3_ONLY && qmp->dp_powered_on) {
dev_dbg(qmp->dev, "typec_mux_set: DP PHY is still in use, delaying switch\n");
return 0;
}
...
}
This leaves qmp->qmpphy_mode set to QMPPHY_MODE_DP_ONLY while disconnected. On
a subsequent connection in the opposite orientation, Type-C drivers (such as
pmic_glink_altmode_worker(), ucsi_handle_connector_change(), tcpm_mux_set(),
and cros_typec_configure_mux()) call typec_switch_set() before
typec_mux_set().
When qmp_combo_typec_switch_set() runs with qmp->qmpphy_mode still set to
QMPPHY_MODE_DP_ONLY and qmp->usb_init_count > 0, it calls
qmp_combo_usb_power_off() on the unpowered USB PCS, re-runs
qmp_combo_com_init() (which configures DP_MODE and leaves the USB3 PHY reset
asserted), and then calls qmp_combo_usb_power_on(). Would this overwrite the
serdes, lane, and PCS tables, time out waiting for PHYSTATUS, and call
clk_disable_unprepare(qmp->pipe_clk) on the error path while qmp->init_count
remains non-zero?
Similarly, when leaving QMPPHY_MODE_DP_ONLY with qmp->usb_init_count > 0,
qmp_combo_reconfigure_phy() unconditionally powers off the USB PCS even though
it was kept powered down in DP-only mode:
drivers/phy/qualcomm/phy-qcom-qmp-combo.c:qmp_combo_reconfigure_phy() {
...
if (qmp->usb_init_count || qmp->usb4_init_count)
qmp_combo_usb_power_off(qmp->usb_phy);
...
}
Should both qmp_combo_typec_switch_set() and the power-off path in
qmp_combo_reconfigure_phy() also skip the USB PCS when qmp->qmpphy_mode is
QMPPHY_MODE_DP_ONLY?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261022165219.1368-1-26rote@gmail.com?part=1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-10-22 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 16:52 [PATCH] phy: qcom: qmp-combo: Leave the USB PCS alone in DP-only mode Joonhoe Kim
2026-10-22 17:07 ` sashiko-bot [this message]
2026-10-23 12:36 ` Joonhoe Kim
2026-10-23 0:14 ` Val Packett
2026-10-23 12:36 ` Joonhoe Kim
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-181846@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=26rote@gmail.com \
--cc=linux-phy@lists.infradead.org \
--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