From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: olteanv@gmail.com, conor+dt@kernel.org,
devicetree@vger.kernel.org, robh@kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH v7 12/27] phy: rockchip: usbdp: Add missing mode_change update
Date: Thu, 25 Jun 2026 18:02:25 +0000 [thread overview]
Message-ID: <20260625180226.918561F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625-rockchip-usbdp-cleanup-v7-12-38eb3cf654fd@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] When dynamically exiting DisplayPort Alternate Mode, the PHY mode is not updated to reflect the new state, which can silently prevent USB SuperSpeed from powering on. A subsequent patch in the series attempts to fix this but fails due to a logical bug.
--
commit a13f2ad68259618e56bf0f7f6e7be4e8d3391f8e
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: usbdp: Add missing mode_change update
This commit introduces a new helper rk_udphy_mode_set() to update the
available modes. It ensures the mode_change flag is set when required
so that DisplayPort properly re-initializes.
> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> index 1067ddf2d7422..f079715f7da21 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
[ ... ]
> @@ -1394,10 +1403,7 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
> usleep_range(750, 800);
> rk_udphy_dp_hpd_event_trigger(udphy, true);
> } else if (data->status & DP_STATUS_HPD_STATE) {
> - if (udphy->mode != mode) {
> - udphy->mode = mode;
> - udphy->mode_change = true;
> - }
> + rk_udphy_mode_set(udphy, mode);
[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing issue
in rk_udphy_typec_mux_set() regarding how state transitions are handled.
When dynamically exiting DisplayPort Alternate Mode, does the driver
silently prevent USB SuperSpeed from powering on?
If a user unplugs a DP accessory, the Type-C subsystem sends a mux state
update with state->mode set to TYPEC_STATE_SAFE or TYPEC_STATE_USB, and
state->alt set to NULL.
The code evaluates this condition:
if (state->mode >= TYPEC_STATE_MODAL || !state->alt ||
state->alt->svid != USB_TYPEC_DP_SID)
return 0;
For TYPEC_STATE_SAFE and TYPEC_STATE_USB, state->alt is NULL. This makes
!state->alt evaluate to true. Because of the || operator, the entire
statement evaluates to true, causing the function to return 0 and
ignore the event entirely instead of repowering the PHY correctly.
A later patch in the series ("phy: rockchip: usbdp: Properly handle
TYPEC_STATE_SAFE and TYPEC_STATE_USB") attempts to fix this, but the logic
in that patch still contains this error because it fails to restrict the
state->alt checks to only the modal states.
Could the condition be grouped to properly handle the non-modal states?
> rk_udphy_dp_hpd_event_trigger(udphy, true);
> } else {
> rk_udphy_dp_hpd_event_trigger(udphy, false);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260625-rockchip-usbdp-cleanup-v7-0-38eb3cf654fd@collabora.com?part=12
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: olteanv@gmail.com, conor+dt@kernel.org,
devicetree@vger.kernel.org, robh@kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH v7 12/27] phy: rockchip: usbdp: Add missing mode_change update
Date: Thu, 25 Jun 2026 18:02:25 +0000 [thread overview]
Message-ID: <20260625180226.918561F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260625-rockchip-usbdp-cleanup-v7-12-38eb3cf654fd@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] When dynamically exiting DisplayPort Alternate Mode, the PHY mode is not updated to reflect the new state, which can silently prevent USB SuperSpeed from powering on. A subsequent patch in the series attempts to fix this but fails due to a logical bug.
--
commit a13f2ad68259618e56bf0f7f6e7be4e8d3391f8e
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: usbdp: Add missing mode_change update
This commit introduces a new helper rk_udphy_mode_set() to update the
available modes. It ensures the mode_change flag is set when required
so that DisplayPort properly re-initializes.
> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> index 1067ddf2d7422..f079715f7da21 100644
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
[ ... ]
> @@ -1394,10 +1403,7 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
> usleep_range(750, 800);
> rk_udphy_dp_hpd_event_trigger(udphy, true);
> } else if (data->status & DP_STATUS_HPD_STATE) {
> - if (udphy->mode != mode) {
> - udphy->mode = mode;
> - udphy->mode_change = true;
> - }
> + rk_udphy_mode_set(udphy, mode);
[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing issue
in rk_udphy_typec_mux_set() regarding how state transitions are handled.
When dynamically exiting DisplayPort Alternate Mode, does the driver
silently prevent USB SuperSpeed from powering on?
If a user unplugs a DP accessory, the Type-C subsystem sends a mux state
update with state->mode set to TYPEC_STATE_SAFE or TYPEC_STATE_USB, and
state->alt set to NULL.
The code evaluates this condition:
if (state->mode >= TYPEC_STATE_MODAL || !state->alt ||
state->alt->svid != USB_TYPEC_DP_SID)
return 0;
For TYPEC_STATE_SAFE and TYPEC_STATE_USB, state->alt is NULL. This makes
!state->alt evaluate to true. Because of the || operator, the entire
statement evaluates to true, causing the function to return 0 and
ignore the event entirely instead of repowering the PHY correctly.
A later patch in the series ("phy: rockchip: usbdp: Properly handle
TYPEC_STATE_SAFE and TYPEC_STATE_USB") attempts to fix this, but the logic
in that patch still contains this error because it fails to restrict the
state->alt checks to only the modal states.
Could the condition be grouped to properly handle the non-modal states?
> rk_udphy_dp_hpd_event_trigger(udphy, true);
> } else {
> rk_udphy_dp_hpd_event_trigger(udphy, false);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260625-rockchip-usbdp-cleanup-v7-0-38eb3cf654fd@collabora.com?part=12
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-06-25 18:02 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 17:39 [PATCH v7 00/27] phy: rockchip: usbdp: Fixes, DP 1-lane support and cleanups Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 01/27] dt-bindings: phy: rockchip-usbdp: add improved ports scheme Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 02/27] phy: rockchip: usbdp: Update mode_change after error handling Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:00 ` sashiko-bot
2026-06-25 18:00 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 03/27] phy: rockchip: usbdp: Do not lose USB3 PHY status Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:06 ` sashiko-bot
2026-06-25 18:06 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 04/27] phy: rockchip: usbdp: Fix devm_clk_bulk_get_all check Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 05/27] phy: rockchip: usbdp: Handle missing clock-names DT property gracefully Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:59 ` sashiko-bot
2026-06-25 17:59 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 06/27] phy: rockchip: usbdp: Drop seamless DP takeover Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:58 ` sashiko-bot
2026-06-25 17:58 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 07/27] phy: rockchip: usbdp: Handle rk_udphy_reset_deassert_all errors in init check Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 08/27] phy: rockchip: usbdp: Limit DP lane count to muxed lanes Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:07 ` sashiko-bot
2026-06-25 18:07 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 09/27] phy: rockchip: usbdp: Keep clocks running on PHY re-init Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 10/27] phy: rockchip: usbdp: Amend SSC modulation deviation Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 11/27] phy: rockchip: usbdp: Fix LFPS detect threshold control Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 12/27] phy: rockchip: usbdp: Add missing mode_change update Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:02 ` sashiko-bot [this message]
2026-06-25 18:02 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 13/27] phy: rockchip: usbdp: Support single-lane DP Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 14/27] phy: rockchip: usbdp: Rename DP lane functions Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 15/27] phy: rockchip: usbdp: Use FIELD_PREP_WM16_CONST Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 16/27] phy: rockchip: usbdp: Cleanup DP lane selection function Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 17/27] phy: rockchip: usbdp: Register DP aux bridge Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 18/27] phy: rockchip: usbdp: Drop DP HPD handling Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 19/27] phy: rockchip: usbdp: Rename mode_change to phy_needs_reinit Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 20/27] phy: rockchip: usbdp: Re-init the PHY on orientation change Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:09 ` sashiko-bot
2026-06-25 18:09 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 21/27] phy: rockchip: usbdp: Factor out lane_mux_sel setup Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 22/27] phy: rockchip: usbdp: Properly handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:11 ` sashiko-bot
2026-06-25 18:11 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 23/27] phy: rockchip: usbdp: Use guard functions for mutex Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 24/27] phy: rockchip: usbdp: Support going from DP-only mode to USB mode Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 18:12 ` sashiko-bot
2026-06-25 18:12 ` sashiko-bot
2026-06-25 17:39 ` [PATCH v7 25/27] phy: rockchip: usbdp: Hold mutex in DP PHY configure Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 26/27] phy: rockchip: usbdp: Add some extra debug messages Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` [PATCH v7 27/27] phy: rockchip: usbdp: Avoid xHCI SErrors Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
2026-06-25 17:39 ` Sebastian Reichel
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=20260625180226.918561F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sebastian.reichel@collabora.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.