RK3326: add GKD Pixel 2 (subdevice c) support#2993
Conversation
|
This looks like too large modification for supporting just one device. |
|
Kernel patches look like they are implemented by LLM. Why not port these patches to mainline? |
|
I'll can trim down and remove the unnecessary source edits, as well as any excess patch files. I have been referencing the px30s source code from the BSP 6.1 when making these edits, but we can definitely import these driver files outright. That is a better idea. |
Hi, in fact I also spent some time on RK3326s before with another device GameMT E6. In my fork, I can boot the 3326s device with bsp 6.6 kernel. And the basic funcionality works properly. The only leftover is after suspend, the device will not recognize the USB port and something wrong with devfreq. update: |
|
If I am not mistaken, wouldn't the ROCKNIX dev's want the ROCKNIX kernel to be built and compatible with this device? Many other distributions (ROGUE OS, Knulli) leverage the BSP Kernel. While this is fine, I am not sure this is satisfactory for mainline ROCKNIX. The problems we are having stem directly from porting to the ROCKNIX kernel. I can definitely look at your code as a reference and use it to help make an "RK3326S" device in the devices list. |
|
@stolen With the help of r3claimer we have the screen working, and have confirmed the Audio, USB, and Buttons are all working. I have also attempted to minimize any excess modification to the ROCKNIX source tree, and have imported the necessary PX30S patches from their BSP tree. |
|
Here is the logic to add LED controlls to the dts. Luckily they are just basic GPIO. I believe they will show in /sys/class/leds/brightnessX. Just adding to the dts turns them all on by default. Echo just a 0 or a 1 should turn them on and off. Ideal would be to create a script that showed the remaining battery percentage relflect in number of leds lit up. |
|
We have enabled GPIO LED control for the GKD Pixel2. Added a |
|
Important: resume-from-sleep is still NOT working correctly on the GKD Pixel2. The device suspends fine but does not wake. Investigation update: found the likely root cause via the vendor rockchip-linux/kernel tree - on PX30S, the deepest suspend modes are governed by ATF/BL31 firmware, not Linux. Added |
|
Ready for alpha testing. Summary of where things stand:
@stolen @r3claimer - given the volume of changes, would appreciate eyes on this whenever you have a chance, especially the wake-from-sleep investigation if either of you has PX30S/ATF firmware insight. |
|
GKD Pixel2 is now merged into Device B — subdevice "c" has been removed entirely. Its u-boot/kernel/system payload was already identical to subdevice b's, so the only real difference was dtb selection. Since Pixel2 has no analog stick wired to the SARADC channel the existing ADC-hwid mechanism relies on (that pin floats and can land in any board's range on a given boot), Verified working on real hardware. |
|
Alpha 1.0 - feature complete. 🎉 GKD Pixel2 support has since been merged into subdevice b (no longer a separate subdevice c) with hardware-silicon-register-based DTB selection, so it coexists cleanly with the other RK3326 "b" boards without any impact on them. Working: display, audio, RTL8188EUS WiFi dongle, USB peripherals (keyboard/storage etc. via the OTG port - now correctly powers what's plugged in), all buttons (A/B swap fixed), battery status LEDs, battery/fuel-gauge reporting, standalone-emulator input controls across all bundled apps. Last remaining TO-DO: wake-from-sleep still doesn't work correctly - proper suspend-to-memory needs further investigation. A temporary Release with SD card image + update tar: https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.0 |
|
Update: fixed a regression introduced by the USB Root cause: the shared RK3326 Release assets updated in place: https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.0 |
|
Wrapping up this development pass — Alpha 1.1 to follow. We're done with our current round of work on the Pixel2 and would like to get this merged before starting on more complex features, so that work can build on a merged baseline rather than an ever-growing fork branch. Since the last update, we've added:
Known "nice to haves" for follow-up work (not blocking this merge):
Let us know if there's anything else needed before merge. |
6b80a7a to
6fee235
Compare
|
Update on the rumble motor: the long-standing "always on from boot" issue is partially fixed. Root cause found via live-hardware register testing: the vendor-extracted The remaining piece is fixed with a small EDIT: I have properly fixed it. For some reason on the Pixel2, pwm0 was in the joypad, when it is supposed to be managed by pwm-vibra. I still need a patch at boot to initialize the pwm0 on the Pixel2 to off, but by using this module, we have made it appear almost immediately in the boot process. |
|
Alpha 1.2 - PWM rumble mostly resolved. Following up on the rumble motor issue: it's now fixed via a small kernel patch (
Uploading this now as Alpha 1.2. Remaining known issues:
This is intended to be the last major Alpha release before this gets merged into mainline - further fixes for the two items above would ideally happen post-merge rather than continuing to grow this branch further. |
Great work! Some comments. Regarding the vibration, I assume just adding things like that pwm and set pwm0 as okay should be fine. Nothing special is needed. At least from my 5.10 port which uses the same driver. My LLVM also added a special patch for otg switch, maybe as reference. And spleep suspend usually strong related to u-boot. |
|
Wake-from-sleep is fixed. Root cause: the earlier suspend-mode-config port only forwarded New follow-up issue found in the process: the system crashes a few seconds after waking. Investigating separately - will update here once resolved. |
|
Quick update: found and fixed a real bug where the GKD Pixel2 (PX30S) was running its CPU/GPU on generic PX30 voltage tables, overvolting the silicon at every frequency step. Corrected OPP tables are in now, with vendor's full frequency range and a safety margin validated on hardware. Still actively working on getting resume-from-suspend fully stable - wakes correctly now, but a hang a few seconds after resume remains under investigation. |
Adds a mainline/ROCKNIX-style board port for the GameKiddy GKD Pixel2 (RK3326S/PX30S), reconstructed from the vendor-extracted devicetree on top of the shared rk3326.dtsi, alongside the U-Boot and kernel-side fixes needed for it to work reliably: - Rumble via the mainline pwm-vibrator driver, with a fully-charged LED state and fixes for a stuck-on-boot PWM state. - PX30S-specific fixes ported from the vendor BSP kernel: the OTP active/standby read protocol (mainline otherwise always uses the wrong, plain-PX30 read path), and CPU/GPU wake/suspend-mode SIP configuration for firmware-controlled deep suspend states. - A GPU clock double-management bug between genpd's automatic GENPD_FLAG_PM_CLK tracking and mali_kbase's own direct clock management, confirmed via live dmesg to cause "Enabling unprepared clk_gpu" / -ESHUTDOWN during real resume - genpd no longer tracks the GPU domain's clock on PX30S, leaving mali_kbase as sole owner. - Board-local CPU/GPU OPP tables using this board's own real, vendor-validated voltages (confirmed against the vendor's own decompiled devicetree, since this board's real firmware uses the generic PX30 tables rather than the lower-voltage PX30S-suffixed ones some other porting attempts assume), fixing both a CPU overclock freeze and contributing to the deep-suspend/resume reliability fix above. With these fixes, deep suspend/resume (not just s2idle) now works consistently on real hardware, so the earlier freeze-as-default- suspend-mode workaround for this board is removed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9e4e3a7 to
c1bb86d
Compare
Alpha 1.3 (Final) is complete - proper suspend-to-memory now workingDeep suspend/resume (real
The The only remaining known issue is out of scope for this PR: USB-OTG state transitions aren't fully robust - the port can get stuck in either a "Host" or "Peripheral" configuration depending on what was plugged in most recently, requiring a device reset to recover. Left for follow-up work post-merge. Alpha 1.3 build artifacts (flashable image + update tar, with checksums): https://github.com/Jacob-Matthew-Cook/distribution/releases/tag/pixel2-alpha-1.3 |
|
@Jacob-Matthew-Cook I tested the Alpha 1.3 build on real hardware. The first boot was completely normal. However, after changing the language and timezone in the Settings and performing a restart, the device gets stuck on a black screen (the backlight is on, but there is no display) right after the boot logo. |
rk3326s-gkd-pixel2-system.dtsi is U-Boot's SPL-stage devicetree (u-boot,dm-pre-reloc/dm-spl markers, generic rockchip,rk3326-evb compatible) from the initial port commit - never #include'd by anything that actually builds, same as the other reference-only .dtsi files already kept around for vendor comparison. Has no CPU/GPU OPP tables or anything else relevant to the ongoing suspend/OPP work, since SPL doesn't do frequency scaling at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…via Kconfig Simplifies two board-specific U-Boot patches into plain defconfig changes: - CONFIG_ROCKCHIP_OTP=y removed. rockchip_cpuid_from_efuse() is entirely gated on CONFIG_ROCKCHIP_EFUSE || CONFIG_ROCKCHIP_OTP (neither is otherwise set on this board), so dropping it removes 0002-px30s-otp-read-protocol.patch's need to exist. Accepted tradeoff: cpuid# is no longer read from hardware at all, so rockchip_setup_macaddr()'s SHA256-derived ethaddr/eth1addr are now based on whatever was on the stack at that point rather than real OTP data - likely identical across every unit of this board, not a correctness regression from before OTP worked, but not a real per-device MAC either. - CONFIG_ROCKCHIP_BOOT_MODE_REG=0x0 added, replacing 0003-disable-adc-download-key-false-trigger.patch. boot_mode.c compiles rockchip_dnl_key_pressed() (the ADC-based download-key check that misfires on this board, since it has no analog stick and the floating SARADC channel reads as "key pressed") entirely out under `#if (CONFIG_ROCKCHIP_BOOT_MODE_REG == 0)`. Accepted tradeoff: fastboot_set_reboot_flag() (CONFIG_FASTBOOT=y is enabled) writes directly to CONFIG_ROCKCHIP_BOOT_MODE_REG outside that same guard, so `reboot fastboot` now writes to physical address 0x0 instead of the real boot-mode flag register - reboot-to-fastboot is not expected to work correctly as a result. Verified via a full u-boot package rebuild: CONFIG_ROCKCHIP_OTP absent and CONFIG_ROCKCHIP_BOOT_MODE_REG=0x0 present in the resulting .config, only 0001-add-support-for-k36-clone-with-emmc-rk3326.patch left applied, and the build completes end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…iver The panel now uses the rocknix,generic-dsi driver (already used by other RK3326 boards, e.g. rk3326-gameconsole-eeclone.dts) with an init sequence reconstructed for this panel, rather than the previous gkd,pixel2-panel/st7701 driver approach. Confirmed working on real hardware with reset-gpios set to GPIO_ACTIVE_LOW, matching the vendor-extracted rk3326s-gkd-pixel2.dtsi (the committed dts previously had this set to GPIO_ACTIVE_HIGH, which left the screen blank). vdd-supply/iovcc-supply replace VCC-supply/IOVCC-supply to match this driver's actual regulator binding names. 029-gkd-pixel2-st7701-panel.patch is removed - nothing references "gkd,pixel2-panel" anymore, so it's dead code. Also two small cleanups noticed along the way: - update.sh: removed a redundant PX30S devmem register check that only produced a log line and never affected SUBDEVICE selection - the kernel-side soc_is_px30s() detection already covers this. - b_boot.ini: flattened the DTB-selection logic from a nested if into a single if-elif-elif-elif-else chain, matching the style already used elsewhere in this file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Deep ("mem") suspend/resume itself now works correctly - the earlier
"never wakes" issue this quirk was written for is fixed. But real
hardware testing this session found a separate, still-unresolved bug:
if a dynamic CPU governor (schedutil/ondemand) is active after resume,
the system reliably crashes within seconds (confirmed memory
corruption - a real page-table translation fault), needing both a CPU
frequency/voltage transition and concurrent memory-management activity
to manifest. Static governors never trigger it, and a fresh boot
survives arbitrarily many/fast transitions under identical load - only
post-resume is affected.
Extensive investigation (kernel-side regulator/clk/OPP theories, BL31
firmware reverse engineering, and two real-hardware attempts at
triggering PX30S's DDR PHY calibration path directly - both of which
caused a full device reset instead of fixing anything) found no root
cause. Until one is, default to "freeze" (s2idle) instead of deep
suspend: CPU cores stay mostly on and idle rather than powering off and
later resuming DVFS, sidestepping the corruption path entirely rather
than fixing it. Same mechanism RK3576 uses for the same class of issue.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Same category as the already-removed rk3326s-gkd-pixel2-system.dtsi: a vendor-extracted reference devicetree (model = "GameKiddy GKD Pixel2 Uboot") kept for provenance/comparison during this board's bring-up, never #include'd or otherwise referenced by anything that actually builds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
You're right, I am noticing sometimes that the screen does this sometimes after restarting. Thanks for testing. I am not sure if this is some issue with the panel timing or the device internals not fully resetting and being in a weird state (the latter is my current theory). I have also updated the Alpha with our findings today that deep suspend does not work completely, and have since readded the necessary quirk file for freeze to be the default. If your screen is completely black, fully power cycle the device, or suspend-then-resume. It is not the most elegant solution, but we will want to troubleshoot the display drivers a bit more as well. @stolen I think this branch is ready for merge into nightly, if you're up for it? |
rk3326s-gkd-pixel2.dtsi is the vendor-extracted, decompiled-from-stock- firmware reference tree - only ever referenced in prose comments on the actual board dts, never #included or otherwise built. Matches the U-Boot-stage and SPL-stage reference dtsi files already dropped earlier.
Trim panel_description down to the single validated 60Hz mode instead of 12 ambiguous candidate modes, and fix a stray extra byte in the MIPI_DCS_EXIT_SLEEP_MODE init command (seq=1100 -> seq=11) that doesn't match either the vendor-extracted panel-init-sequence or the old removed ST7701 C-driver patch. Confirmed better on real hardware. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every other PX30S-specific behavior difference from the vendor BSP kernel already has a corresponding soc_is_px30s()-gated patch in this series (023-025, 027-028) - clk-px30.c was the one gap, still unconditionally using vanilla PX30's DDR PHY clock topology on PX30S boards. On PX30S, clk_ddrphy1x is its own independently muxed/divided clock rather than a fixed /4 of clk_ddrphy4x, and clk_stdby_2wrap runs at a quarter of clk_ddrphy1x's rate instead of the same rate as it. Ported from rockchip-linux/kernel commit f89c8138cab3, cross-checked identical against both the develop-4.4 and develop-5.10 BSP branches. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Spent some time auditing every PX30S-specific difference in the vendor BSP kernel ( Found and fixed one real gap: Everything else already covered, for completeness:
One architectural difference with no fix planned, just noting it: the vendor BSP has an entire subsystem ( |
I think I found the issue. There were a few errors in the panel dts description provided by @stolen, which have been fixed. I am updating Alpha 1.3 again in-place, but I am placing the vendor CPU and GPU opp tables in place (which can go to much lower power levels). The sleep issues seem to be some combination of voltage changing much too quickly for this chip following resume, which we haven't fully characterized. I will need to keep testing @labac-dev, but the in-place Alpha 1.3 update should fix the display. I highly encourage people to try debugging and testing the system via SSH over USB (or UART, if they want to get panics closer the the kernel failure). Given the RAM can corrupt during voltage transitions, it is unlikely the UART can catch the exact cause of failure. If the system is left in performance mode or powersave mode, suspend to memory works. Do be careful, as ondemand and schedutil can cause the system to crash following resume. Lastly, you may notice overclocking from stock settings may reboot your device. If that is the case, you should enable CPU performance mode first, and THEN set the CPU overclock. |
|
Did you implement TEO/Uclamp stack with Schedutil?s - I had to adjust the polling rate down of the freq to be stable for the xf40h and rk3566 work I was doing a few months to get stable results, the defaults poll too aggressively and trigger freq changes which cause crashes . schedutils is probably the right govt in general once dialed in with systemd and TEO, but you need the whole uclamp/teo/cgroupv2 stack setup properly. There should be some discussion on this buried in github from a few months back. |
I don't think I have TEO/Uclamp stack implemented. Also, the issue occurs with either Schedutil or Ondemand. I'll look into your points. How critical is BL32 in your opinion? PR#2360 is eerily similar to what we are working through right now... very interesting: |
|
Yes - the DMC freq selection was part of what I took further and
implemented; it's not really as relevant on the rk3326 as on the 3566. bl32
isn't relevant it was a red herring IIRC. There is probably some more
advanced branches in my github repos.
…On Fri, 17 Jul 2026 at 13:54, Jacob Cook ***@***.***> wrote:
*Jacob-Matthew-Cook* left a comment (ROCKNIX/distribution#2993)
<#2993 (comment)>
Did you implement TEO/Uclamp stack with Schedutil?s - I had to adjust the
polling rate down of the freq to be stable for the xf40h and rk3566 work I
was doing a few months to get stable results, the defaults poll too
aggressively and trigger freq changes which cause crashes . schedutils is
probably the right govt in general once dialed in with systemd and TEO, but
you need the whole uclamp/teo/cgroupv2 stack setup properly. There should
be some discussion on this buried in github from a few months back.
I don't think I have TEO/Uclamp stack implemented. Also, the issue occurs
with either Schedutil or Ondemand. I'll look into your points. How critical
is BL32 in your opinion?
PR#2360 is eerily similar to what we are working through right now... very
interesting:
#2360 <#2360>
—
Reply to this email directly, view it on GitHub
<#2993?email_source=notifications&email_token=AACF5L4YJ5J7U3I647YP4Q35FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4998225725>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACF5L7TCRF76BE5ZGFTOGL5FGBNBAVCNFSNUABFKJSXA33TNF2G64TZHM3TOMJRGIYDAMRRHNEXG43VMU5TIOBTGI2DIMZWGA3KC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AACF5L5JUZCI7OIDHEO4FIT5FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/AACF5L72RXIN3HJ36KIB4735FGBNBA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJZHAZDENJXGI22M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you commented.Message ID:
***@***.***>
|
Interesting. Just a heads up, the Pixel2 uses the RK3326-S variant (not the RK3326 base), which is somewhat modernized and has overall better power performance (with a few newer features). It can support faster RAM if I am not mistaken, and I think it may have some similar structural aspects to newer SoCs from Rockchip. I'll keep looking into this as I have time. If you have any technical input regarding DVFS on the Rockchip SoCs, that would be appreciated. |
Summary
b.soc_is_px30s()detection helper ported from the vendor's own cpuinfo infrastructure.sitronix,st7703in the vendor tree. Its DSIreset-gpiospolarity was also wrong (active-low instead of active-high), so the panel was being told to exit reset every boot and instead held in it the whole time - it never processed a single DSI command, which is why the backlight came on but the screen stayed black. Adds a propergkd,pixel2-panelentry to mainline'spanel-sitronix-st7701.cwith correct reset/enable GPIO sequencing for this IC family.es_input.cfg) and RetroArch autoconfig entries (previously missing entirely for this board), an A/B button swap fix, and GPIO battery-status LED support (4 green + 1 yellow, percentage-tiered).Testing
PWM_LOCK_ENhold time).dev_pm_set_wake_irq()fix for the power button was tried and tested with no change, so that isn't the (or the only) root cause; a suspend-mode quirk workaround was also attempted without success.Additional Context
AI Usage
Did you use AI tools to help write this code? YES