Skip to content

soc: qcom: pmic_glink_altmode: support TBT3/USB4 notifications and fix transition edge cases#1013

Open
raryan-qcom wants to merge 3 commits intoqualcomm-linux:tech/pmic/supplyfrom
raryan-qcom:supply
Open

soc: qcom: pmic_glink_altmode: support TBT3/USB4 notifications and fix transition edge cases#1013
raryan-qcom wants to merge 3 commits intoqualcomm-linux:tech/pmic/supplyfrom
raryan-qcom:supply

Conversation

@raryan-qcom
Copy link
Copy Markdown

@raryan-qcom raryan-qcom commented Apr 22, 2026

Extend pmic_glink_altmode to handle TBT3/USB4 mode notifications
received over PMIC_GLINK on supported compute platforms.

The change adds support for parsing the extended notification payload
and reconstructing the relevant cable/mode information so it can be
passed to the Type-C mux and retimer components.

Also fix notification handling corner cases seen during disconnect and
mode transitions:

  • restore correct DP unplug handling when firmware reports SVID=DP with
    mux_ctrl=NO_CONN
  • handle TBT -> SAFE -> non-TBT transitions correctly by validating
    mux_ctrl state before acting on the reported SVID

This keeps USB, DP, TBT and USB4 state transitions consistent and
ensures the connected Type-C components receive the expected mode data.

@raryan-qcom raryan-qcom changed the title Konrard's Changes soc: qcom: pmic_glink_altmode: support TBT3/USB4 notifications and fix transition edge cases Apr 24, 2026
@QUIC-kamalw
Copy link
Copy Markdown

Add proper tags "UPSTREAM" in patches

…ications

Some compute SoCs support additional operation modes, extending the
existing set of USB3/safe/DP-alt-mode.

The firmware performs all the necessary handshakes for
us and there is no room for error on that level (i.e. the sequences
will match what happens on Windows).

The trade-off with that approach is that the received notifications
trim some of the PDO/EUDO data (particularly the cable/plug parts),
offering a set of similar-in-nature-but-not-the-same indicators.

In an attempt to remedy this, I reconstructed some of it, so that the
connected mux/retimer drivers can continue to behave as expected.

Add support for parsing the aforementioned data coming from PMIC_GLINK
and passing it on to the various Type-C components.

Reviewed-by: Jack Pham <jack.pham@oss.qualcomm.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251027-topic-pg_altmode_usb4-v1-1-2931a3ecc146@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
…dge case

The commit referenced in Fixes started evaluating the value of
alt_port->mux_ctrl before checking the active SVID. This led to
drm_aux_hpd_bridge_notify() no longer being called for the 'DP unplug'
case.

Perhaps somewhat interestingly, the firmware sends a notification with
SVID=DP, mux_ctrl=MUX_CTRL_STATE_NO_CONN and pin_assignment=0 on
unplug. 'pin_assignment' was previously interpreted as a bitfield
excerpt from the second byte of the DP pg_altmode payload (and stored
as an u8).

That value is used in pmic_glink_altmode_sc8280xp_notify(), decremented
by 1 (DPAM_HPD_A). Previously, this would result in an u8 underflow
that would rollover to 0xff (which prior to the Fixes patch would have
caused a pmic_glink_altmode_safe() and 'disconnected' bridge
notification). That check was removed, without a replacement.

Resolve this issue by making sure the SID=DP && mux_ctrl=NO_CONN combo
once again results in a HPD bridge notification.

Fixes: 0539c5a ("soc: qcom: pmic_glink_altmode: Consume TBT3/USB4 mode notifications")
Reported-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Tested-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260306-topic-pgaltmode_fixup-v1-1-ec154b2d8e89@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Similar to the case of commit d487085 ("soc: qcom:
pmic_glink_altmode: Fix SVID=DP && unconnected edge case"), leaving the
TBT altmode makes pmic_glink_altmode report a SVID=TBT && mux_ctrl=0
message.

Said commit reordered the check such that the SVID is processed before
checking for NO_CONN. Rework this to take into account valid values of
mux_ctrl first and hopefully solve this for good..

Fixes: d487085 ("soc: qcom: pmic_glink_altmode: Fix SVID=DP && unconnected edge case")
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260317-topic-tbt_pg_fixup-v1-1-325b8647bc82@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
@qcomlnxci qcomlnxci requested review from a team, QUIC-kamalw, jprakash-qc and kotarake and removed request for a team April 27, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants