Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom: qmp-usbc: Add USB/DP exclude handling

When both USB and DP PHY modes are enabled simultaneously on the same
QMP USBC PHY, it can lead to hardware misconfiguration and undefined
behavior. This happens because the PHY resources are not designed to
operate in both modes at the same time.

To prevent this, introduce a mutual exclusion check between USB and DP
PHY modes.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Xiangxu Yin <xiangxu.yin@oss.qualcomm.com>
Link: https://patch.msgid.link/20251215-add-displayport-support-for-qcs615-platform-v8-10-cbc72c88a44e@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Xiangxu Yin and committed by
Vinod Koul
8e7670f7 f3198fde

+21
+21
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
··· 666 666 return 0; 667 667 } 668 668 669 + static int qmp_usbc_check_phy_status(struct qmp_usbc *qmp, bool is_dp) 670 + { 671 + if ((is_dp && qmp->usb_init_count) || 672 + (!is_dp && qmp->dp_init_count)) { 673 + dev_err(qmp->dev, 674 + "PHY is configured for %s, can not enable %s\n", 675 + is_dp ? "USB" : "DP", is_dp ? "DP" : "USB"); 676 + return -EBUSY; 677 + } 678 + 679 + return 0; 680 + } 681 + 669 682 static int qmp_usbc_usb_enable(struct phy *phy) 670 683 { 671 684 struct qmp_usbc *qmp = phy_get_drvdata(phy); 672 685 int ret; 673 686 674 687 mutex_lock(&qmp->phy_mutex); 688 + 689 + ret = qmp_usbc_check_phy_status(qmp, false); 690 + if (ret) 691 + goto out_unlock; 675 692 676 693 ret = qmp_usbc_com_init(phy); 677 694 if (ret) ··· 742 725 } 743 726 744 727 mutex_lock(&qmp->phy_mutex); 728 + 729 + ret = qmp_usbc_check_phy_status(qmp, true); 730 + if (ret) 731 + goto dp_init_unlock; 745 732 746 733 ret = qmp_usbc_com_init(phy); 747 734 if (ret)