Add Gpio native support for RK3588 for OrangePi 5#2495
Add Gpio native support for RK3588 for OrangePi 5#2495Ellerbach wants to merge 7 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds native (memory-mapped) GPIO driver support for Rockchip RK3588/RK3588S-based Orange Pi 5-family boards within the src/devices/Gpio device binding, including documentation and a dedicated sample project.
Changes:
- Added
Rk3588Driver(Rockchip GPIO v2 register model) and Orange Pi 5-family board drivers with physical-pin mapping helpers. - Added a dedicated Orange Pi 5 sample project and excluded it from the existing aggregated samples project.
- Updated Gpio and Rockchip driver READMEs and included the new sample in the
Gpio.sln.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/devices/Gpio/samples/orangepi5/Program.cs | New sample exercising input/output on an Orange Pi 5-family board |
| src/devices/Gpio/samples/orangepi5/Iot.Device.Gpio.Samples.OrangePi5.csproj | New standalone sample project for Orange Pi 5 |
| src/devices/Gpio/samples/Iot.Device.Gpio.Samples.csproj | Excludes orangepi5 sample subtree from the aggregated samples build |
| src/devices/Gpio/README.md | Documents Orange Pi 5-family driver availability |
| src/devices/Gpio/Gpio.sln | Adds the new Orange Pi 5 sample project to the solution |
| src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs | New RK3588/RK3588S memory-mapped GPIO driver implementation |
| src/devices/Gpio/Drivers/Rockchip/README.md | Documents supported Rockchip SoCs/boards and mapping guidance |
| src/devices/Gpio/Drivers/OrangePi5Driver.cs | New Orange Pi 5 (26-pin) board driver + physical pin mapper |
| src/devices/Gpio/Drivers/OrangePi5BDriver.cs | New Orange Pi 5B (26-pin) board driver + physical pin mapper |
| src/devices/Gpio/Drivers/OrangePi5PlusDriver.cs | New Orange Pi 5 Plus (40-pin) board driver + physical pin mapper |
| src/devices/Gpio/Drivers/OrangePi5ProDriver.cs | New Orange Pi 5 Pro (40-pin) board driver + physical pin mapper |
| src/devices/Gpio/Drivers/OrangePi5MaxDriver.cs | New Orange Pi 5 Max (40-pin) board driver + physical pin mapper |
| src/devices/Gpio/Drivers/OrangePi5UltraDriver.cs | New Orange Pi 5 Ultra (40-pin) board driver + physical pin mapper |
| /// <summary> | ||
| /// Maps a physical header pin number (1-40) to the driver's logical GPIO number. | ||
| /// </summary> | ||
| /// <param name="physicalPin">Physical pin number on the 40-pin header (1-40).</param> | ||
| /// <returns>Logical GPIO pin number for use with <see cref="System.Device.Gpio.GpioController"/>.</returns> | ||
| /// <exception cref="ArgumentException">The pin is not a GPIO pin (power, ground, etc.).</exception> | ||
| public static int MapPhysicalPinNumber(int physicalPin) | ||
| { | ||
| if (physicalPin < 0 || physicalPin >= _physicalToGpio.Length) | ||
| { | ||
| throw new ArgumentException($"Physical pin {physicalPin} is out of range (1-40).", nameof(physicalPin)); | ||
| } | ||
|
|
||
| int gpio = _physicalToGpio[physicalPin]; | ||
| return gpio != -1 | ||
| ? gpio | ||
| : throw new ArgumentException($"Physical pin {physicalPin} is not a GPIO pin (power/ground).", nameof(physicalPin)); | ||
| } |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Rockchip RK3588 GPIO driver (memory-mapped register access) plus board-specific driver shims and docs for Orange Pi 5 family boards, along with a dedicated sample project under the Gpio device samples.
Changes:
- Added
Rk3588Driverimplementing GPIO v2 register access, IOC/IOMUX and pull configuration, and clock gating enablement. - Added Orange Pi 5 family driver classes (5/5B/5 Plus/5 Pro/5 Max/5 Ultra) with physical-header pin mapping helpers.
- Added an Orange Pi 5 sample project and updated the Gpio docs/solution to reference the new drivers/sample.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs | New RK3588 SoC-level driver using direct memory mapping for GPIO/IOC/CRU. |
| src/devices/Gpio/Drivers/OrangePi5Driver.cs | Orange Pi 5 (26-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/OrangePi5BDriver.cs | Orange Pi 5B (26-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/OrangePi5PlusDriver.cs | Orange Pi 5 Plus (40-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/OrangePi5ProDriver.cs | Orange Pi 5 Pro (40-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/OrangePi5MaxDriver.cs | Orange Pi 5 Max (40-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/OrangePi5UltraDriver.cs | Orange Pi 5 Ultra (40-pin) board driver wrapper + physical pin mapping helper. |
| src/devices/Gpio/Drivers/Rockchip/README.md | Documents supported RK SoCs/boards and provides usage + mapping guidance. |
| src/devices/Gpio/README.md | Adds Orange Pi 5 family entries to the driver list. |
| src/devices/Gpio/samples/orangepi5/Program.cs | New sample demonstrating input/output usage on Orange Pi 5 family hardware. |
| src/devices/Gpio/samples/orangepi5/Iot.Device.Gpio.Samples.OrangePi5.csproj | New standalone sample project for Orange Pi 5. |
| src/devices/Gpio/samples/Iot.Device.Gpio.Samples.csproj | Excludes the new sub-sample sources from the aggregate samples project. |
| src/devices/Gpio/Gpio.sln | Adds the Orange Pi 5 sample project to the Gpio solution. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add Gpio native support for RK3588 for OrangePi 5
Tested on a real device
No dependency on libgpio, native memory access folowing the same pattern as the other drivers
Microsoft Reviewers: Open in CodeFlow