megi's PinePhone Development Log RSS

2021–11–07: Pinephone Pro – USB, Type-C, OTG, DP-Alt mode, Charger,… – some success :)

Some good news below! :)

fusb302 disconnect bug

I've been slowed down by a bug in fusb302, that manifested as inability of the driver to detect disconnects when in host mode (with dock connected). That meant that when I unplugged the dock, rest of the drivers would not be notified, and this caused issues.

I had to read through the entire driver, write a summary of what it does in detail, and add some extra debugging functionality to dump fusb302 chip registers, before I found the issue. It was caused by wrong masking of interrupts, so the interrupt that should have notified the SoC about unplug was only set in the interrupt status register, but was not notifying the SoC because it was masked.

It's a longstanding bug in fusb302 driver that was there for years, so I guess it was causing issues on Pinebook Pro, too.

Bridge driver is complete

My typec → extcon bridge driver I was writing about in the previous post is now also complete.

Now I'm in the phase of doing various tests, to check for reliability and correctness of the behavior. So far it looks very promissing, and all the USB host/peripheral mode, Charger PD negotiation, BC1.2 detection, Display port alt mode, seem to work. :)

Here's a video from the tests:

(Dual display output with Pine64 dock with USB keyboard and a charger connected to the dock)

My implementation is different from the one done previously by Manjaro, and does not require any patches to the mainline drivers that would be unacceptable upstream.

Comparing Pinephone Pro convergence with original Pinephone

Type-C implementation on Pinephone Pro is way less complicated than on the original Pinephone. Figuring Type-C stuff on Pinephone took me many months, and required thousands lines of complicated code. I was still uncovering HW bugs until recently.

On Pinephone Pro, it just took about 2 weeks, required just a few simple few hundred line drivers, and it already seems rather complete, with no obvious missing things. Implementation is also using all the standard kernel interfaces.

I expect the remaining issues to just be a subtle corner-case bugs, rather than a missing functionality. The hardware part is also very simple, with very little opportunity for hardware bugs.

IMO, all this looks rather good, and much more boring than the original Pinephone! :)