Re: [PATCH v3] apple-gmux: preserve brightness using EFI

From: Lukas Wunner

Date: Wed Feb 11 2026 - 07:49:07 EST


On Wed, Feb 11, 2026 at 02:56:38PM +0530, Atharva Tiwari wrote:
> Make apple-gmux save the current backlight brightness to EFI on shutdown,
> so the brightness level is preserved across reboots.

This version moves the EFI handling back to the gmux driver. Why?

I found version 2 (which separated EFI handling into a separate component)
much better because it will allow other drivers such as i915 and amdgpu
to update the brightness if they're the ones driving the backlight,
instead of gmux.

> +static void gmux_shutdown(struct pnp_dev *pnp)
> +{
> + struct apple_gmux_data *gmux_data = pnp_get_drvdata(pnp);
> + u16 brightness = (u16)gmux_get_brightness(gmux_data->bdev);
> +
> +#ifdef CONFIG_EFI
> + if (gmux_data->efi_status == EFI_SUCCESS && gmux_data->efi_data != brightness) {
> + gmux_data->efi_status = efivar_set_variable(EFI_BRIGHTNESS_NAME,

Per section 21 of Documentation/process/coding-style.rst, #ifdef inside
functions should be avoided.

Thanks,

Lukas