[PATCH 5/7] platform/x86: lenovo-ymc: Refresh posture on resume
From: Rong Zhang
Date: Sun Nov 15 2026 - 14:29:13 EST
When the device's posture is changed during suspend, the software
posture may become out of sync after resume.
Add a resume callback refreshing the posture and poke ideapad-laptop to
trigger the EC.
Reported-by: Mahir Faisal <mahirfaisalantiq33@xxxxxxxxx>
Closes: https://msgid.link/CAGAHqH62UiDKktoqg6cJ_oqj02NqH6FDjj32ucw7w+L2-_-NOg@xxxxxxxxxxxxxx
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
drivers/platform/x86/lenovo/ymc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/platform/x86/lenovo/ymc.c b/drivers/platform/x86/lenovo/ymc.c
index cb3ae49dfd9e..b2bb8ad9de0c 100644
--- a/drivers/platform/x86/lenovo/ymc.c
+++ b/drivers/platform/x86/lenovo/ymc.c
@@ -17,6 +17,7 @@
#include <linux/input/sparse-keymap.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
+#include <linux/pm.h>
#include <linux/wmi.h>
#include "ideapad-laptop.h"
#include "wmi-events.h"
@@ -118,6 +119,16 @@ static int lenovo_ymc_notify(struct notifier_block *nb, unsigned long action, vo
}
}
+static int lenovo_ymc_resume(struct device *dev)
+{
+ struct lenovo_ymc_private *priv = dev_get_drvdata(dev);
+
+ lenovo_ymc_refresh(priv, YMC_POSTURE_UNKNOWN);
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(lenovo_ymc_pm_ops, NULL, lenovo_ymc_resume);
+
static int lenovo_ymc_probe(struct wmi_device *wdev, const void *ctx)
{
struct lenovo_ymc_private *priv;
@@ -189,6 +200,7 @@ MODULE_DEVICE_TABLE(wmi, lenovo_ymc_wmi_id_table);
static struct wmi_driver lenovo_ymc_driver = {
.driver = {
.name = "lenovo-ymc",
+ .pm = pm_sleep_ptr(&lenovo_ymc_pm_ops),
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.id_table = lenovo_ymc_wmi_id_table,
--
2.55.0