Skip to content

Commit

Permalink
Silicon/Rockchip: PWMLib: Insert delay after locking previous period …
Browse files Browse the repository at this point in the history
…& duty

Otherwise the new values would sometimes be ignored.
  • Loading branch information
mariobalanica committed Oct 7, 2023
1 parent 8b6b3a6 commit 105f7b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions edk2-rockchip/Silicon/Rockchip/Library/PWMLib/PWMLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
#include <Library/PWMLib.h>

#define PWM_INT_EN(ch) (1 << (ch))
Expand Down Expand Up @@ -81,6 +82,7 @@ RkPwmSetConfig (
Ctrl = MmioRead32(Base + ChannelOffset + PWM_CTRL_OFFSET);
Ctrl |= PWM_LOCK;
MmioWrite32(Base + ChannelOffset + PWM_CTRL_OFFSET, Ctrl);
MicroSecondDelay (1);

MmioWrite32(Base + ChannelOffset + PWM_PERIOD_HPR_OFFSET, PeriodCycle);
MmioWrite32(Base + ChannelOffset + PWM_DUTY_LPR_OFFSET, DutyCycle);
Expand Down
1 change: 1 addition & 0 deletions edk2-rockchip/Silicon/Rockchip/Library/PWMLib/PWMLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[LibraryClasses]
DebugLib
IoLib
TimerLib

[Packages]
EmbeddedPkg/EmbeddedPkg.dec
Expand Down

0 comments on commit 105f7b9

Please sign in to comment.