Re: [PATCH v4 1/2] efi: Save Brightness using EFI on Macs

Aditya Garg
2026-03-17T09:53:12Z

On 3/17/26 15:08, Aditya Garg wrote:
>
>
>> On 16 Mar 2026, at 9:03 PM, Atharva Tiwari <atharvatiwarilinuxdev@gmail.com> wrote:
>>
>> Currently when a Mac reboots, the brightness is not the same
>> as the previous boot instead its the same as the last time the
>> Mac booted macOS.
>>
>> We can fix this issue by saving the brightness level to the efivar
>> backlight-level.
>>
>> (tested on iMac20,1)
>>
>> Suggested-by: Lukas Wunner <lukas@wunner.de>
>> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
>> ---
>> drivers/firmware/efi/Kconfig | 10 +++
>> drivers/firmware/efi/Makefile | 1 +
>> drivers/firmware/efi/apple-brightness.c | 67 +++++++++++++++++++
>> .../linux/platform_data/apple-brightness.h | 20 ++++++
>> 4 files changed, 98 insertions(+)
>> create mode 100644 drivers/firmware/efi/apple-brightness.c
>> create mode 100644 include/linux/platform_data/apple-brightness.h
>
> I tested this patch on a MacBookPro16,1, which is a T2 Intel Mac, and the behaviour is very weird:
>
> 1. macOS will never respect any brightness set by Linux
> 2. The Max brightness set by macOS is not the max brightness on Linux. I get these values on Linux:
>
> aditya@MacBook:~$ efivar -p -n '7c436110-ab2a-4bbb-a880-fe41995c9f82-backlight-level'
> GUID: 7c436110-ab2a-4bbb-a880-fe41995c9f82
> Name: "backlight-level"
> Attributes:
> Non-Volatile
> Boot Service Access
> Runtime Service Access
> Value:
> 00000000 f1 02 |.. |
>
> aditya@MacBook:~$ cat /sys/class/backlight/gmux_backlight/brightness
> 48238
>
> 3. I set the Max brightness on Linux, and restarted. I get this:
>
> aditya@MacBook:~$ efivar -p -n '7c436110-ab2a-4bbb-a880-fe41995c9f82-backlight-level'
> GUID: 7c436110-ab2a-4bbb-a880-fe41995c9f82
> Name: "backlight-level"
> Attributes:
> Non-Volatile
> Boot Service Access
> Runtime Service Access
> Value:
> 00000000 7a ff |z. |
>
> aditya@MacBook:~$ cat /sys/class/backlight/gmux_backlight/brightness
> 65402
>
>
> 4. Finally, any attempt to reduce the brightness seems worthless as unless booted back to macOS, Linux always boots at max brightness, but the nvram variable is changed successfully:
>
> aditya@MacBook:~$ efivar -p -n '7c436110-ab2a-4bbb-a880-fe41995c9f82-backlight-level'
> GUID: 7c436110-ab2a-4bbb-a880-fe41995c9f82
> Name: "backlight-level"
> Attributes:
> Non-Volatile
> Boot Service Access
> Runtime Service Access
> Value:
> 00000000 eb 41 |.A |
>
> aditya@MacBook:~$ cat /sys/class/backlight/gmux_backlight/brightness
> 65402
>
>
> Overall, it’s very inconsistent. Also, I’ve noticed Windows doesn't mess around with efivars, rather stores the brightness locally and implements it on every boot, something which systemd should do on Linux.
>
>

I've done another test as well:

1. I booted into macOS, and set a normal brightness, not too low, not
too high.
2. I booted back to Linux. The brightness was consistent. These are the
values:

aditya@MacBook:~$ efivar -p -n
'7c436110-ab2a-4bbb-a880-fe41995c9f82-backlight-level'
GUID: 7c436110-ab2a-4bbb-a880-fe41995c9f82
Name: "backlight-level"
Attributes:
Non-Volatile
Boot Service Access
Runtime Service Access
Value:
00000000 92 00 |..
|

aditya@MacBook:~$ cat /sys/class/backlight/gmux_backlight/brightness
7792

This is the journalctl of that boot: https://termbin.com/p0vf

3. I slightly modified the brightness and restarted. Upon a restart, the
brightness was max again:

aditya@MacBook:~$ efivar -p -n
'7c436110-ab2a-4bbb-a880-fe41995c9f82-backlight-level'
GUID: 7c436110-ab2a-4bbb-a880-fe41995c9f82
Name: "backlight-level"
Attributes:
Non-Volatile
Boot Service Access
Runtime Service Access
Value:
00000000 51 3a |Q:
|

aditya@MacBook:~$ cat /sys/class/backlight/gmux_backlight/brightness
63589

This is the journalctl of that boot: https://termbin.com/1z9r