megi's PinePhone Development Log RSS

+972

2022–06–28: Pinephone Pro Type-C support is now complete

Final thing that was irritating me about Type-C support on Pinephone Pro and Pinebook Pro was that some things worked only in one orientation of the Type-C plug. There are two possible orientations (unless you're really forceful, then you may create a third one, and I'll not be adding support for that one).

The problem was that Rockchip Type-C PHY driver needs to powerdown and powerup the PHY while the DWC3 driver holds USB controller in reset, in order to be able to reconfigure the PHY for the detected Type-C plug orientation. This power cycling and reconfiguration was not being done.

Rockchip modified the DWC3 driver, and abused its runtime PM implementation to perform the reconfiguration. I didn't like this implementation's assumptions, and decided to figure out something better myself.

In the end I came up with these 3 patches to DWC3:

Which should make both orientations work regardless of data role modes, or runtime PM state. The patches are fairly small and unobtrusive, too. Complete explanations are in the patch descriptions.

And I'm happy to report that Type-C support now works on PPP and PBP without any obvious major issues, with Superspeed available in device and host modes regardless of connector orientation, with Alt-DP working in both orientations, too. Witch charger detection working for both PD and legacy BC1.2. PBP is non-conformant due to lacking input current limitation on USB-C port, but that's a HW issue not fixable in SW. It's just something to keep in mind when using the notebook.

There may still be some issues with particular PD docks (especially the more complicated ones without a captive cable), but it's somewhat hard to determine whether those are caused by bugs in fusb302 driver or the dock's firmware having some quirks or behaviors that interact badly with fusb302. fusb302/TCPM is a very complicated driver combination, and not easy to debug at all. But that will just be small obscure bugs.

As always, the more you pay for the dock, the more bugs you're buying. Pine's docks seem to work fine, just as well as the cheapest dock I managed to buy a few years ago locally for original Pinephone Type-C support development.