build icon indicating copy to clipboard operation
build copied to clipboard

rockchip: Add Ariaboard Photonicat 2 support to edge kernel

Open HackingGate opened this issue 3 months ago • 6 comments

Description

This PR adds support for kernel edge to the Ariaboard Photonicat 2 board based on the Rockchip RK3576 SoC.

Device info: https://photonicat.com/

Partially based on: https://github.com/photonicat/rockchip_rk3576_linux_mainline/tree/e093bde29cffcdc4af4b6b5c0052ffd1d90e273c https://github.com/photonicat/photonicat_openwrt/blob/2b275f9d2420f97d88443562712d14f5b0173980/target/linux/rockchip/patches-6.12/998-add-photonicat-usb-watchdog-driver.patch And patches for rk3576 from mailing list.

How Has This Been Tested?

  • [x] Successfully built photonicat2 on edge branch against 6.18
  • [x] Successfully flashed trixie image on Photonicat2's eMMC
  • [x] Device booted
  • [x] HDMI video output worked
  • [x] USB HID worked
  • [x] Ethernet connection worked
  • [x] Wi-Fi connection worked (both onboard Wi-Fi AIC8800 on USB and M.2 Wi-Fi QCNFA765 on PCI)
  • [x] Onboard USB hub worked (onboard Wi-Fi AIC8800 and M.2 GSM modem recognized)
  • [x] Mini LCD screen (tested with photonicat2_mini_display)
  • [x] photonicat-pm power manager driver worked (can check battery status, control fan, do graceful shutdown)
  • [x] aic8800 driver worked for onboard Wi-Fi
  • [x] Onboard USB hub enumeration fixed with a watchdog driver

Logs:

  • Build log: https://paste.next.armbian.com/diculozade
  • dmesg: https://paste.next.armbian.com/ahihacenih

Known Issues:

  • ~Mini LCD screen can't change its brightness, drivers not yet ready.~ fixed by patching rk3576
  • HDMI worked on a previous commit of the PR, didn't investigate deeply, kernel regression?
  • PCI Wi-Fi card may disappear from nmcli after reboot.

Checklist:

Please delete options that are not relevant.

  • [x] My code follows the style guidelines of this project
  • [x] 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

Summary by CodeRabbit

  • New Features
    • Photonicat2 board support (device tree, display, power rails, boot/partition defaults).
    • New Photonicat power-management and USB watchdog drivers for improved hardware control and reliability.
    • Rockchip PWM v4 and MFPWM support and USB3 orientation handling for better peripheral control.
    • SD/MMC v2 tuning and always-on power-domain support for improved storage and power behavior.
    • Cellular modem integration enabled with required user-space packages added.
  • Documentation
    • Added PWM v4 device-tree binding documentation.

HackingGate avatar Sep 22 '25 18:09 HackingGate

Walkthrough

Adds a new Photonicat2 board CSC, RK3576 device tree and Makefile entry, kernel defconfig updates, multiple RK3576-targeted kernel patches (new staging drivers, PWM/MFPWM subsystem, platform fixes), and a board hook that appends cellular modem packages during image builds.

Changes

Cohort / File(s) Summary
Board CSC
config/boards/photonicat2.csc
New board configuration exposing BOARD_NAME, BOARDFAMILY, BOOT_SOC, BOOTCONFIG, KERNEL_TARGET, FULL_DESKTOP, BOOT_FDT_FILE, BOOT_SCENARIO, IMAGE_PARTITION_TABLE, BOARD_FIRMWARE_INSTALL, ENABLE_EXTENSIONS, AIC8800_TYPE and a post-family hook post_family_config__photonicat2_modem_packages that appends modem packages (modemmanager, libqmi-utils, libmbim-utils, usb-modeswitch, libxml2-utils).
Kernel defconfig
config/kernel/linux-rockchip64-edge.config
Edge defconfig updates: enable QRTR/MHI/MHI_BUS, make STMMAC builtin and add STMMAC_PLATFORM, enable ROCKCHIP_MFPWM, PWM_ROCKCHIP_V4, QCOM_QMI_HELPERS, USB CDC/NCM/SUBSET/WDM/WWAN paths, PHOTONICAT_PM and PHOTONICAT_USB_WDT, SERIAL_DEV_CTRL_TTYPORT, and related symbols.
Device tree & DTB build
patch/kernel/.../dt/rk3576-photonicat2.dts, patch/kernel/.../board-photonicat2.patch
New RK3576 Photonicat2 DTS describing model/compatible, chosen/stdout, regulators, battery, backlight, PCIe/USB topology, rfkill nodes, pcat-usb-wdt, pinctrl, clocks and many peripheral nodes; Makefile entry added to include rk3576-photonicat2.dtb in DTB build.
Staging drivers (photonicat)
patch/kernel/.../board-photonicat2-add-photonicat-pm-driver.patch, patch/kernel/.../board-photonicat2-add-photonicat-usb-watchdog.patch
New drivers under drivers/staging: photonicat-pm (serdev-based power manager integrating power-supply/RTC/hwmon/misc, watchdog, sysfs ctl and probe/worker/timer logic) and photonicat-usb-watchdog (USB notifier + GPIO reset + watchdog_device + periodic monitor). Kconfig/Makefile and module metadata included.
PWM / MFPWM subsystem
include/soc/rockchip/mfpwm.h, drivers/soc/rockchip/mfpwm.c, drivers/pwm/pwm-rockchip-v4.c, Documentation/devicetree/bindings/pwm/rockchip,rk3576-pwm.yaml, drivers/pwm/Kconfig, drivers/pwm/Makefile
Adds Rockchip MFPWM core (public header, exported APIs mfpwm_acquire, mfpwm_release, mfpwm_remove_func), RK3576 PWMv4 driver, Kconfig/Makefile updates, and DTS binding YAML.
RK3576 platform fixes & helpers
patch/kernel/.../rk3576-0001-*.patch, ...-0002-*.patch, ...-0003-*.patch, ...-0005-*.patch, ...-0006-*.patch
Multiple RK3576-targeted patches: set GPIO direction before requesting IRQ; add DW MMC v2 tuning support and rockchip,use-v2-tuning DT property; introduce always_on flag for power domains; add FIELD_PREP_HI16_WE helpers in include/linux/bitfield.h; add USB3 controller reset/reinit on orientation switch for USB DP PHY.
DTB build inclusion (redundant listing)
patch/kernel/.../board-photonicat2.patch
Adds rk3576-photonicat2.dtb to RK3576 DTB build list.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Builder
  participant CSC as Board CSC
  participant Defcfg as linux-rockchip64-edge.config
  participant PatchSet as Kernel patchset
  participant DTS as rk3576-photonicat2.dts
  participant Drivers as Kernel drivers (staging, mfpwm, pwm)
  participant HW as Hardware (SerDev, USB, GPIO, PWM)

  Builder->>CSC: read board config & run post-family hook
  CSC->>Defcfg: influence kernel config (enable options)
  Builder->>PatchSet: apply RK3576 patches (drivers, fixes)
  Builder->>DTS: compile device tree blob
  Builder->>Drivers: build staging drivers, mfpwm, pwm modules
  Note right of Drivers: modules register drivers at boot
  Drivers->>HW: open serdev, monitor USB, control GPIO/PWM
  HW-->>Drivers: events (serial frames, USB add/remove, orientation)
  Drivers->>HW: watchdog resets, power-management commands

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~150 minutes

  • Files/areas needing focused review:
    • staging photonicat-pm driver: serdev framing/CRC, threading/timers, power-supply/RTC/hwmon registration, shutdown/restart hooks, misc device buffer handling.
    • photonicat USB watchdog: USB notifier correctness, watchdog_device lifecycle, GPIO reset timing and timer/work race conditions.
    • MFPWM public API and pwm-rockchip-v4: exported symbols, concurrency/resource management, clock/enable sequencing.
    • RK3576 DTS: pinctrl, regulator, clock and rfkill bindings for correctness and duplicates.
    • Kernel config changes: QRTR/MHI and WWAN-related symbols that affect subsystem builds.

Possibly related PRs

  • armbian/build#8778 — touches rockchip64-6.18 RK3576 patch/DTS areas and may overlap with Photonicat2 DTS/patchset changes.

Suggested labels

Framework

Suggested reviewers

  • rpardini
  • paolosabatino
  • krachlatte
  • prahal
  • pyavitz
  • igorpecovnik
  • clee
  • chainsx

Poem

"I nibbled code beneath the moonlit trace,
A board and drivers found their place.
DTS and PWM in a joyful hop,
Watchdogs, serdev — then builds won’t stop.
— a happy rabbit, solder on my face 🐇"

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding support for the Ariaboard Photonicat 2 board to the Rockchip edge kernel, which aligns with the extensive changes across board configuration, kernel patches, and device tree files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

[!TIP]

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions: | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

coderabbitai[bot] avatar Sep 22 '25 18:09 coderabbitai[bot]

Hey @HackingGate! 👋

Thanks for submitting your first pull request to the Armbian project — we're excited to have you contributing! 🧡
Your effort doesn’t just improve Armbian — it benefits the entire community of users and developers.

If you'd like to stay informed about project updates or collaborate more closely with the team,
you can optionally share some personal contact preferences at armbian.com/update-data.
This helps us keep in touch without relying solely on GitHub notifications.

Also, don’t forget to ⭐ star the repo if you haven’t already — and welcome aboard! 🚀

github-actions[bot] avatar Sep 22 '25 18:09 github-actions[bot]

afaik rk35xx is only relevant for vendor kernel. current and edge were merged into rockchip64 family already. You should try to get it into there. Otherwise confusion will increase. rockchip64_common is inherent from rk35xx. https://github.com/armbian/build/blob/main/config/sources/families/include/rockchip64_common.inc

EvilOlaf avatar Sep 23 '25 03:09 EvilOlaf

Logs for 609cd7a4ba5eb4de80179dcc909baf064e7f3a4d

  • Build log: https://paste.next.armbian.com/diculozade
  • dmesg: https://paste.next.armbian.com/ahihacenih

HackingGate avatar Oct 26 '25 10:10 HackingGate

Imo this PR has been too ambiguous. With the few things I looked over this feels more like a vendor kernel that starts off edge. How about you keep the introduction of this hardware simpler and move everything that’s Photonicat to an extension if possible? Else the vendor might have deviated too much with custom power management solutions etc. that it would rather be its own family on armbian if you want to maintain it

HeyMeco avatar Nov 19 '25 21:11 HeyMeco

Else the vendor might have deviated too much with custom power management solutions etc.

For the device specific drivers, I will try to take a look into kernel module tools like DKMS, and even take a taste in Rust for Linux. For general patches, I will try to watch upstream support of rk3576 and general rockchip to see how patches in mailing lists are being reviewed to be adapted in existing codebase. In spare time, with learning by doing. Could take a very long time, so I added WIP label back, hope by the time I look back into the PR things will get easier if more patches get accepted by upstream, or I became better to be able to propose or comment on mailing lists.

How about you keep the introduction of this hardware simpler and move everything that’s Photonicat to an extension if possible?

Hmm, could have created a separate PR for now, that only introduces dts, u-boot, csc, and linux-rockchip64-edge.config etc, with no kernel patches at all. And introduce DKMS specifically for photonicat divers in the second PR, gradually?

HackingGate avatar Nov 22 '25 03:11 HackingGate