Skip to content

Fix USB Type-C port for Orangepi 5/5B#9624

Open
chaitan3 wants to merge 1 commit intoarmbian:mainfrom
chaitan3:rk3588_usb_typec
Open

Fix USB Type-C port for Orangepi 5/5B#9624
chaitan3 wants to merge 1 commit intoarmbian:mainfrom
chaitan3:rk3588_usb_typec

Conversation

@chaitan3
Copy link
Copy Markdown
Contributor

@chaitan3 chaitan3 commented Mar 31, 2026

Description

Fix for USB Type-C port on mainline kernel for Orangepi 5/5B. Prior to this fix, USB Type-C port does not work.

Reference: https://github.com/orangepi-xunlong/linux-orangepi/blob/orange-pi-6.1-rk35xx/arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi

The patch was developed with the help of Gemini 3.1 Pro by feeding it dmesg logs and the above reference dts from vendor. I know maintainers might not be happy with purely AI produced patches, but I hope armbian users with basic debugging skills and advanced AI models can quickly learn and contribute if possible. Happy to make fixes and do additional testing based on suggestions, particularly on which changes might be the ones that are necessary to keep in this patch.

How Has This Been Tested?

Testing on Orangepi 5B using a USB Type-C device (headphone jack converter) and a USB Type-C Hub. Note, I don't have a Orangepi 5 to test whether the changes break anything or not. I haven't tested USB DP Altmode as the patches for that are still pending from Collabora.

  • USB Type-C on Orangepi 5B
  • USB Type-C on Orangepi 5

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

Summary by CodeRabbit

  • Bug Fixes

    • Resolved USB Type-C power delivery configuration for Orange Pi 5 devices.
    • Enhanced Type-C connector power supply settings.
  • Improvements

    • Added Type-C alternate mode support for improved device functionality.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

Updated the Rockchip RK3588S device tree for Orange Pi 5 to modify USB Type-C power delivery configuration. The patch changes the connector power role from source to sink, adds alternate modes specification, and configures vbus-supply for the OTG node.

Changes

Cohort / File(s) Summary
Device Tree Configuration
patch/kernel/archive/rockchip64-7.0/rk3588-1221-arm64-fix-typec-for-orangepi-5-5b.patch
Modified usb_con connector by changing try-power-role from "source" to "sink", added altmodes block with alternate mode configuration (altmode@0 with reg, svid, vdo), and added vbus-supply = <&vbus_typec>; to &u2phy0_otg node.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A device tree grows so bright,
With USB Type-C set just right,
From source to sink, the power flows,
Alternate modes in rows and rows,
Orange Pi's connector now glows! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the USB Type-C port configuration for Orange Pi 5/5B devices.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the 05 Milestone: Second quarter release label Mar 31, 2026
@github-actions github-actions bot added the size/small PR with less then 50 lines label Mar 31, 2026
@github-actions github-actions bot added Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Mar 31, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
patch/kernel/archive/rockchip64-7.0/rk3588-1221-arm64-fix-typec-for-orangepi-5-5b.patch (1)

12-21: Consider aligning indentation with kernel DTS conventions.

The altmodes block uses space-based indentation. Linux kernel device tree files typically use tabs for indentation. While this won't cause functional issues, aligning with the existing file's indentation style improves consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@patch/kernel/archive/rockchip64-7.0/rk3588-1221-arm64-fix-typec-for-orangepi-5-5b.patch`
around lines 12 - 21, The altmodes node and its child altmode@0 in the patch are
indented with spaces; update their indentation to use tabs to match kernel DTS
style—adjust the lines containing "altmodes {", "#address-cells", "#size-cells",
"altmode@0 {", "reg =", "svid =", "vdo =", and the closing braces so each
nesting level is indented with a single tab character instead of spaces to align
with existing DTS conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@patch/kernel/archive/rockchip64-7.0/rk3588-1221-arm64-fix-typec-for-orangepi-5-5b.patch`:
- Around line 12-21: The altmodes node and its child altmode@0 in the patch are
indented with spaces; update their indentation to use tabs to match kernel DTS
style—adjust the lines containing "altmodes {", "#address-cells", "#size-cells",
"altmode@0 {", "reg =", "svid =", "vdo =", and the closing braces so each
nesting level is indented with a single tab character instead of spaces to align
with existing DTS conventions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d65333c-6f26-478a-b37c-e4433d7ae19d

📥 Commits

Reviewing files that changed from the base of the PR and between 9d0073e and ca6e746.

📒 Files selected for processing (1)
  • patch/kernel/archive/rockchip64-7.0/rk3588-1221-arm64-fix-typec-for-orangepi-5-5b.patch

@EvilOlaf
Copy link
Copy Markdown
Member

EvilOlaf commented Apr 1, 2026

I haven't tested USB DP Altmode as the patches for that are still pending from Collabora.

Do these also include similar dt adjustments? If so we could simply wait until they made it upstream.

@chaitan3
Copy link
Copy Markdown
Contributor Author

chaitan3 commented Apr 1, 2026

The USB DP PHY changes were merged in kernel 6.18. Below is the patch link
https://lore.kernel.org/linux-rockchip/20250822063959.692098-1-andyshrk@163.com/

But, unfortunately, it does not update the DT for Orangepi 5/5B. The mainline status page mentions the following as the status for USB DP PHY.
https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md
"DONE, some DT binding updates required for proper USB-C AltMode support"

Not sure if Collabora is planning more DT updates for other boards. I can take a look at porting some of these changes in a later PR when DP Alt Mode patches are merged.

PS: The USB DP Alt mode enablement is in the following patch series
https://lore.kernel.org/linux-rockchip/20260326-synopsys-dw-dp-improvements-v1-0-501849162290@collabora.com/
https://lore.kernel.org/linux-rockchip/20260313-rockchip-usbdp-cleanup-v3-0-3e8fe89a35b5@collabora.com/
But, these don't seem to have any DT changes. I could be wrong though, I'm not really too familiar with linux kernel development.

@efectn
Copy link
Copy Markdown
Member

efectn commented Apr 2, 2026

Will test it with OPi5, if it works will approve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

3 participants