mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	 stable@vger.kernel.org
Subject: [PATCH v3 0/8] platform/x86: ideapad-laptop: Trigger the EC on YMC events following Windows behavior
Date: Thu, 26 Nov 2026 02:08:18 +0800	[thread overview]
Message-ID: <20261126-ymc-82yl-v3-0-e30842671ec3@rong.moe> (raw)

Currently, the ideapad-laptop driver triggers the EC with YMC command
0x01, which is necessary for existing devices in the DMI quirk table to
clear the pending event to allow further events to be emitted.

Newer models do not require command 0x01 anymore (writing it is a
no-op), but some of them require other commands to properly synchronize
and set the hardware state.

It turned out that Lenovo's YMC driver for Windows (YMC.exe) writes YMC
command 0x08/0x09 on fold/unfold YMC events, in which "unfold" means
laptop mode and "fold" means other modes.

Adopt the said sequence and combine it with command 0x01 to make
ymc_ec_trigger work on all relevant devices. For the sake of caution,
write command 0x08 only for the known fold postures. For all other
postures (including unknown ones), write 0x09 to make sure the touchpad
and keyboard are still functional. Finally, 0x01 is always written to
ensure the pending event is cleared.

Beforehand, also fix pre-existing issues, modernize relevant WMI
drivers, and add a resume callback refreshing the posture and poke
ideapad-laptop to trigger the EC. See each patch for details.

With these changes, add DMI quirk table entries for the Lenovo Yoga 7
14IRL8 and 14ARP8 as their EC must be triggered by software on YMC
events with command 0x08/0x09, or else the enable states of touchpad,
keyboard, and keyboard backlight become out of sync.

Reported-by: Mahir Faisal <mahirfaisalantiq33@gmail.com>
Closes: https://msgid.link/CAGAHqH6o0TUa1HXMrNV6e+HNYwU3xxHkOM665756n8Cp3AzhVQ@mail.gmail.com
Reported-by: Eduard Aliman <edialiman20@gmail.com>
Closes: https://msgid.link/CAA4HgYKab7_GMCNdHF9+E=9ECVBHRs_axefeCOnZbUNUoyVSoQ@mail.gmail.co
Signed-off-by: Rong Zhang <i@rong.moe>
---
Changes in v3:
- Always write YMC command 0x01 at last (thanks Gergo Koteles)
- New patch to address Eduard Aliman's report
- Drop Eduard Aliman's Tested-by: since PATCH 6, please test again
- Link to v2: https://patch.msgid.link/20261125-ymc-82yl-v2-0-624bdcb3c50e@rong.moe

Changes in v2:
- Rephrase the commit message of PATCH 6 (thanks Mark Pearson)
- Fix typos (ditto)
- Link to v1: https://patch.msgid.link/20261116-ymc-82yl-v1-0-fac1a2b01a84@rong.moe

---
Rong Zhang (8):
      platform/x86: lenovo-ymc: Use enumeration to represent device posture
      platform/x86: lenovo-ymc: Serialize WMI event handling
      platform/x86: lenovo-wmi-events: Modernize WMI event handling
      platform/x86: lenovo-ymc: Modernize WMI driver and factor out events
      platform/x86: lenovo-ymc: Refresh posture on resume
      platform/x86: ideapad-laptop: Trigger the EC on YMC events following Windows behavior
      platform/x86: ideapad-laptop: Enable ymc_ec_trigger for Lenovo Yoga 7 14IRL8
      platform/x86: ideapad-laptop: Enable ymc_ec_trigger for Lenovo Yoga 7 14ARP8

 drivers/platform/x86/lenovo/Kconfig          |   2 +
 drivers/platform/x86/lenovo/ideapad-laptop.c |  74 +++++++++++++++--
 drivers/platform/x86/lenovo/ideapad-laptop.h |   9 ++
 drivers/platform/x86/lenovo/wmi-events.c     |  38 +++++----
 drivers/platform/x86/lenovo/wmi-events.h     |   1 +
 drivers/platform/x86/lenovo/ymc.c            | 118 +++++++++++++++++----------
 6 files changed, 175 insertions(+), 67 deletions(-)
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 46a18a06-ymc-82yl-d59b4f8f891e

Thanks,
Rong


             reply	other threads:[~2026-11-25 18:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 18:08 Rong Zhang [this message]
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 ` [PATCH v3 5/8] platform/x86: lenovo-ymc: Refresh posture on resume Rong Zhang
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-0-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 \
    --cc=stable@vger.kernel.org \
    /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®