Skip to content

Commit 435ecfa

Browse files
committed
AOSCOS: platform: x86: ideapad-laptop: add fixes for ThinkBook 14+ (2024 G6+)
This is a patch taken from ideapad-laptop-tb2024g6plus in an attempt to incorporate these changes in the mainline kernel. This patch fixes the following issues: - Laptop shuts down unexpectedly after closing the lid. - The Fn-F5 combination shuts down or resets AMD models. - Keyboard backlight status resets after waking up from S3 suspend. Signed-off-by: Terry <[email protected]> Link: https://github.com/ty2/ideapad-laptop-tb2024g6plus/blob/6d934407981294d05a6a4e4ed0e59d3c6c964990/ideapad-laptop.patch Signed-off-by: Kexy Biscuit <[email protected]> [Mingcong Bai: Resolved minor conflicts in drivers/platform/x86/ideapad-laptop.c and reverted a scoped_guard() refactor. Also include a fix for bad if branch syntax.] Signed-off-by: Mingcong Bai <[email protected]>
1 parent b099f4c commit 435ecfa

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

drivers/platform/x86/ideapad-laptop.c

+24-3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ struct ideapad_private {
152152
struct led_classdev led;
153153
unsigned int last_brightness;
154154
} kbd_bl;
155+
bool suspended;
155156
};
156157

157158
static bool no_bt_rfkill;
@@ -1101,6 +1102,8 @@ static const struct key_entry ideapad_keymap[] = {
11011102
{ KE_KEY, 0x27 | IDEAPAD_WMI_KEY, { KEY_HELP } },
11021103
/* Refresh Rate Toggle */
11031104
{ KE_KEY, 0x0a | IDEAPAD_WMI_KEY, { KEY_DISPLAYTOGGLE } },
1105+
/* Touchpad Toggle */
1106+
{ KE_KEY, 0x29 | IDEAPAD_WMI_KEY, { KEY_TOUCHPAD_TOGGLE } },
11041107

11051108
{ KE_END },
11061109
};
@@ -1503,6 +1506,14 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
15031506
struct ideapad_private *priv = data;
15041507
unsigned long vpc1, vpc2, bit;
15051508

1509+
if (!data) {
1510+
acpi_handle_info(handle, "no data");
1511+
return;
1512+
}
1513+
1514+
if (priv->suspended)
1515+
return;
1516+
15061517
if (read_ec_data(handle, VPCCMD_R_VPC1, &vpc1))
15071518
return;
15081519

@@ -1548,6 +1559,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
15481559
ideapad_backlight_notify_power(priv);
15491560
break;
15501561
case KBD_BL_KBLC_CHANGED_EVENT:
1562+
case 0:
15511563
case 1:
15521564
/*
15531565
* Some IdeaPads report event 1 every ~20
@@ -1557,8 +1569,6 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
15571569
* backlight has changed.
15581570
*/
15591571
ideapad_kbd_bl_notify(priv);
1560-
break;
1561-
case 0:
15621572
ideapad_check_special_buttons(priv);
15631573
break;
15641574
default:
@@ -1757,6 +1767,8 @@ static const struct wmi_device_id ideapad_wmi_ids[] = {
17571767
{ "26CAB2E5-5CF1-46AE-AAC3-4A12B6BA50E6", &ideapad_wmi_context_esc }, /* Yoga 3 */
17581768
{ "56322276-8493-4CE8-A783-98C991274F5E", &ideapad_wmi_context_esc }, /* Yoga 700 */
17591769
{ "8FC0DE0C-B4E4-43FD-B0F3-8871711C1294", &ideapad_wmi_context_fn_keys }, /* Legion 5 */
1770+
{ "46f16367-fb9d-11ee-a4f6-40c2ba4a5625", &ideapad_wmi_context_esc }, /* ThinkBook 16+ 2024 IMH */
1771+
{ "077c4a1f-e344-11ee-a4f6-40c2ba413e67", &ideapad_wmi_context_esc }, /* ThinkBook 2024 AMD */
17601772
{},
17611773
};
17621774
MODULE_DEVICE_TABLE(wmi, ideapad_wmi_ids);
@@ -1929,10 +1941,19 @@ static int ideapad_acpi_resume(struct device *dev)
19291941
if (priv->dytc)
19301942
dytc_profile_refresh(priv);
19311943

1944+
priv->suspended = false;
1945+
1946+
return 0;
1947+
}
1948+
1949+
static int ideapad_acpi_suspended(struct device *dev)
1950+
{
1951+
struct ideapad_private *priv = dev_get_drvdata(dev);
1952+
priv->suspended = true;
19321953
return 0;
19331954
}
19341955
#endif
1935-
static SIMPLE_DEV_PM_OPS(ideapad_pm, NULL, ideapad_acpi_resume);
1956+
static SIMPLE_DEV_PM_OPS(ideapad_pm, ideapad_acpi_suspended, ideapad_acpi_resume);
19361957

19371958
static const struct acpi_device_id ideapad_device_ids[] = {
19381959
{"VPC2004", 0},

0 commit comments

Comments
 (0)