NanoPC T4: how to make DisplayPort & Type-C working in 5.* kernels


Recommended Posts

Hello, nanopc t4 folks,

 

Some, not so long time ago, I worked on fusb302.ko driver and device tree improvements in order to make USB Type-C port working properly in the mainline 5.* kernel. I managed to get DisplayPort over type-C + some general type-c handling improved before my board simply died. Unfortunately, I was not able to finish all the planned work and cannot continue further :( However, I guess, working DP is already fairly good achievement that might be interesting for many of us. Hereby, I want to publish some patches to the mainline!!! driver and device tree that add missing functionality, so one can get DP+type-C working on NanoPC T4 (and all RK3399 based boards with Fairchild FUSB302 chip for PD with relatively small DT adjustments). I would be very happy if results of my work can be helpful to others and extremely happy if there any volunteers, who are willing to continue work on this subject. My primary goal was to contribute to Armbian, first of all, with a potential mainline repo contribution. What was added:

  • Extcon notifications support (type-c related cables) in the stock fusb302 driver (developed by Google folks, but also used by Intel :) if I understand correctly)
  • DisplayPort altmode is registered automatically, if device tree has proper modelling for that
  • DisplayPort altmode is entered as soon as DP cable connection is detected (both DP+USB3.0 and DP only pin assignments are supported) 
  • DisplayPort altmode is handled by the unified DP altmode driver rather than custom out-of-tree PD chip driver
  • "connector" node modelling in the device tree according to the mainline kernel docs and modern requirements
  • fusb node phandle is still specified as extcon source for Rockchip's proprietary drivers, however, last can be easily adjusted to resolve extcon directly from connector node link (as soon as extcon property is declared as deprecated for all new development).
  • fusb302 driver is now correctly linked to dwc3 driver which provides role_switch functionality (+1 step to correct "Dual Role" mode handling based on the cable detection). This also eliminates annoying error message in the boot log: "OF: graph: no port node found in /i2c@ff3d0000/typec-portc@22"

 

Please, also notice that type-c mode is forced to Host as in the most of rk3399 based SBC dtbs presently. This is rather a workaround for such boards, than a permanent solution, until all necessary bits are developed for correct role switching in the drivers. I kindly ask some NanoPC T4 owners to build mainline kernel with my patches and test whether expected functionality also works for you. Those patches apply to linux kernel since 5.6 when I started to work, but should also apply to way earlier versions according to my brief analysis of kernel commits history.

 

fusb302-add-extcon.patch rk3399-nanopc-t4-type-c-modeling.patch

Link to post
Share on other sites
Donate and support the project!

I downloaded and compiled current. There was a couple errors

I will try again using "dev" since that is post 5.6


arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts:167.35-169.5: ERROR (phandle_references): /usb@fe800000/usb@fe800000/port/endpoint: Reference to non-existent node or label "fusb0_role_sw"

arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts:146.29-148.5: ERROR (phandle_references): /syscon@ff770000/usb2-phy@e450/otg-port/port/endpoint: Reference to non-existent node or label "usbc_hs"

arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts:124.29-126.5: ERROR (phandle_references): /phy@ff7c0000/dp-port/port/endpoint: Reference to non-existent node or label "usbc_dp"

arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts:136.29-138.5: ERROR (phandle_references): /phy@ff7c0000/usb3-port/port/endpoint: Reference to non-existent node or label "usbc_ss"

ERROR: Input tree has errors, aborting (use -f to force output)
make[2]: *** [scripts/Makefile.lib:291: arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dtb] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:500: arch/arm64/boot/dts/rockchip] Error 2
make: *** [Makefile:1246: dtbs] Error 2

 

 

Thanks. I am interested in learning this. The changes are a bit extreme. But I learn tons as I go.

I dont have a DisplayPort but I have a few Anker Type-C hubs and power strips.

To be frank, I bought the Metal Case and Heat-sink Fan. This has improved things.

I run 4.4.213 and Ubuntu Focal Desktop. I am pretty happy now and I have

decided on new programming directions. I run VSCode on my NanoPC-T4.

I am excited by the Gnome3 and moving to TypeScript and Node.

I mostly run Sage Math and Python Science software. This box compiles and runs some advanced

software. Nonetheless I am learning ARM architecture and will keep at the RK3399 and Synopsis

SoC architecture.  I am going to see if the new 5.x kernel can just connect my Anker Type-C hub.

 

I do want to thank everyone for their work on the NanoPC.

 

NOTE: the Ubuntu NetworkManager Setting has a bug and crashes when updating.

I just dont use the GUI. I am not saying running Ubuntu Gnome3 Desktop is ready to go.

It is actually amazingly good though. anyhow...but it will be better under new Panfrost and friends.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...