From: Rong Zhang <i@rong.moe>
To: Mahir Faisal <mahirfaisalantiq33@gmail.com>
Cc: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Ike Panhc" <ikepanhc@gmail.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Gergo Koteles" <soyer@irl.hu>,
"Andrew Kallmeyer" <kallmeyeras@gmail.com>,
"André Apitzsch" <git@apitzsch.eu>,
"Swapnil Devesh" <me@sidevesh.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: lenovo-ymc: Yoga 7 14IRL8 keyboard backlight stays on in tablet mode; EC expects VPC 0x2A with posture data
Date: Wed, 04 Nov 2026 01:01:39 +0800 [thread overview]
Message-ID: <527f9dbc20bf921f35108af60bbdebd2737698c4.camel@rong.moe> (raw)
In-Reply-To: <CAGAHqH6GmTamRzM7twRSJmOCMYmAJ+j25585P6UVeF1eROjYNw@mail.gmail.com>
Hi Mahir,
On Tue, 2026-11-03 at 12:55 +0600, Mahir Faisal wrote:
> Hello,
> It's been quite a while. Any updates on the issue? Just a reminder, I
> sent the required information you requested after testing it on my
> hardware. Good day.
Usually, it is normal to have a one-week delay before receiving a
response from LKML participants. Folks may be busy these days (me too).
Try not to be in a hurry.
As for the acpidump, I didn't find anything interesting, so we'd have to
rely on your and others' experiments.
>
> Thanks,
> Mahir
> (Resending in plain text mode as html text is not accepted. Sorry if
> you receive duplicates.)
>
> On Fri, Oct 30, 2026 at 3:32 AM Mahir Faisal
> <mahirfaisalantiq33@gmail.com> wrote:
> >
> > Subject: Re: lenovo-ymc: Yoga 7 14IRL8 keyboard backlight stays on in
> > tablet mode; EC expects VPC 0x2A with posture data
> >
> > Hi Rong,
> >
> > Thanks for looking into this. I ran each case on the 14IRL8 (82YL,
> > BIOS LHCN30WW) with my userspace daemon stopped. Commands were sent
> > through acpi_call as VPCW 0 <data>, VPCW 1 0x2a; the EC cleared VCMD
> > within ~10 ms every time. Keyboard/touchpad state was measured by
> > counting evdev events from the internal devices (AT Translated Set 2
> > keyboard, ELAN327E:00 04F3:327E Touchpad) during timed windows while
> > I typed and used the touchpad. Backlight state is by eye.
> >
> > One observation up front, because it affects how the commands should
> > be used: the commands set the keyboard/touchpad lock directly, but the
> > backlight only changes when the command agrees with the physical
> > posture (details under the 0x08/0x09 cases below).
> >
> > > What if:
> > >
> > > - 0x0A is not sent on start
> >
> > Not needed here. Fresh boot with nothing sent since power-on (the
> > previous shutdown had sent 0x0B): folding alone left the backlight on;
> > 0x08 while folded turned it off; unfolding plus 0x09 restored the
> > keyboard (19 presses counted) and the backlight at its previous level.
> >
> > > - 0x08/0x09 is sent after sending 0x0B
> >
> > Both still work. After 0x0B, folding alone did not turn the backlight
> > off, 0x08 while folded did, and unfolding plus 0x09 restored the
> > keyboard (34 presses) and the backlight.
> >
> > > - 0x0A/0x08/0x09/0x0B is repeatedly sent multiple times
> >
> > Harmless. 0x0A x3, then 0x08 x3 while folded, then 0x09 x3 after
> > unfolding (0.5 s apart) behaved the same as single commands: backlight
> > off while folded, keyboard working afterwards (18 presses), no flicker
> > or delay.
> >
> > > What if 0x0B is sent when the keyboard backlight is on?
> >
> > In laptop mode: nothing visible changes. The backlight stays on and the
> > keyboard keeps working (27 presses afterwards).
> >
> > While folded with the backlight already off after 0x08: the backlight
> > stays off and the keyboard stays disabled while folded (0 presses).
> > On unfolding, with no 0x09 sent, the keyboard (24 presses) and the
> > backlight came back on their own.
> >
> > > What if:
> > > - 0x08 is sent when unfolded
> >
> > The keyboard and touchpad are disabled in laptop mode (0 key presses,
> > 0 touchpad events over 10 s), but the backlight stays on. After one
> > 0x09 the touchpad and keyboard were back.
> >
> > > - 0x09 is sent when folded
> >
> > With the backlight off after 0x08, a 0x09 while still folded
> > re-enables the keyboard and touchpad (37 key presses and 3798
> > touchpad events while folded), but the backlight stays off.
> >
> > So on this EC, a driver that sends the wrong posture would lock the
> > internal keyboard and touchpad in laptop mode, while the backlight
> > depends on the physical posture as well. Sending 0x08/0x09 strictly
> > from the posture reported in the YMC event looks safe; 0x0A and
> > repeated commands are not needed but do no harm.
> >
> > I also tested unfolding after 0x08 without sending 0x09 (0x0A sent
> > before, no 0x0B). On unfolding, the backlight came back on, but the
> > keyboard and touchpad stayed disabled: 0 key presses and 0 touchpad
> > events over 10 s. They worked again after 0x0A + 0x09 (sent together,
> > so this run alone doesn't show which one was needed; in the other
> > tests 0x09 alone was enough).
> >
> > Compare the 0x0B-while-folded case above, where unfolding alone
> > restored the keyboard. So once 0x08 is sent, the EC keeps the input
> > lock until it gets 0x09; after 0x0B it follows the hinge again. For a
> > driver this suggests re-sending the current posture on resume (the
> > posture can change during suspend), and sending 0x0B on remove or
> > shutdown, so a missed 0x09 can't leave the internal keyboard locked
> > in laptop mode.
Let me conclude:
- the EC refreshes the backlight according to the physical posture, but
an 0x08/0x09 is needed to initiate the refresh
- 0x08 disables the touchpad and the keyboard
- 0x09 enables the touchpad and the keyboard
- 0x0a/0x0b doesn't matter
With the information, I should be able to prepare a patch. I would still
like to defer to others' opinions and experiments, though.
Thanks,
Rong
> >
> > > An acpidump would be helpful.
> >
> > The compressed dump is ~390 KB, so I'm sending it to you off-list
> > rather than to the lists. The MSDM table is stripped from it.
> >
> > Thanks,
> > Mahir
> >
> > On Thu, Oct 29, 2026 at 11:18 PM Rong Zhang <i@rong.moe> wrote:
> > >
> > > Hi Mahir,
> > >
> > > Thanks for the report.
> > >
> > > On Thu, 2026-10-29 at 03:21 +0600, Mahir Faisal wrote:
> > > > Hello,
> > > >
> > > > On a Lenovo Yoga 7 14IRL8 the keyboard backlight stays on when the
> > > > laptop is folded into tablet/tent/stand mode under Linux, while on
> > > > Windows it turns off. I traced the difference to a VPC command that
> > > > the Windows YMC service sends on every posture change and that Linux
> > > > does not send. Details below; I'd appreciate your view on whether
> > > > lenovo-ymc/ideapad-laptop should send it.
> > > >
> > > > System
> > > > ------
> > > > Model: Lenovo Yoga 7 14IRL8 (DMI product name: 82YL)
> > > > BIOS: LHCN30WW (latest)
> > > > Kernel: 7.2.11-300.fc45.x86_64 (Fedora)
> > > >
> > > > Symptom
> > > > -------
> > > > When folded, the EC disables the keyboard (no input reaches a VT) and
> > > > SW_TABLET_MODE is reported correctly by lenovo-ymc. The keyboard
> > > > backlight, however, stays at its previous level. Writes through
> > > > KBLC (via the ideapad-laptop kbd_backlight LED / UPower) are stored in
> > > > the EC (KBLS reads back the new value) but are not applied while
> > > > folded, so there is no way to turn the backlight off without
> > > > unfolding.
> > > >
> > > > The BIOS changelog suggests this is meant to be EC-driven. LHCN10WW,
> > > > "EC Notification":
> > > > "Fix the issue of keyboard backlight is on when turn on in notebook
> > > > mode and change NoteBook mode to Yoga mode."
> > > >
> > > > The DSDT contains no tablet-mode handling in KBLC, and _Q1B only does
> > > > Notify (WMIY, 0xD0). WMIY.WMAB just returns PCMD.
> > > >
> > > > What Windows does
> > > > -----------------
> > > > The "Lenovo Yoga Mode Control" package (YMC.exe 3.0.1.5, bound to
> > > > ACPI\YMC2017) sends IOCTL 0x831020C0 to \\.\EnergyDrv with a 12-byte
> > > > buffer {0x0C, 1, X}. EnergyDrv is AcpiVpc.sys from "Lenovo Energy
> > > > Management". Its handler for that IOCTL maps function 0x0C to VPC
> > > > command 0x2A (VPCCMD_W_YMC) and issues it through VPCW with X as the
> > > > data byte, using the same VDAT/VCMD sequence as write_ec_cmd().
> > > >
> > > > Values of X observed in YMC.exe:
> > > > 0x0A service start
> > > > 0x08 posture != laptop (tent/stand/tablet)
> > > > 0x09 posture == laptop
> > > > 0x0B service stop
> > >
> > > What if:
> > >
> > > - 0x0A is not sent on start
> > > - 0x08/0x09 is sent after sending 0x0B
> > > - 0x0A/0x08/0x09/0x0B is repeatedly sent multiple times
> > >
> > > >
> > > > Current Linux behaviour
> > > > -----------------------
> > > > ideapad_laptop_trigger_ec() sends VPCCMD_W_YMC with data 1, and only
> > > > for models in ymc_ec_trigger_quirk_dmi_table. Booting with
> > > > ideapad_laptop.ymc_ec_trigger=1 on this machine has no effect on the
> > > > backlight.
> > > >
> > > > Test
> > > > ----
> > > > Using acpi_call against \_SB.PC00.LPCB.H_EC.VPC0, with VPCW 0 <data>
> > > > followed by VPCW 1 0x2a, then polling VPCR 1 until 0:
> > > >
> > > > data 0x0A, then fold -> no change, backlight stays on
> > > > fold, then data 0x08 -> EC turns the keyboard backlight off
> > > > unfold, then data 0x09 -> keyboard and backlight work normally
> > >
> > > What if 0x0B is sent when the keyboard backlight is on?
> > >
> > > >
> > > > I'm currently running a small userspace daemon that sends 0x0A at
> > > > start, then 0x08/0x09 on each SW_TABLET_MODE change. It has worked
> > > > reliably so far.
> > >
> > > What if:
> > > - 0x08 is sent when unfolded
> > > - 0x09 is sent when folded
> > >
> > > >
> > > > Suggestion
> > > > ----------
> > > > On a YMC event, send VPCCMD_W_YMC with 0x08 when the reported posture
> > > > is anything other than laptop and 0x09 for laptop, instead of 1. This
> > > > might also be worth doing outside the quirk table, since it matches
> > > > what the Windows driver does on every model it supports. I can't tell
> > > > whether data 1 is still needed on the models already in the quirk
> > > > table (Yoga 7 14ARB7 / 14ACN6) for event re-arming, so someone with
> > > > that hardware would need to check.
> > >
> > > There is a chance that the 0x0A[start] => (0x08[fold] <=> 0x09[unfold])
> > > => 0x0B[stop] sequence is generic. Derek, Mark, could you confirm if the
> > > sequence exists in the documentation? If so, I think we can replace the
> > > quirk table and the module parameter with the standard sequence. I will
> > > prepare a patch once I get enough information.
> > >
> > > +CC Gergo, Andrew, André, Swapnil
> > >
> > > I believe the quirk was concluded by trial and error. Could you test if
> > > the above sequence works on your devices?
> > >
> > > >
> > > > I can provide an acpidump, the disassembly excerpts, or test patches
> > > > on this machine.
> > >
> > > An acpidump would be helpful.
> > >
> > > Thanks,
> > > Rong
> > >
> > > >
> > > > Disclosure: AI assistance was used to troubleshoot the issue and draft
> > > > this email.
> > > >
> > > > Thanks,
> > > > Mahir
next prev parent reply other threads:[~2026-11-03 17:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 21:21 Mahir Faisal
2026-10-29 17:13 ` Rong Zhang
2026-10-29 21:32 ` Mahir Faisal
2026-11-03 6:55 ` Mahir Faisal
2026-11-03 17:01 ` Rong Zhang [this message]
2026-11-11 18:13 ` Rong Zhang
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=527f9dbc20bf921f35108af60bbdebd2737698c4.camel@rong.moe \
--to=i@rong.moe \
--cc=derekjohn.clark@gmail.com \
--cc=git@apitzsch.eu \
--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=me@sidevesh.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®