Skip to content

rockchip64-6.15: Fix DP alt mode on some rk3399 boards #8271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hyx0329
Copy link
Contributor

@hyx0329 hyx0329 commented Jun 4, 2025

Description

Fix Type-C DP altmode on some rk3399 boards. Currently only on rockchip64-6.15.

The old implementation is tricky, and only works in normal orientation. If the plug is flipped, there will be only USB2.0 connectivity.

With the proposed changes, the type-c ports on related rk3399 boards should work in both orientations. A few patches from Megous are picked(some of them already present in sunxi64 kernel patches). The tricky part is how to notify rk3399 cdn-dp driver about DP HPD(hot plug detection), and a workaround is written.

A caveat is that the c port has to be OTG mode, otherwise it will behave very similar to the old implementation if DP is enabled.

I'm not sure if orange pi 4 / 4 LTS support this, so there's no change to their dts yet.

Apart from the work above, the missing fan node is added to tinkerboard 2's dts.

list of changes

  • fix type-c dp altmode
    • Megous' glue driver and related improvements are imported
      • this involves enabling the driver in defconfig CONFIG_TYPEC_EXTCON=m
    • a workaround for notifying DP HPD to cdn-dp is written(not merged anywhere)
    • related device tree files/patches are updated accordingly(what about orangepi 4?)
  • add missing fan node in tinkerboard 2's dts along with some minor tweaks

How Has This Been Tested?

  • build tinkerboard-2 with edge kernel
  • test on tinkerboard 2s with a hub
    • hub alone works in both orientations
    • hub with display connected works in both orientations
    • when hub is connected, display hot plug/unplug works
    • USB 3.0 type-c drive works in both orientations
  • test with a DP-only dongle
  • test on pinebook pro
  • test on nanopc-t4
  • maybe test on orangepi 4 (need dts change)
  • maybe test on orangepi 4 LTS (need dts change)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

Walkthrough

The linux-rockchip64-edge kernel configuration file was updated to include the CONFIG_TYPEC_EXTCON=m option. This change enables support for the Type-C external connector (extcon) as a loadable kernel module. No other configuration options or settings were modified in this update.

Suggested labels

ready to merge

Suggested reviewers

  • paolosabatino
  • igorpecovnik
  • krachlatte
  • lanefu
  • rpardini

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2e4e01 and ba96f1c.

⛔ Files ignored due to path filters (16)
  • patch/kernel/archive/rockchip64-6.15/board-nanopc-t4-add-typec-dp.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/board-pbp-add-dp-alt-mode.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/dt/rk3399-tinker-2.dts is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-Revert-usb-typec-tcpm-unregister-existing-source-cap.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-drm-rockchip-cdn-dp-Disable-CDN-DP-on-disconnect.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-notify-typec-dp-hpd-state-through-extcon.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-phy-phy-rockchip-inno-usb2-Decrease-delay-between-po.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-phy-rockchip-inno-usb2-More-robust-charger-detection.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-dwc3-Extend-reset-quirk-support-to-include-role-.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-dwc3-Track-the-power-state-of-usb3_generic_phy.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-typec-altmodes-displayport-Respect-DP_CAP_RECEPT.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-typec-tcpm-Fix-PD-devices-capabilities-registrat.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-typec-tcpm-Unregister-altmodes-before-registerin.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-typec-typec-extcon-Add-typec-extcon-bridge-drive.patch is excluded by !patch/**
  • patch/kernel/archive/rockchip64-6.15/rk3399-usbc-usb-typec-typec-extcon-Allow-to-force-reset-on-each-.patch is excluded by !patch/**
📒 Files selected for processing (1)
  • config/kernel/linux-rockchip64-edge.config (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/kernel/linux-rockchip64-edge.config

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... 08 Milestone: Third quarter release labels Jun 4, 2025
@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label Jun 4, 2025
@EvilOlaf EvilOlaf removed the Ready to merge Reviewed, tested and ready for merge label Jun 4, 2025
@paolosabatino
Copy link
Contributor

Looks interesting; perhaps I can find some time during this weekend to give a check on Opi4 LTS. I'm only dubious about what the ~20 new patches for rk3399 do, but anyway...

Improvements:
- type-c on rk3399 works properly with both orientations
- type-c otg now works

Tested on tinkerboard 2s. This patch contains other minor fixes for
tinker2's device tree.
@coderabbitai coderabbitai bot added the Ready to merge Reviewed, tested and ready for merge label Jun 5, 2025
@hyx0329
Copy link
Contributor Author

hyx0329 commented Jun 5, 2025

Some less relevant patches are removed. All patches are rewritten with "rewrite-kernel-patches".

Edit: for convenience, here's a prebuilt kernel package with orangepi 4/LTS dts patched. link link-dtb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more
Development

Successfully merging this pull request may close these issues.

3 participants