On Mon Apr 17, 2023 at 2:30 AM CEST, Bryan O'Donoghue wrote: > On 14/04/2023 07:51, Luca Weiss wrote: > > I see "reverse" and "normal" depending on the direction the USB stick is > > plugged in. When unplugged but also when plugged into my PC it stays at > > "unknown". > > Right so, this is down to bad behavior on the PHY patch, which is > resolved for me on sm8250 with the below. > > Basically when you unplug a device you would transition back to > "TYPEC_ORIENTATION_NONE" but that would turn off the PHY, which is obs > not very useful if you want to subsequently be a gadget. > > Anyway thanks for testing this - I'd missed the > host->device->host->device ping-pong breakage. Hm, unfortunately no improvement with this on my side.. No USB connection pops up on the host, or USB messages regarding the USB stick on the device. Do you have an idea in which part of the code to start debugging this? Since orientation detection is working is it maybe in the phy code and not in the tcpm driver? Or does that also touch crucial stuff for USB apart from telling phy which direction to use? Regards Luca > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index b9a30c087423d..edb788a71edeb 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -3372,12 +3372,13 @@ static int qmp_combo_typec_switch_set(struct > typec_switch_dev *sw, > > qmp->orientation = orientation; > > - if (orientation == TYPEC_ORIENTATION_NONE) { > - if (qmp->init_count) > - ret = qmp_combo_dp_power_off(dp_phy); > - } else { > - if (!qmp->init_count) > - ret = qmp_combo_dp_power_on(dp_phy); > + if (orientation != TYPEC_ORIENTATION_NONE) { > + ret = qmp_combo_dp_power_off(dp_phy); > + if (ret) > + return ret; > + ret = qmp_combo_dp_power_on(dp_phy); > + if (ret) > + return ret; > } > > --- > bod