Skip to content

Commit a343fb1

Browse files
quic-kdybcioandersson
authored andcommitted
soc: qcom: pmic_glink_altmode: Fix TBT->SAFE->!TBT transition
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>
1 parent d487085 commit a343fb1

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

drivers/soc/qcom/pmic_glink_altmode.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ struct usbc_notify {
6262
u8 orientation;
6363
u8 mux_ctrl;
6464
#define MUX_CTRL_STATE_NO_CONN 0
65+
#define MUX_CTRL_STATE_USB3_ONLY 1
66+
#define MUX_CTRL_STATE_DP4LN 2
67+
#define MUX_CTRL_STATE_USB3_DP 3
6568
#define MUX_CTRL_STATE_TUNNELING 4
6669

6770
u8 res;
@@ -350,9 +353,12 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
350353

351354
typec_switch_set(alt_port->typec_switch, alt_port->orientation);
352355

353-
if (alt_port->svid == USB_TYPEC_TBT_SID) {
354-
pmic_glink_altmode_enable_tbt(altmode, alt_port);
355-
} else if (alt_port->svid == USB_TYPEC_DP_SID) {
356+
/*
357+
* MUX_CTRL_STATE_DP4LN/USB3_DP may only be set if SVID=DP, but we need
358+
* to special-case the SVID=DP && mux_ctrl=NO_CONN case to deliver a
359+
* HPD notification
360+
*/
361+
if (alt_port->svid == USB_TYPEC_DP_SID) {
356362
if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
357363
pmic_glink_altmode_safe(altmode, alt_port);
358364
} else {
@@ -369,11 +375,18 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
369375

370376
drm_aux_hpd_bridge_notify(&alt_port->bridge->dev, conn_status);
371377
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_TUNNELING) {
372-
pmic_glink_altmode_enable_usb4(altmode, alt_port);
378+
if (alt_port->svid == USB_TYPEC_TBT_SID)
379+
pmic_glink_altmode_enable_tbt(altmode, alt_port);
380+
else
381+
pmic_glink_altmode_enable_usb4(altmode, alt_port);
382+
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_USB3_ONLY) {
383+
pmic_glink_altmode_enable_usb(altmode, alt_port);
373384
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
374385
pmic_glink_altmode_safe(altmode, alt_port);
375386
} else {
376-
pmic_glink_altmode_enable_usb(altmode, alt_port);
387+
dev_err(altmode->dev, "Got unknown mux_ctrl: %u on port %u, forcing safe mode\n",
388+
alt_port->mux_ctrl, alt_port->index);
389+
pmic_glink_altmode_safe(altmode, alt_port);
377390
}
378391

379392
pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index);

0 commit comments

Comments
 (0)