diff mbox series

[v2] platform/x86: ideapad-laptop: Fix fn-lock LED on Yoga 14ITL5 laptops

Message ID 2655386.mvXUDI8C0e@wirelessprv-10-193-125-189.near.illinois.edu (mailing list archive)
State Accepted, archived
Headers show
Series [v2] platform/x86: ideapad-laptop: Fix fn-lock LED on Yoga 14ITL5 laptops | expand

Commit Message

Rawat, Arnav Nov. 14, 2022, 6:10 p.m. UTC
Subject: [PATCH v2] platform/x86: ideapad-laptop: Fix fn-lock LED on Yoga 
14ITL5 laptops
Date: Friday, November 11, 2022, 8:32:09 AM CST
From: Rawat, Arnav <arnavr3@illinois.edu>
To: Ike Panhc <ike.pan@canonical.com>, hdegoede@redhat.com 
<hdegoede@redhat.com>, markgross@kernel.org <markgross@kernel.org>
CC: Rawat, Arnav <arnavr3@illinois.edu>

From 90832a9a373570db2a62c3edf00cf129b59b0ba3 Mon Sep 17 00:00:00 2001
From: arawat <rawat.arnav@gmail.com>
Date: Thu, 10 Nov 2022 13:13:11 -0600
Subject: [PATCH v2] platform/x86: ideapad-laptop: Fix fn-lock LED on Yoga 
14ITL5
 laptops

The commit 3ae86d2d4704796ee658a34245cb86e68c40c5d7: Fix Legion 5 Fnlock LED
set the WMI id for the fn-lock event on some Legion 5 laptops. However,
the same WMI ID is also sent on some Yoga laptops. Here, setting the fn-lock
state is not valid behavior, and causes the ec to spam interrupts until the
laptop is rebooted, so include a check for this line of laptops.

Signed-off-by: Arnav Rawat <arnavr3@illinois.edu>
---
 drivers/platform/x86/ideapad-laptop.c | 14 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

 {
 	struct ideapad_private *priv = context;
@@ -1501,7 +1513,7 @@ static void ideapad_wmi_notify(u32 value, void *context)
 		ideapad_input_report(priv, value);
 		break;
 	case 208:
-		if (!eval_hals(priv->adev->handle, &result)) {
+		if (!eval_hals(priv->adev->handle, &result) && 
dmi_check_system(ideapad_fnesc_allow_list)) {
 			bool state = test_bit(HALS_FNLOCK_STATE_BIT, 
&result);
 
 			exec_sals(priv->adev->handle, state ? 
SALS_FNLOCK_ON : SALS_FNLOCK_OFF);
diff mbox series

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/
ideapad-laptop.c
index abd0c81d62c4..d1dcf57ce596 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -1491,6 +1492,17 @@  static void ideapad_acpi_notify(acpi_handle handle, u32 
event, void *data)
 }
 
 #if IS_ENABLED(CONFIG_ACPI_WMI)
+// Set fnesc state only on certain ideapads
+static const struct dmi_system_id ideapad_fnesc_allow_list[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Legion 
R7000P2020H"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "82GR")
+		}
+	}
+};
+
 static void ideapad_wmi_notify(u32 value, void *context)