Qonfused / ASUS-ZenBook-Duo-14-UX481-Hackintosh

OpenCore configuration for the ASUS ZenBook Duo 14" (UX481FA/FL)
https://github.com/Qonfused/ASUS-ZenBook-Duo-14-UX481-Hackintosh
BSD 3-Clause "New" or "Revised" License
31 stars 1 forks source link

Add fan control w/ native fan impl on macOS #37

Open Qonfused opened 1 year ago

Qonfused commented 1 year ago

This is mainly relevant for the UX481FA/FL since the UX581/UX582 models have a media key + native ACPI implementation for toggling thermal policy. For all models, both (2) fans are controlled by the BIOS + embedded controller, though cooling policy is still configurable via ACPI methods as hinted by the system control driver used by MyASUS.

RW-Everything on Windows should show what EC registers are actually being used for fan control, however there should be more standard ACPI methods called by the system control driver (which you should always use rather than writing to EC registers directly).

Below are some observations that may clue into the native ACPI implementation of this:

Qonfused commented 1 year ago

It seems that the ST98 EC method controls the maximum allowed fan RPM; technically this is how fan speed is actually changed.

Qonfused commented 1 year ago

CPU fan control (WMND, IIA0=0x00110013):

55455 | If ((IIA0 == 0x00110013))
55456 | {
55457 |     Local0 = ^^PCI0.LPCB.EC0.RRAM (0xCC, 0x30)
55458 |     If ((IIA1 == Zero))
55459 |     {
55460 |         Local1 = (Local0 & 0xFFFFFFFFFFFFFFBF)
55461 |     }
55462 |     ElseIf ((IIA1 == One))
55463 |     {
55464 |         Local1 = (Local0 | 0x40)
55465 |     }
55466 | 
55467 |     ^^PCI0.LPCB.EC0.WRAM (0xCD, 0x30, Local1)
55468 |     Return (One)
55469 | }

^^ This appears to toggle max fan rpm.

(WMND, IIA0=0x00110019):

55176 | If ((IIA0 == 0x00110019))
55177 | {
55178 |     If ((FANF == One))
55179 |     {
55180 |         Return (0x00010001)
55181 |     }
55182 |     Else
55183 |     {
55184 |         Return (0x00010000)
55185 |     }
55186 | }
...
55428 | If ((IIA0 == 0x00110019))
55429 | {
55430 |     FANL (IIA1)
55431 |     Return (One)
55432 | }
Qonfused commented 1 year ago

Probably also need to remove the SMCSuperIO.kext if it isn't actually doing anything.

Qonfused commented 1 year ago

I'll close this issue for now as there is no VirtualSMC support for controlling these fans (albeit there may be FakeSMC support). It may also be possible within AsusSMC to extend the current fan control by polling/listening for ACPI events, which I'll revisit once that implementation becomes clearer.

Qonfused commented 1 year ago

May be worth revisiting as ITE SuperIO support was added in VirtualSMC recently:

Embedded ITE chip:

image image

xCuri0 commented 1 year ago

@Qonfused EC fan writing isn't allowed in it yet, I'm unsure if EC fan reading even works I just left it because it already was

xCuri0 commented 1 year ago

Also now that VirtualSMC has classes relating to fan speed control it should be easy to add speed writing to the already existing laptop EC support (see Embedded controllers.md in Docs)

yjmd2222 commented 4 months ago

Hi. _TMP method seems to wait 5 loops if the temperature exceeds the threshold of TCRT to return the current temperature. Critical temperature method _CRT calls RCRT which reads the critical value from ECRT and stores the value in TCRT. And DEVS 0x110013 seems to set fan mode to auto, manual, or full speed if this is translated to newer Zenbook variants. Traditionally, the offsets were at 0x521, but for your laptop it seems to be at 0x30. You can check by calculating bitwise operations with 0x85, 0x35, and 0xC5 as they circle among themselves. My old laptop X510UAR doesn't have FANL or FANF, which I guess is used by MyASUS for fan adjustment in newer laptops. But in your DSDT they end up calling DGPS which interacts with RP05.PEGP, which I believe is the DGPU, which is to be turned off. You can use the traditional fan mod SSDT (originally by black.dragon74, now in hiep's Clover branch of Asus Zenbook repo) with ACPIPoller.kext seeing how it doesn't use low-level offsets but high-level methods. It does mod your fan speeds, although I haven't thoroughly tested it now that I think it has some errors. Or if you want to change the offsets from 0x521 to 0x30 and test experimental fan mod I recovered in AsusSMC, please see https://github.com/hieplpvip/AsusSMC/issues/114 and https://github.com/yjmd2222/AsusSMC.

Exceptional work on your hack! I enjoyed reading your development.