From 46a569b9d6e6cd2533514f7753d228e04915ff1d Mon Sep 17 00:00:00 2001 From: Visual Ehrmanntraut <30368284+VisualEhrmanntraut@users.noreply.github.com> Date: Mon, 19 Aug 2024 20:08:43 +0300 Subject: [PATCH] fix(fb): fix pwm value calculation [why] the brightness turns off on raven as soon as it's turned down [how] calculate pwm value correctly (0xff * 0x101) as in linux --- NootedRed/X6000FB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NootedRed/X6000FB.cpp b/NootedRed/X6000FB.cpp index 8c7ef89f..58e8a1f9 100644 --- a/NootedRed/X6000FB.cpp +++ b/NootedRed/X6000FB.cpp @@ -332,7 +332,7 @@ IOReturn X6000FB::wrapSetAttributeForConnection(IOService *framebuffer, IOIndex return kIOReturnSuccess; } } else { - UInt32 pwmValue = percentage >= 100 ? 0x1FF00 : ((percentage * 0xFF) / 100) << 8U; + UInt32 pwmValue = (percentage * 0xFFFF) / 100; DBGLOG("X6000FB", "setAttributeForConnection: New PWM brightness: 0x%X", pwmValue); if (callback->orgDcLinkSetBacklightLevel(callback->embeddedPanelLink, pwmValue, 0)) { return kIOReturnSuccess; }