From: Rong Zhang <i@rong.moe>
To: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Gergo Koteles" <soyer@irl.hu>, "Ike Panhc" <ikepanhc@gmail.com>,
"Andrew Kallmeyer" <kallmeyeras@gmail.com>
Cc: Eduard Aliman <edialiman20@gmail.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mahir Faisal <mahirfaisalantiq33@gmail.com>,
Rong Zhang <i@rong.moe>
Subject: [PATCH v3 5/8] platform/x86: lenovo-ymc: Refresh posture on resume
Date: Thu, 26 Nov 2026 02:08:23 +0800 [thread overview]
Message-ID: <20261126-ymc-82yl-v3-5-e30842671ec3@rong.moe> (raw)
In-Reply-To: <20261126-ymc-82yl-v3-0-e30842671ec3@rong.moe>
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@gmail.com>
Closes: https://msgid.link/CAGAHqH62UiDKktoqg6cJ_oqj02NqH6FDjj32ucw7w+L2-_-NOg@mail.gmail.com
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Eduard Aliman <edialiman20@gmail.com>
Signed-off-by: Rong Zhang <i@rong.moe>
---
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
next prev parent reply other threads:[~2026-11-25 18:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 18:08 [PATCH v3 0/8] platform/x86: ideapad-laptop: Trigger the EC on YMC events following Windows behavior Rong Zhang
2026-11-25 18:08 ` [PATCH v3 1/8] platform/x86: lenovo-ymc: Use enumeration to represent device posture Rong Zhang
2026-11-25 18:08 ` [PATCH v3 2/8] platform/x86: lenovo-ymc: Serialize WMI event handling Rong Zhang
2026-11-25 18:08 ` [PATCH v3 3/8] platform/x86: lenovo-wmi-events: Modernize " Rong Zhang
2026-11-25 18:08 ` [PATCH v3 4/8] platform/x86: lenovo-ymc: Modernize WMI driver and factor out events Rong Zhang
2026-11-25 18:08 ` Rong Zhang [this message]
2026-11-25 18:08 ` [PATCH v3 6/8] platform/x86: ideapad-laptop: Trigger the EC on YMC events following Windows behavior Rong Zhang
2026-11-25 18:08 ` [PATCH v3 7/8] platform/x86: ideapad-laptop: Enable ymc_ec_trigger for Lenovo Yoga 7 14IRL8 Rong Zhang
2026-11-25 18:08 ` [PATCH v3 8/8] platform/x86: ideapad-laptop: Enable ymc_ec_trigger for Lenovo Yoga 7 14ARP8 Rong Zhang
2026-11-25 19:14 ` [PATCH v3 0/8] platform/x86: ideapad-laptop: Trigger the EC on YMC events following Windows behavior Eduard Aliman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126-ymc-82yl-v3-5-e30842671ec3@rong.moe \
--to=i@rong.moe \
--cc=derekjohn.clark@gmail.com \
--cc=edialiman20@gmail.com \
--cc=hansg@kernel.org \
--cc=ikepanhc@gmail.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kallmeyeras@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mahirfaisalantiq33@gmail.com \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=soyer@irl.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®