[PATCH v2 1/3] phy: qcom: qmp-combo: delay Type-C mux switch while DP PHY is initializing

Naidu Nama naidu.nama at oss.qualcomm.com
Thu Nov 12 20:51:56 PST 2026


On 11-11-2026 19:36, Dmitry Baryshkov wrote:
> On Wed, Nov 11, 2026 at 04:13:53PM +0530, naidu nama wrote:
>> From: Saurabh Anand <saurabh.anand at oss.qualcomm.com>
>>
>> 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?


With dp_init_count check, mux_set will be skipped.
>
>> 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 at oss.qualcomm.com>
> Naidu, you are resending the other people patches, but the SoB is
> missing.


Sure, I will update in v3.
>
>> ---
>>   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?


Yes, this can be dropped.
>
>>   		dev_dbg(qmp->dev, "typec_mux_set: DP PHY is still in use, delaying switch\n");
>>   		return 0;
>>   	}
>> -- 
>> 2.43.0
>>



More information about the linux-phy mailing list