public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
Cc: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] apple-gmux: preserve brightness using EFI
Date: Wed, 11 Feb 2026 13:48:33 +0100	[thread overview]
Message-ID: <aYx6ocvaFHunfP5f@wunner.de> (raw)
In-Reply-To: <20260211092640.3231-1-atharvatiwarilinuxdev@gmail.com>

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

  parent reply	other threads:[~2026-02-11 12:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11  9:26 [PATCH v3] apple-gmux: preserve brightness using EFI Atharva Tiwari
2026-02-11 12:01 ` Hans de Goede
2026-02-11 12:30   ` Atharva Tiwari
2026-02-11 12:32     ` Hans de Goede
2026-03-13 19:39       ` Atharva Tiwari
2026-03-14 20:06         ` Lukas Wunner
2026-02-11 12:48 ` Lukas Wunner [this message]
2026-03-14 22:45   ` Atharva Tiwari
2026-03-14 23:11     ` Armin Wolf
2026-03-15 22:08       ` Atharva Tiwari
2026-03-15 22:54         ` Armin Wolf
2026-03-16 15:37           ` Atharva Tiwari
2026-03-15 14:28     ` Lukas Wunner
2026-03-15 22:05       ` Atharva Tiwari
2026-02-11 17:03 ` kernel test robot

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=aYx6ocvaFHunfP5f@wunner.de \
    --to=lukas@wunner.de \
    --cc=atharvatiwarilinuxdev@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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