Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/guides/fan.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This page is a step by step guide to get fan control working on T2 Macs.

In some Macs, the fan has been found to work out of the box. In such cases, the driver is not required unless you want to force a certain speed or do some other configuration which can be done by the help of this driver.

If you are running a kernel version newer than 7.2 (check using `uname -r`), `t2fanrd` will not work on your system. You will need to use another fan-control daemon that supports standard hwmon paths (e.g., `fancontrol` or `thinkfan`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We literally have a fixed t2fanrd for Macsmc. wtf?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using t2fanrd together with zonepower will lead to prochot btw

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using t2fanrd together with zonepower will lead to prochot btw

Thanks for letting us know. Zonepower needs to be ported to t2linux then. Has the fan controller used by KaiT2en been depreciated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it has a switch for native and manual control. Native smc control is recommended. Our manual control is not known to cause prochot but needs to be confirmed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said, new users should use standard fan daemons instead of t2fanrd

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard t2fanrd does not work (the one mentioned in the wiki), is your fork in ubuntu and arch?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu has working t2fanrd, with AdityaGarg8's fork which does the same thing. Arch is going to get updated soon.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't ship fan daemon bloat! Just dont! Users can decide themselves.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharpenedblade i personally agree with @deqrocks, for most systems fan daemons are bloat, and not required, for systems that have broken amdgpu firmware (iMacs), they can use lm-sensors or something else, we should divert users from t2fanrd as much as possible, because we should not maintain it forever yk.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't ship fan daemon bloat! Just dont! Users can decide themselves.

I am going to remove it very soon

we should divert users from t2fanrd as much as possible, because we should not maintain it forever yk.

Im not saying that we should to tell users to use it, but we shouldn't say its broken.


Comment on lines +7 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My fork of t2fanrd supports hwmon. Not all distros have updated, but the upstream repo is archived now.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that your fork supports it, but for new users, its better that they use a standard fan daemon

Additionally, you must add `macsmc_hwmon.fan_control=1` to your kernel command line when using these daemons.

See: https://wiki.archlinux.org/title/Fan_speed_control

## Steps

1. Install `t2fanrd`.
Expand Down
94 changes: 7 additions & 87 deletions docs/guides/hybrid-graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,25 @@

This page describes how to use the iGPU on MacBook Pros with Hybrid Graphics (2 GPUs). 13-inch MacBooks only have an iGPU and do not need this. Using the iGPU means you can save power by putting the more powerful AMD dGPU in a low power state when you don't need it.

This has been tested on the MacBookPro16,1 and the MacBookPro15,1. The 15,3 and 16,4 models are very similar and should work too.
This has been tested on All T2 MacBook Pros with Hybrid Graphics.

Make sure you have a T2 kernel of version greater than 6.9.8-1 (you can check this with `uname -r`).

## Issues

If you experience system freezes followed by high fan speeds and sudden shutdowns (CPU CATERR), or if the AMD GPU is causing excessive heat, try the following solutions:

1. Set the iGPU as the main GPU (instructions below)

2. Set the AMD GPU Dynamic Power Management level from auto to low or high. Low can be safer option to avoid thermal issues or save battery. *Note this will not work on MacBookPro15,1 as the `amdgpu` driver does not support runtime PM on Polaris cards.*
Comment thread
iurjscsi1101500 marked this conversation as resolved.
Resolved

You can test it quickly with: `echo low | sudo tee /sys/bus/pci/drivers/amdgpu/0000:0?:00.0/power_dpm_force_performance_level`

To apply the low level automatically, create `/etc/udev/rules.d/30-amdgpu-pm.rules` file with the following contents (on NixOS, use `services.udev.extraRules` in your configuration):

```plain
SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="low"
```

You can also control the AMD GPU DPM with GUI tools such as [radeon-profile](https://github.com/emerge-e-world/radeon-profile). For GPU intensive tasks like playing games, machine learning or rendering you can try setting the DPM to high instead.
Make sure you have a T2 kernel of version greater than 7.3.3 (you can check this with `uname -r`).

## Making the iGPU the primary display adapter

By default T2 Macs with hybrid graphics use the dGPU as primary display adapter, which in return requires the dGPU to be always powered on.
To save energy and reduce battery consumption, we can force the iGPU to be the primary display adapter and default graphics accelerator in a first step.

1. Configure apple-gmux to switch to the iGPU at boot

1. Create `/etc/modprobe.d/apple-gmux.conf` with the following contents:

```plain
# Enable the iGPU by default if present
options apple-gmux force_igd=y
```
1. Configure the MacBook to switch to the iGPU at boot.
1. You can use the **T2-Hybrid-gpu-control** app provided by KaiT2en: https://github.com/kaiT2en/KaiT2en-Fedora/tree/main/apps/t2-hybrid-gpu-control

2. Or alternatively, add kernel parameter `apple_gmux.force_igd=1`
2. Alternatively, you can use 0xbb's [gpu-switch](https://github.com/0xbb/gpu-switch#windows-810-usage) script.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link points to Windows bit. Have you copied pasted?


After reboot `glxinfo | grep "OpenGL renderer"` should show an Intel GPU. Running programs with `DRI_PRIME=1` will make them render on your AMD GPU. On Gnome, by right clicking an application you can choose to run it using dedicated graphics.

## Disabling the dGPU

We can take this a step further and save substantial amounts of energy by deactivating the discrete graphics card.

1. We will create a systemd unit that will use `vgaswitcheroo` to disable the discrete graphics card on boot. Enter the full codeblock below and execute it.

```plain
sudo tee /etc/systemd/system/amdgpu-off.service >/dev/null <<'EOF'
[Unit]
Description=Disable AMD dGPU via vgaswitcheroo
After=systemd-modules-load.service
Before=display-manager.service


[Service]
Type=oneshot
ExecStart=/bin/sh -c 'for i in $(seq 1 30); do [ -e /sys/kernel/debug/vgaswitcheroo/switch ] && exec sh -c "echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"; sleep 1; done; exit 1'

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable amdgpu-off.service
```

We can now run `sudo systemctl enable amdgpu-off.service` and reboot to disable our dGPU. This will decrease power draw on a MacBook significantly from around 20 to 9 Watts on idle using 50% display brightness, resulting in much longer battery life.
Enabling the dGPU again is done using `sudo systemctl disable amdgpu-off.service` and reboot. A more convenient solution using aliases is explained in the next step.

2. We can quickly disable, enable and check the current status of the dGPU by creating persistent aliases. Add the following lines to `~/.bashrc`:

```plain
alias dgpu-off='sudo systemctl enable amdgpu-off.service; sleep 2; sudo reboot'
alias dgpu-on='sudo systemctl disable amdgpu-off.service; sleep 2; sudo reboot'
alias dgpu-status='sudo cat /sys/kernel/debug/vgaswitcheroo/switch'
```

Start a new shell or run `source ~/.bashrc` to make the aliases available in the current shell.

From now on you can check the status of the dGPU by simply entering `dgpu-status` :

```plain
$ dgpu-status
0:DIS-Audio: :DynOff:0000:01:00.1
1:IGD:+:Pwr:0000:00:02.0
2:DIS: :Off:0000:01:00.0
```

`IGD` is the iGPU and `DIS` is the dGPU. The position of the `+` shows the GPU currently in use as the display adapter, while `Pwr` and `Off` refer to their respective power status.
Executing the aliases `dgpu-off` and `dgpu-on` will enable and disable our `amdgpu-off` systemd service and reboot the computer.

**Example:** Given the status above, executing `dgpu-on` will reboot your Mac. After reboot `dgpu-status` should be:
There is a significant performance decrease when gaming or rendering with `DRI_PRIME=1` and the iGPU set as the primary GPU, compared to using the dGPU as the primary GPU.

```plain
$ dgpu-status
0:DIS-Audio: :DynAuto:0000:01:00.1
1:IGD:+:Pwr:0000:00:02.0
2:DIS: :Pwr:0000:01:00.0
```
Also, there is no need to permanently disable the dGPU. With the new kernel, the dGPU automatically goes to sleep when not in use and wakes up when needed, such as when using `DRI_PRIME=1` or other applications that require it.
Comment thread
iurjscsi1101500 marked this conversation as resolved.
Resolved

### Suspend workaround

Expand Down
3 changes: 2 additions & 1 deletion docs/notable-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If there is someone missing that you think should be on this list, send a PR on
- JPyke3 (Manjaro) [https://github.com/JPyke3](https://github.com/JPyke3)
- marcosfad (Ubuntu) [https://github.com/marcosfad](https://github.com/marcosfad)
- MCMrARM (apple-bce driver) [https://github.com/MCMrARM](https://github.com/MCMrARM)
- André Eikmeyer (t2bce driver stack) [https://github.com/deqrocks](https://github.com/deqrocks)
- André Eikmeyer (t2bce driver stack, Apple GMUX for T2 macs) [https://github.com/deqrocks](https://github.com/deqrocks)
- mikeeq (Fedora) [https://github.com/mikeeq](https://github.com/mikeeq)
- networkException (Wiki maintenance and `mbpfan` fork for T2) [https://github.com/networkException](https://github.com/networkException)
- Redecorating (Arch Linux, Wiki maintenance, Apple GMUX for T2 Macs, Magic Backlight driver and improved the Touch Bar driver) [https://github.com/Redecorating](https://github.com/Redecorating)
Expand All @@ -23,3 +23,4 @@ If there is someone missing that you think should be on this list, send a PR on
- The Asahi Linux Contributors (Wi-Fi and Bluetooth) [https://asahilinux.org/](https://asahilinux.org/)
- lemmyg (Fine audio tuning for MacBook Pro 16 inch 2019) [https://github.com/lemmyg](https://github.com/lemmyg)
- slsrepo (t2archinstall for Arch Linux) [https://github.com/slsrepo/t2archinstall](https://github.com/slsrepo/t2archinstall)
- iurjscsi1101500 (Battery, RTC, Fans, Apple GMUX for T2 macs) [https://github.com/iurjscsi1101500](https://github.com/iurjscsi1101500)
6 changes: 3 additions & 3 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ While Linux is usable on all T2 models, some features are limited due to the lac
|Feature|Status|Upstream|Notes|Issues/links|
|-|-|-|-|-|
|Internal Drive / SSD|🟢 Working|🟢 Kernel 5.4||[Filesystem notes](#filesystem-notes)|
|Screen, iGPU|🟢 Working|🟡 Partial|||
|Screen, iGPU|🟢 Working|🟢 Yes|||
Comment thread
iurjscsi1101500 marked this conversation as resolved.
Resolved
|USB|🟢 Working|🟢 Yes|||
|Keyboard|🟢 Working|🔴 No||[t2bce](https://github.com/deqrocks/t2bce)|
|Trackpad|🟢 Working|🔴 No|Works, but isn't as great as on macOS (no force touch or palm rejection).|[t2bce](https://github.com/AdityaGarg8/t2bce), [Trackpad tuning](https://wiki.t2linux.org/#trackpad-tuning)|
Expand All @@ -16,9 +16,9 @@ While Linux is usable on all T2 models, some features are limited due to the lac
|Touch Bar|🟢 Working|🟡 Partial|"Touch Bar Keyboard" mode works OOTB, where only the Function Keys or the Media/Brightness Control Keys are shown. Touch Bar drivers were upstreamed in kernel 6.15, while the internal USB connection is provided by t2bce.|[t2bce](https://github.com/deqrocks/t2bce), [tiny-dfr](https://github.com/AsahiLinux/tiny-dfr)|
|Suspend|🟡 Partially working|🟢 Yes|t2bce handles suspend and resume of the BCE, VHCI, and audio stack. Remaining suspend issues are model-dependent and may involve other hardware.|[#53](https://github.com/t2linux/T2-Ubuntu-Kernel/issues/53)|
|Audio|🟢 Working|🔴 No|The internal microphone has low input volume without DSP. This is a hardware characteristic and cannot be compensated for in an upstream kernel driver.|[t2bce](https://github.com/deqrocks/t2bce)|
|Hybrid Graphics|🟡 Partially working|🟡 Partial|Toggling dGPU power doesn't work.|[Hybrid Graphics](https://wiki.t2linux.org/guides/hybrid-graphics/)|
|AMD GPUs|🟡 Partially working||Changing resolution, using DRI_PRIME and doing various other things can cause crashes, but `echo high \| sudo tee /sys/bus/pci/drivers/amdgpu/0000:??:??.?/power_dpm_force_performance_level` or adding `amdgpu.dpm=0` to the kernel commandline stops these crashes.||
Comment thread
AdityaGarg8 marked this conversation as resolved.
Resolved
|Hybrid Graphics|🟢 Working|🟡 Partial||[Hybrid Graphics](https://wiki.t2linux.org/guides/hybrid-graphics/)|
Comment thread
iurjscsi1101500 marked this conversation as resolved.
Resolved
|MacPro7,1|🟡 Partially working||Users have encountered PCIe Address Space issues, with auto remap breaking. A temporary solution may be possible by removing the Infinity Fabric Link (Bridge or Jumper) from the GPU(s).||
|iMac 5K support|🟡 Partially working|🔴 No|Users may experience screen tearing when using GNOME, XFCE, or Cinnamon. Additionally, Hyprland, Niri, and KDE Plasma cannot be used with 5K support.||
|T2 Secure Enclave|🟡 Partially working|🔴 No|Currently only those fingers enrolled in macOS can be used on Linux. You cannot enroll or delete new fingers on Linux.|[Kait2en Touch ID daemon](https://github.com/kaiT2en/KaiT2en-Fedora/tree/main/apps/t2-touchid)|
|T2 Audio Video Encoder|🔴 Not working||Used for Sidecar on macOS||

Expand Down