Skip to contentSkip to conversation

platform/x86: ideapad-laptop: check for Fn-lock support in HALS

PATCH Superseded Barnabás Pőcze 2 participants 2 messages Jan 13, 2021 – Jan 16, 2021 x86 platform drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 14/24 platform/x86: ideapad-laptop: check for Fn-lock support in HALS

Bit 9 in the return value of the HALS ACPI method is set if Fn-lock is supported. Change ideapad_check_features() to check it.

drivers/platform/x86/ideapad-laptop.c +8 -3
index 15d070b503dc..640a00cc3944 100644
@@ -56,7 +56,9 @@ enum {
 };
 
 enum {
-	HALS_FNLOCK_STATE_BIT = 10,
+	HALS_FNLOCK_SUPPORT_BIT  = 9,
+	HALS_FNLOCK_STATE_BIT    = 10,
+	HALS_HOTKEYS_PRIMARY_BIT = 11,
 };
 
 enum {
@@ -1023,8 +1025,11 @@ static void ideapad_check_features(struct ideapad_private *priv)
 	if (acpi_has_method(handle, "GBMD") && acpi_has_method(handle, "SBMC"))
 		priv->features.conservation_mode = true;
 
-	if (acpi_has_method(handle, "HALS") && acpi_has_method(handle, "SALS"))
-		priv->features.fn_lock = true;
+	if (acpi_has_method(handle, "HALS") && acpi_has_method(handle, "SALS")) {
+		if (!eval_hals(handle, &val))
+			if (test_bit(HALS_FNLOCK_SUPPORT_BIT, &val))
+				priv->features.fn_lock = true;
+	}
 }
 
 static int ideapad_acpi_add(struct platform_device *pdev)
Signature · 1 line
2.30.0
#1 lore raw
Quoted 3 lines · Barnabás Pőcze

Bit 9 in the return value of the HALS ACPI method is set if Fn-lock is supported. Change ideapad_check_features() to check it.

...

drivers/platform/x86/ideapad-laptop.c static void ideapad_check_features(struct ideapad_private *priv) · line 1031

Quoted 3 lines
drivers/platform/x86/ideapad-laptop.c +3 -0
+               if (!eval_hals(handle, &val))
+                       if (test_bit(HALS_FNLOCK_SUPPORT_BIT, &val))
+                               priv->features.fn_lock = true;

if (a) { if (b) { ... } } == if (a && b) { ... }

Signature · 2 lines
With Best Regards,
Andy Shevchenko