Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Qonfused opened this issue Feb 13, 2023 · 7 comments
Open

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

Qonfused opened this issue Feb 13, 2023 · 7 comments
Labels
project:UX481 For variants UX481FA (14", 2019) and UX481FL (14", 2019) type:documentation Improvements or additions to documentation type:feature New feature request

Comments

@Qonfused
Copy link
Owner

Qonfused commented Feb 13, 2023

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:

  • An ACPI method \_TZ_.RTMP reads and stores the current CPU temperature.
    • The ECPU EC method reads the current CPU temperature.
    • This method is used under the _TMP method of the THRM thermalzone, which should shed some light on how cooling policy is configured.
  • The \_TZ_.RFAN method (in the same scope) is responsible for reading the fan speed.
    • The ECAV EC method checks if the embedded controller is available/ready, otherwise the method aborts with value zero.
    • The ST83 EC method outputs byte values for a given fan idx (range appears to be between 0x00 and 0xFF)
    • The TACH EC method outputs the RPM from a tachometer for a given fan idx (appears to max at 6000 RPM).
  • Potentially relevant, under WMND (IIA0=0x00110019) there are several blocks checking a FANF variable.
    • This is likely referenced in the MyASUS driver for fan diagnostics; it potentially refers to fan PWM frequency.
@Qonfused Qonfused added type:documentation Improvements or additions to documentation type:feature New feature request project:UX481 For variants UX481FA (14", 2019) and UX481FL (14", 2019) labels Feb 13, 2023
@Qonfused Qonfused changed the title Add fan control ACPI methods w/ native fan impl on macOS Add fan control w/ native fan impl on macOS Feb 14, 2023
@Qonfused
Copy link
Owner Author

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

@Qonfused
Copy link
Owner Author

Qonfused commented Feb 17, 2023

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
Copy link
Owner Author

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

@Qonfused
Copy link
Owner Author

Qonfused commented Mar 5, 2023

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 Qonfused closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2023
@Qonfused
Copy link
Owner Author

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

Embedded ITE chip:

image
image

@Qonfused Qonfused reopened this Jun 11, 2023
@xCuri0
Copy link

xCuri0 commented Jun 12, 2023

@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
Copy link

xCuri0 commented Jun 12, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:UX481 For variants UX481FA (14", 2019) and UX481FL (14", 2019) type:documentation Improvements or additions to documentation type:feature New feature request
Projects
Status: Todo
Development

No branches or pull requests

2 participants