Skip to content

Add Gpio native support for RK3588 for OrangePi 5#2495

Open
Ellerbach wants to merge 7 commits intodotnet:mainfrom
Ellerbach:add-RK3588
Open

Add Gpio native support for RK3588 for OrangePi 5#2495
Ellerbach wants to merge 7 commits intodotnet:mainfrom
Ellerbach:add-RK3588

Conversation

@Ellerbach
Copy link
Copy Markdown
Member

@Ellerbach Ellerbach commented Apr 18, 2026

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

@Ellerbach Ellerbach requested a review from Copilot April 18, 2026 14:15
@dotnet-policy-service dotnet-policy-service Bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Apr 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Comment thread src/devices/Gpio/Drivers/OrangePi5BDriver.cs Outdated
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs Outdated
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs Outdated
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs
Comment thread src/devices/Gpio/Drivers/OrangePi5UltraDriver.cs Outdated
Comment thread src/devices/Gpio/Drivers/OrangePi5Driver.cs Outdated
Comment on lines +47 to +64
/// <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));
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Comment thread src/devices/Gpio/samples/orangepi5/Program.cs
Comment thread src/devices/Gpio/samples/orangepi5/Program.cs Outdated
Comment thread src/devices/Gpio/Drivers/OrangePi5ProDriver.cs Outdated
Ellerbach and others added 2 commits April 18, 2026 21:55
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Rk3588Driver implementing 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.

Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs Outdated
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs Outdated
Comment thread src/devices/Gpio/Drivers/OrangePi5UltraDriver.cs Outdated
Comment thread src/devices/Gpio/Drivers/Rockchip/Rk3588Driver.cs
Ellerbach and others added 2 commits April 18, 2026 22:15
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants