From: bugzilla-daemon@kernel.org
To: platform-driver-x86@vger.kernel.org
Subject: [Bug 222329] New: thinkpad_acpi: ThinkPad L590 returns previous threshold value when switching between BCTG and BCSG reads
Date: Thu, 26 Nov 2026 12:52:32 +0000 [thread overview]
Message-ID: <bug-222329-215701@https.bugzilla.kernel.org/> (raw)
https://bugzilla.kernel.org/show_bug.cgi?id=222329
Bug ID: 222329
Summary: thinkpad_acpi: ThinkPad L590 returns previous
threshold value when switching between BCTG and BCSG
reads
Product: Drivers
Version: 2.5
Kernel Version: 6.18.65
Hardware: Intel
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: Platform_x86
Assignee: drivers_platform_x86@kernel-bugs.osdl.org
Reporter: w.yizheng.self@gmail.com
Regression: No
Created attachment 311586
--> https://bugzilla.kernel.org/attachment.cgi?id=311586&action=edit
DSDT dump (ThinkPad L590, BIOS R0ZET60P 1.38)
Hi,
On a Lenovo ThinkPad L590, reading battery charge thresholds via thinkpad_acpi
sysfs attributes returns the *previous* query's result on the first read
whenever switching between start threshold (BCTG) and stop/end threshold
(BCSG).
A second consecutive read of the same attribute returns the actual value.
== System Information ==
- Model: Lenovo ThinkPad L590 (20Q8A0MLCD)
- DMI:
sys_vendor: LENOVO
product_name: 20Q8A0MLCD
product_version: ThinkPad L590
product_family: ThinkPad L590
bios_version: R0ZET60P (1.38 )
bios_date: 11/05/2025
ec_firmware_release: 1.18 (EC R0ZHT39W)
- Kernels tested:
- 6.18.65-1-lts (Arch Linux official LTS kernel)
- 7.3.6-zen1-1-zen
== Kernel Boot Log (6.18.65-1-lts) ==
Linux version 6.18.65-1-lts (linux-lts@archlinux) #1 SMP PREEMPT_DYNAMIC Mon,
23 Nov 2026 16:05:10 +0000
thinkpad_acpi: ThinkPad ACPI Extras v0.26
thinkpad_acpi: ThinkPad BIOS R0ZET60P (1.38 ), EC R0ZHT39W
thinkpad_acpi: Lenovo ThinkPad L590, model 20Q8A0MLCD
thinkpad_acpi: battery 1 registered (start 45, stop 60, behaviours: 0xb)
== Steps to Reproduce ==
With actual EC thresholds set to start=45, stop=60:
1. On 6.18.65-1-lts, reading start 3 times then end 3 times:
$ for f in charge_control_start_threshold charge_control_end_threshold; do
echo -n "$f: "
for i in 1 2 3; do echo -n "$(cat /sys/class/power_supply/BAT0/$f) ";
done
echo
done
charge_control_start_threshold: 45 45 45
charge_control_end_threshold: 45 60 60
2. Similarly, reading start after end returns 60 on the first read and 45 on
subsequent reads (60 45 45 45 45). Reading end then start once each in
alternation consistently returns swapped values (end=45, start=60).
3. This is not a timing race: inserting `sleep 2` between switching from start
to end (or vice versa) still returns the previous query's value on the first
read (45 then 60, and 60 then 45).
== Analysis ==
In the DSDT, both methods delegate to the same SMI wrapper:
- BCTG(Arg0) -> \PSIF(0x05, Arg0) -> SMI_(0x14, 0x05, 0x05, Arg0, 0x00)
- BCSG(Arg0) -> \PSIF(0x07, Arg0) -> SMI_(0x14, 0x05, 0x07, Arg0, 0x00)
The firmware appears to lag by one query when switching between BCTG and BCSG.
- `tpacpi_battery_add()` reports the right values at boot because it evaluates
BCTG twice (capability check + read) and BCSG twice.
- `upowerd` also reports the right values because libgudev reads each sysfs
file twice (`g_udev_device_has_sysfs_attr()` followed by
`g_udev_device_get_sysfs_attr_as_int_uncached()`).
- Userspace tools that read each sysfs attribute once in sequence (such as KDE
PowerDevil's `chargethresholdhelper`, which reads end then start once each)
consistently get swapped thresholds (end=45, start=60), causing KDE Settings
to clamp the stop threshold to 50% and risk writing wrong values back to EC.
== Potential Fix ==
A ThinkPad L590 quirk in `thinkpad_acpi` performing a dummy read (evaluating
BCTG/BCSG twice and returning the second result) in
`charge_control_{start,end}_threshold_show` (and legacy start/stop attributes)
would work around this firmware bug transparently for all userspace tools.
I am happy to test patches on this hardware if needed.
Thanks!
--
You are receiving this mail because:
You are watching the assignee of the bug.
reply other threads:[~2026-11-26 12:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=bug-222329-215701@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=platform-driver-x86@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