Re: [PATCH v2 1/3] phy: qcom: qmp-combo: delay Type-C mux switch while DP PHY is initializing
From: Dmitry Baryshkov
Date: Wed Nov 11 2026 - 09:12:23 EST
On Wed, Nov 11, 2026 at 04:13:53PM +0530, naidu nama wrote:
> From: Saurabh Anand <saurabh.anand@xxxxxxxxxxxxxxxx>
>
> The Type-C mux switch guard only checked dp_powered_on, which is set in
> qmp_combo_dp_power_on(). However there is a race window between
> qmp_combo_dp_init() and qmp_combo_dp_power_on() during which dp_init_count
> is non-zero but dp_powered_on is still false. A Type-C orientation change
> arriving in this window would proceed with the mux switch while the DP PHY
> is mid-initialization, corrupting the PHY state.
How is going to be handled then?
>
> Extend the guard to also block the mux switch when dp_init_count is
> non-zero, covering the full period from dp_init through dp_power_on.
>
> Signed-off-by: Saurabh Anand <saurabh.anand@xxxxxxxxxxxxxxxx>
Naidu, you are resending the other people patches, but the SoB is
missing.
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index 61d8b7a5ce8f..3f93043f94e5 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -5163,7 +5163,8 @@ static int qmp_combo_typec_mux_set(struct typec_mux_dev *mux, struct typec_mux_s
> return 0;
> }
>
> - if (qmp->qmpphy_mode != QMPPHY_MODE_USB3_ONLY && qmp->dp_powered_on) {
> + if (qmp->qmpphy_mode != QMPPHY_MODE_USB3_ONLY &&
> + (qmp->dp_powered_on || qmp->dp_init_count)) {
Can dp_powered_on be dropped then?
> dev_dbg(qmp->dev, "typec_mux_set: DP PHY is still in use, delaying switch\n");
> return 0;
> }
> --
> 2.43.0
>
--
With best wishes
Dmitry