Re: [PATCH v5 00/14] Add Qualcomm PMIC TPCM support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bryan,

On Mon Apr 17, 2023 at 12:04 PM CEST, Bryan O'Donoghue wrote:
> On 17/04/2023 08:35, Luca Weiss wrote:
> > 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?
>
> PHY - I'd almost just do the following
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c 
> b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index edb788a71edeb..bbac82bd093f8 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> @@ -3369,7 +3369,7 @@ static int qmp_combo_typec_switch_set(struct 
> typec_switch_dev *sw,
>
>          dev_dbg(qmp->dev, "Toggling orientation current %d requested %d\n",
>                  qmp->orientation, orientation);
> -
> +return 0;
>
> In that case the PHY should "just work" for host or device in one 
> orientation.
>
> The other possibility is that the data role message is not hitting dwc3 
> drd on your platform.
>
> If you take the last commit on this branch - plus the updated PHY commit
>
> Commit: 171d7f507511 ("usb: dwc3: drd: Enable user-space triggered 
> role-switching")
>
> Commit: eb0daa19f3ad ("phy: qcom-qmp: Register as a typec switch for 
> orientation detection")
>
> https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/linux-next-23-04-17-pm8150b-tcpm-qcom-wrapper-typec-mux
>
> cat /sys/class/usb_role/a600000.usb-role-switch/role
>
> On SM8250 it looks like this
>
> - Attach TypeC accessory with USB key plugged in [1]
>    Mount USB key, read/write some data
>    Unmount USB key
>
>    cat /sys/class/usb_role/a600000.usb-role-switch/role
>    host

It feels like I spent way too much time now trying to understand the
current behavior across the different patch versions, it's a bit messy,
but in short:

With the "user-space triggered role-switching" patch I can see that
whatever scenario the USB-C port is in, the role is stuck on "device". 

Nothing =
    Role: device, Orientation: unknown

USB(-A) cable to laptop (either direction) =
    Role: device, Orientation: unknown

USB stick up =
    Role: device, Orientation: reverse

USB stick down =
    Role: device, Orientation: normal

Sometimes/mostly when the USB cable is attached during boot I get USB
connection to the laptop until I unplug, then it won't reenable itself.

Also the early return in qmp_combo_typec_switch_set doesn't seem to
change much I believe? But for sure normally qmp_combo_dp_power_off/on
does not get called so I wouldn't be suprised if this reinit breaks
something in the phy.

> <snip>
>
> Yep its worth checking out that the data-role switch is working, we 
> might be looking at the wrong thing for you on the PHY.
>

So this seems to be the case? If that's useful, I can also go back to
the previous (v4?) TCPM revision where the switching mostly worked fine.

(btw the subject has a typo, TPCM instead of TCPM :) )

Regards
Luca




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux