From a46a675cb976d12bf88fcb5a3fe1df49d4387fd8 Mon Sep 17 00:00:00 2001 From: Skr-niao Date: Sun, 13 Aug 2023 15:37:07 +0800 Subject: [PATCH] Platform/ROCK-5B: Enable fan pwm at 40kHz, 60% duty --- .../RockchipPlatformLib/RockchipPlatformLib.c | 14 ++++++++++++++ .../RockchipPlatformLib/RockchipPlatformLib.inf | 1 + 2 files changed, 15 insertions(+) diff --git a/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.c b/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.c index b98580ac8..5bef97d3a 100644 --- a/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.c +++ b/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.c @@ -11,6 +11,7 @@ #include #include #include +#include #include static struct regulator_init_data rk806_init_data[] = { @@ -328,4 +329,17 @@ PlatformEarlyInit ( ) { // Configure various things specific to this platform + DEBUG((EFI_D_WARN, "PlatformEarlyInit called\n")); + GpioPinSetFunction (0, GPIO_PIN_PC0, 0x3); // PWM1_M0 + + PWM_DATA pwm_data = { + .ControllerID = PWM_CONTROLLER0, + .ChannelID = PWM_CHANNEL1, + .PeriodNs = 25000, + .DutyNs = 15000, + .Polarity = FALSE, + }; // PWM0_CH1 + + RkPwmSetConfig(&pwm_data); + RkPwmEnable(&pwm_data); } diff --git a/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.inf b/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.inf index ec569eaf3..b0ca9550e 100644 --- a/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.inf +++ b/edk2-rockchip/Platform/Radxa/ROCK5B/Library/RockchipPlatformLib/RockchipPlatformLib.inf @@ -28,6 +28,7 @@ SerialPortLib CruLib GpioLib + PWMLib [Sources.common] RockchipPlatformLib.c