diff mbox series

[v3,19/29] platform/x86: ideapad-laptop: check for Fn-lock support in HALS

Message ID 20210203215403.290792-20-pobrn@protonmail.com (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: ideapad-laptop: cleanup, keyboard backlight and "always on USB charging" control support, reenable touchpad control | expand

Commit Message

Barnabás Pőcze Feb. 3, 2021, 9:56 p.m. UTC
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.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
diff mbox series

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 77a8e19441ed..549e220ae05b 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -58,7 +58,9 @@  enum {
 };
 
 enum {
-	HALS_FNLOCK_STATE_BIT = 10,
+	HALS_FNLOCK_SUPPORT_BIT  = 9,
+	HALS_FNLOCK_STATE_BIT    = 10,
+	HALS_HOTKEYS_PRIMARY_BIT = 11,
 };
 
 enum {
@@ -1293,8 +1295,12 @@  static void ideapad_check_features(struct ideapad_private *priv)
 	if (acpi_has_method(handle, "DYTC"))
 		priv->features.dytc = 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)