[PATCH 1/2] platform/x86: ideapad-laptop: Fix FnLock not remembered among boots

Rong Zhang posted 2 patches 3 months ago
[PATCH 1/2] platform/x86: ideapad-laptop: Fix FnLock not remembered among boots
Posted by Rong Zhang 3 months ago
On devices supported by ideapad-laptop, the HW/FW can remember the
FnLock state among boots. However, since the introduction of the FnLock
LED class device, it is turned off while shutting down, as a side effect
of the LED class device unregistering sequence.

Many users always turn on FnLock because they use function keys much
more frequently than multimedia keys. The behavior change is
inconvenient for them. Thus, set LED_RETAIN_AT_SHUTDOWN on the LED class
device so that the FnLock state gets remembered, which also aligns with
the behavior of manufacturer utilities on Windows.

Fixes: 07f48f668fac ("platform/x86: ideapad-laptop: add FnLock LED class device")
Cc: stable@vger.kernel.org
Signed-off-by: Rong Zhang <i@rong.moe>
---
 drivers/platform/x86/ideapad-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index b5e4da6a6779..62a72b09fc3a 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1728,7 +1728,7 @@ static int ideapad_fn_lock_led_init(struct ideapad_private *priv)
 	priv->fn_lock.led.name                    = "platform::" LED_FUNCTION_FNLOCK;
 	priv->fn_lock.led.brightness_get          = ideapad_fn_lock_led_cdev_get;
 	priv->fn_lock.led.brightness_set_blocking = ideapad_fn_lock_led_cdev_set;
-	priv->fn_lock.led.flags                   = LED_BRIGHT_HW_CHANGED;
+	priv->fn_lock.led.flags                   = LED_BRIGHT_HW_CHANGED | LED_RETAIN_AT_SHUTDOWN;
 
 	err = led_classdev_register(&priv->platform_device->dev, &priv->fn_lock.led);
 	if (err)
-- 
2.50.0
Re: [PATCH 1/2] platform/x86: ideapad-laptop: Fix FnLock not remembered among boots
Posted by Hans de Goede 3 months ago
Hi,

On 7-Jul-25 6:38 PM, Rong Zhang wrote:
> On devices supported by ideapad-laptop, the HW/FW can remember the
> FnLock state among boots. However, since the introduction of the FnLock
> LED class device, it is turned off while shutting down, as a side effect
> of the LED class device unregistering sequence.
> 
> Many users always turn on FnLock because they use function keys much
> more frequently than multimedia keys. The behavior change is
> inconvenient for them. Thus, set LED_RETAIN_AT_SHUTDOWN on the LED class
> device so that the FnLock state gets remembered, which also aligns with
> the behavior of manufacturer utilities on Windows.
> 
> Fixes: 07f48f668fac ("platform/x86: ideapad-laptop: add FnLock LED class device")
> Cc: stable@vger.kernel.org
> Signed-off-by: Rong Zhang <i@rong.moe>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hansg@kernel.org>

Regards,

Hans




> ---
>  drivers/platform/x86/ideapad-laptop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index b5e4da6a6779..62a72b09fc3a 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -1728,7 +1728,7 @@ static int ideapad_fn_lock_led_init(struct ideapad_private *priv)
>  	priv->fn_lock.led.name                    = "platform::" LED_FUNCTION_FNLOCK;
>  	priv->fn_lock.led.brightness_get          = ideapad_fn_lock_led_cdev_get;
>  	priv->fn_lock.led.brightness_set_blocking = ideapad_fn_lock_led_cdev_set;
> -	priv->fn_lock.led.flags                   = LED_BRIGHT_HW_CHANGED;
> +	priv->fn_lock.led.flags                   = LED_BRIGHT_HW_CHANGED | LED_RETAIN_AT_SHUTDOWN;
>  
>  	err = led_classdev_register(&priv->platform_device->dev, &priv->fn_lock.led);
>  	if (err)