Skip to content

Commit d487085

Browse files
quic-kdybcioandersson
authored andcommitted
soc: qcom: pmic_glink_altmode: Fix SVID=DP && unconnected edge 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>
1 parent 641f6fd commit d487085

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

drivers/soc/qcom/pmic_glink_altmode.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,17 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
350350

351351
typec_switch_set(alt_port->typec_switch, alt_port->orientation);
352352

353-
if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
354-
pmic_glink_altmode_safe(altmode, alt_port);
355-
} else if (alt_port->svid == USB_TYPEC_TBT_SID) {
353+
if (alt_port->svid == USB_TYPEC_TBT_SID) {
356354
pmic_glink_altmode_enable_tbt(altmode, alt_port);
357355
} else if (alt_port->svid == USB_TYPEC_DP_SID) {
358-
pmic_glink_altmode_enable_dp(altmode, alt_port,
359-
alt_port->mode,
360-
alt_port->hpd_state,
361-
alt_port->hpd_irq);
356+
if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
357+
pmic_glink_altmode_safe(altmode, alt_port);
358+
} else {
359+
pmic_glink_altmode_enable_dp(altmode, alt_port,
360+
alt_port->mode,
361+
alt_port->hpd_state,
362+
alt_port->hpd_irq);
363+
}
362364

363365
if (alt_port->hpd_state)
364366
conn_status = connector_status_connected;
@@ -368,6 +370,8 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
368370
drm_aux_hpd_bridge_notify(&alt_port->bridge->dev, conn_status);
369371
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_TUNNELING) {
370372
pmic_glink_altmode_enable_usb4(altmode, alt_port);
373+
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
374+
pmic_glink_altmode_safe(altmode, alt_port);
371375
} else {
372376
pmic_glink_altmode_enable_usb(altmode, alt_port);
373377
}

0 commit comments

Comments
 (0)