On Thu, Sep 11, 2025 at 10:55:08PM +0800, Xiangxu Yin wrote: > Introduce mutual exclusion between USB and DP PHY modes to prevent > simultaneous activation.
Describe the problem that you are trying to solve first. > > Signed-off-by: Xiangxu Yin <xiangxu....@oss.qualcomm.com> > --- > drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c > b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c > index > 613239d15a6a3bba47a647db4e663713f127c93e..866277036089c588cf0c63204efb91bbec5430ae > 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usbc.c > @@ -1061,6 +1061,19 @@ static int qmp_usbc_usb_power_off(struct phy *phy) > return 0; > } > > +static int qmp_check_mutex_phy(struct qmp_usbc *qmp, bool is_dp) mutex has a very well defined use case - a sleeping lock. Please find some ofther name. > +{ > + if ((is_dp && qmp->usb_init_count) || > + (!is_dp && qmp->dp_init_count)) { > + dev_err(qmp->dev, > + "PHY is configured for %s, can not enable %s\n", > + is_dp ? "USB" : "DP", is_dp ? "DP" : "USB"); > + return -EBUSY; > + } > + > + return 0; > +} > + > static int qmp_usbc_usb_enable(struct phy *phy) > { > struct qmp_usbc *qmp = phy_get_drvdata(phy); -- With best wishes Dmitry