mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
Cc: "Lukas Wunner" <lukas@wunner.de>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v4 1/2] efi: Save Brightness using EFI on Macs
Date: Tue, 17 Mar 2026 15:22:58 +0530	[thread overview]
Message-ID: <MAUPR01MB11546F8AAA79A199DC1523C0EB841A@MAUPR01MB11546.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <9FF2FDB9-17D4-4B01-A872-F26BFF74C5CC@live.com>



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


  reply	other threads:[~2026-03-17  9:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 15:33 [PATCH v4 0/2] Save Brightness " Atharva Tiwari
2026-03-16 15:33 ` [PATCH v4 1/2] efi: Save Brightness using EFI " Atharva Tiwari
2026-03-17  9:39   ` Aditya Garg
2026-03-17  9:52     ` Aditya Garg [this message]
2026-05-21 12:29   ` Ilpo Järvinen
2026-03-16 15:33 ` [PATCH v4 2/2] platform/apple-gmux: use apple_brightness to save brightness to EFI Atharva Tiwari
2026-05-21 12:43   ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MAUPR01MB11546F8AAA79A199DC1523C0EB841A@MAUPR01MB11546.INDPRD01.PROD.OUTLOOK.COM \
    --to=gargaditya08@live.com \
    --cc=ardb@kernel.org \
    --cc=atharvatiwarilinuxdev@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®