platform/arm64: Lenovo Yoga Slim 7x Gen 11 embedded controller
Subsystems (5)
v2 cover platform/arm64: Lenovo Yoga Slim 7x Gen 11 embedded controller
The Lenovo Yoga Slim 7x Gen 11 is a Qualcomm Snapdragon X2 Elite (glymur) laptop. It carries a Compal EF06 embedded controller on I2C at address 0x70, which is the only source on this machine for the board thermistors, the battery cell voltages, the fan tachometer, the keyboard backlight, and the mic-mute and airplane-mode keys.
Patch 1 documents the binding, patch 2 adds the driver.
Why this is not qcom-hamoa-ec
-----------------------------
The Snapdragon reference designs - glymur CRD, hamoa IoT EVK, Asus Zenbook A16 - place their embedded controller at 0x76, and drivers/platform/arm64/qcom-hamoa-ec.c drives those. This machine is
different: only 0x70 ACKs, and 0x76 is not populated at all. That is also why the firmware reports every host fan capability as unsupported, since profiles, trip points, LUTs and tachometer queries are all addressed to 0x76.
Binding qcom-hamoa-ec here does not work. It speaks a different command set (0x05/0x0e/0x42), appears to probe only because it never validates the firmware version it reads back, then reports zero fans and leaves the interrupt asserted at roughly 25 events/s indefinitely.
The ACPI tables describe both controllers: one at 0x76 (OperationRegion DVUM, fields FC20-FC2A) inherited from the reference design, and the one this driver targets at 0x70 (OperationRegion ERAM, battery and charger fields). Only the latter responds on this board.
Notes
-----
Fan speed is reported but not controlled, deliberately - the EC enforces no thermal floor over a manual setpoint. Patch 2 has the measurement.
The DT node for the controller is not part of this series; it lands with the board DTS, which is being upstreamed separately.
Tested on a Lenovo Yoga Slim 7x Gen 11 (DMI 83QR, "Yoga Slim 7 14Q8Y11").
Changes in v2:
- Patch 2: drop #include <linux/mod_devicetable.h>; <linux/i2c.h> already provides both of_device_id (via linux/of.h) and i2c_device_id (via linux/device-id/i2c.h), and the header is on its way out.
- Patch 2: add "depends on INPUT" to EC_LENOVO_YOGA_SLIM7X_GEN11; the driver registers an input device unconditionally, so a config with INPUT=n did not link.
- Patch 1: pick up Conor Dooley's Acked-by.
- Link to v1: https://lore.kernel.org/all/[email protected]/
Oleg Keri (2):
dt-bindings: embedded-controller: add Lenovo Yoga Slim 7x Gen 11 EC platform/arm64: add Lenovo Yoga Slim 7x Gen 11 EC driver
.../sysfs-driver-lenovo-yoga-slim7x-gen11-ec | 21 + .../lenovo,yoga-slim7x-gen11-ec.yaml | 56 ++ MAINTAINERS | 8 + drivers/platform/arm64/Kconfig | 23 + drivers/platform/arm64/Makefile | 1 + .../arm64/lenovo-yoga-slim7x-gen11-ec.c | 638 ++++++++++++++++++ 6 files changed, 747 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-lenovo-yoga-slim7x-gen11-ec create mode 100644 Documentation/devicetree/bindings/embedded-controller/lenovo,yoga-slim7x-gen11-ec.yaml create mode 100644 drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c
Signature · 4 lines
2.55.0 base-commit: df2908090cda368b01ff43709f51890076c56157
PATCH v2 1/2 dt-bindings: embedded-controller: add Lenovo Yoga Slim 7x Gen 11 EC
Document the Compal embedded controller found on the Lenovo Yoga Slim 7x Gen 11, a Qualcomm Snapdragon X2 Elite (glymur) laptop. It sits on I2C at address 0x70 and is distinct from the Qualcomm reference EC that the reference designs place at 0x76.
--- .../lenovo,yoga-slim7x-gen11-ec.yaml | 56 +++++++++++++++++++ MAINTAINERS | 8 +++ 2 files changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/embedded-controller/lenovo,yoga-slim7x-gen11-ec.yaml
Documentation/devicetree/bindings/embedded-controller/lenovo,yoga-slim7x-gen11-ec.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/embedded-controller/lenovo,yoga-slim7x-gen11-ec.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Lenovo Yoga Slim 7x Gen 11 Embedded Controller + +maintainers: + - Oleg Keri <[email protected]> + +description: + The Lenovo Yoga Slim 7x Gen 11, a Qualcomm Snapdragon X2 Elite (glymur) + laptop, has a Compal embedded controller on I2C. It reports board + thermistors, battery cell voltages and CPU fan speed, and drives the + keyboard backlight. + + This controller is not the Qualcomm reference EC that the Snapdragon + reference designs place at address 0x76; it speaks a different command + set and answers at 0x70. + +properties: + compatible: + const: lenovo,yoga-slim7x-gen11-ec + + reg: + const: 0x70 + + interrupts: + maxItems: 1 + description: + The controller pulses this line while it has events queued. + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + embedded-controller@70 { + compatible = "lenovo,yoga-slim7x-gen11-ec"; + reg = <0x70>; + + interrupts-extended = <&tlmm 66 IRQ_TYPE_EDGE_FALLING>; + }; + }; +...
MAINTAINERS +8 -0
@@ -14882,6 +14882,14 @@ S: Maintained F: Documentation/ABI/testing/sysfs-driver-lenovo-yb9-kbdock F: drivers/platform/x86/lenovo/yb9-kbdock.c +LENOVO YOGA SLIM 7X GEN 11 EMBEDDED CONTROLLER DRIVER +M: Oleg Keri <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/ABI/testing/sysfs-driver-lenovo-yoga-slim7x-gen11-ec +F: Documentation/devicetree/bindings/embedded-controller/lenovo,yoga-slim7x-gen11-ec.yaml +F: drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c + LETSKETCH HID TABLET DRIVER M: Hans de Goede <[email protected]> L: [email protected]
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v2 1/2] dt-bindings: embedded-controller: add Lenovo Yoga Slim 7x Gen 11 EC
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
Document the Compal embedded controller found on the Lenovo Yoga Slim 7x Gen 11, a Qualcomm Snapdragon X2 Elite (glymur) laptop. It sits on I2C at address
0x70and is distinct from the Qualcomm reference EC that the reference designs place at0x76.Signed-off-by Oleg Keri <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/2 platform/arm64: add Lenovo Yoga Slim 7x Gen 11 EC driver
In reply to Oleg KeriThe Lenovo Yoga Slim 7x Gen 11 (Qualcomm glymur / Snapdragon X2 Elite) carries a Compal EF06 embedded controller on I2C at address 0x70. The platform firmware describes it as an ACPI GenericSerialBus region, but the machine boots from device tree, so nothing otherwise talks to it.
Commands are exchanged with two raw I2C block transfers: a 7 byte write to register 0x02 carrying the command and up to six arguments, then a 6 byte read of register 0x01 for the result, with a short delay in between before the result register is valid.
Expose what the EC offers that the rest of the kernel does not already provide:
- five board thermistors as hwmon temperature channels. These are charger, CPU voltage regulator, 5 V rail and ambient sensors, not die sensors, and read considerably cooler than tsens
- the four battery cell voltages, which live in a banked mailbox shared with other EC activity; readings are validated against a signature and retried, and cached briefly so that all four channels come from one coherent sample
- CPU fan speed in RPM
- the keyboard backlight as an LED, off/low/high
- Fn-lock as a read/write sysfs attribute, matching the ideapad-laptop interface. The EC reports Fn+Esc as an event but keeps no state of its own, so the driver owns the bit and toggles it on the key
- the mic-mute and airplane-mode keys as KEY_MICMUTE and KEY_RFKILL. These reach the host only as EC events; they are not on the keyboard's HID interface and have no GPIO of their own
The EC signals pending events on a dedicated line, and keeps pulsing it until they are read - so the queue must be drained completely on every interrupt, including codes this driver ignores. Leaving one behind makes the controller pulse indefinitely.
Fan speed is reported but not controlled. The EC accepts a manual setpoint, however it enforces no thermal floor over it: with the fan pinned at roughly 2000 RPM under full load the SoC rose from 69 to 91 degrees in 30 seconds without the EC ever overriding. Exposing pwm1_enable or fan1_target would therefore let userspace overheat the machine, so neither is implemented.
Note this is the Gen 11 machine specifically. Its EC differs from the Qualcomm reference EC that the reference designs place at address 0x76, which is not populated here, and so EC_QCOM_HAMOA does not drive it.
--- .../sysfs-driver-lenovo-yoga-slim7x-gen11-ec | 21 + drivers/platform/arm64/Kconfig | 23 + drivers/platform/arm64/Makefile | 1 + .../arm64/lenovo-yoga-slim7x-gen11-ec.c | 638 ++++++++++++++++++ 4 files changed, 683 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-lenovo-yoga-slim7x-gen11-ec create mode 100644 drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c
Documentation/ABI/testing/sysfs-driver-lenovo-yoga-slim7x-gen11-ec new file +21 -0
@@ -0,0 +1,21 @@ +What: /sys/bus/i2c/devices/*/fn_lock +Date: August 2026 +KernelVersion: 7.3 +Contact: "Oleg Keri <[email protected]>" +Description: + Control fn-lock mode. + + * 1 -> Switched On + * 0 -> Switched Off + + When switched on, the function keys act as F1..F12 and the + multimedia functions require the Fn modifier. + + The embedded controller reports the Fn+Esc key as an event but + keeps no state of its own, so this attribute is the state: the + driver toggles it when the key is pressed, and writing it takes + effect immediately. + + For example:: + + # echo "0" > /sys/bus/i2c/devices/9-0070/fn_lock
drivers/platform/arm64/Kconfig +23 -0
@@ -90,6 +90,29 @@ config EC_LENOVO_THINKPAD_T14S Say M or Y here to include this support. +config EC_LENOVO_YOGA_SLIM7X_GEN11 + tristate "Lenovo Yoga Slim 7x Gen 11 Embedded Controller driver" + depends on ARCH_QCOM || COMPILE_TEST + depends on I2C + depends on INPUT + depends on HWMON + select NEW_LEDS + select LEDS_CLASS + help + Say Y here to enable the EC driver for the (Snapdragon X2 Elite, + glymur-based) Lenovo Yoga Slim 7x Gen 11 laptop. The EC provides + thermistors, battery cell voltages and CPU fan speed as hwmon + channels, and the keyboard backlight as an LED. + + This is the Gen 11 (glymur) machine specifically. Its EC is a Compal + design at i2c address 0x70 and speaks a different protocol from the + Qualcomm reference EC that the reference designs place at 0x76, so + EC_QCOM_HAMOA does not drive it - and conversely this driver does not + cover the X1E-based Yoga Slim 7x Gen 9. + + To compile this driver as a module, choose M here: the module will + be called lenovo-yoga-slim7x-gen11-ec. + config EC_QCOM_HAMOA tristate "Embedded Controller driver for Qualcomm Hamoa/Glymur reference devices" depends on ARCH_QCOM || COMPILE_TEST
drivers/platform/arm64/Makefile +1 -0
@@ -9,4 +9,5 @@ obj-$(CONFIG_EC_ACER_ASPIRE1) += acer-aspire1-ec.o obj-$(CONFIG_EC_HUAWEI_GAOKUN) += huawei-gaokun-ec.o obj-$(CONFIG_EC_LENOVO_YOGA_C630) += lenovo-yoga-c630.o obj-$(CONFIG_EC_LENOVO_THINKPAD_T14S) += lenovo-thinkpad-t14s.o +obj-$(CONFIG_EC_LENOVO_YOGA_SLIM7X_GEN11) += lenovo-yoga-slim7x-gen11-ec.o obj-$(CONFIG_EC_QCOM_HAMOA) += qcom-hamoa-ec.o
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c new file +638 -0
638 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v2 2/2] platform/arm64: add Lenovo Yoga Slim 7x Gen 11 EC driver
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The driver registers a hardware monitoring device directly from the platform subsystem instead…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The driver registers a hardware monitoring device directly from the platform subsystem instead of using an auxiliary device driver in drivers/hwmon/. --
commit e4cf7bc1c28af5add49d271e2e8e75723c9146db
Author: Oleg Keri <[email protected]>
platform/arm64: add Lenovo Yoga Slim 7x Gen 11 EC driver
This commit adds an embedded controller driver for the Lenovo Yoga Slim 7x Gen 11 laptop on the Snapdragon X2 Elite platform. It exposes hwmon channels for thermistors, battery cell voltages, and fan speed, as well as an LED for the keyboard backlight and hotkey input events.
Quoted 4 lines
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c new file +0
-0
[ ... ]
Quoted 2 lines
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c new file +2
-0+static int yoga_ec_probe (struct i2c_client *client) +{
[ ... ]
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c line 545
Quoted 4 lines
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c new file +4
-0+dev_dbg (dev,"thermistors present: %#lx\n" , ec->temp_present); + + hwmon =devm_hwmon_device_register_with_info (dev,"yoga_slim7x_ec" , ec, + &yoga_ec_chip_info,NULL );
[Severity: Medium]
Does this bypass the hwmon subsystem maintainer review and violate subsystem architectural layering rules by registering a hwmon device directly from a platform multi-function device driver?
The driver registers a hardware monitoring device directly from the platform subsystem. Should this hardware monitoring functionality be implemented as an auxiliary device driver residing in drivers/hwmon/ instead?
Quoted 4 lines
drivers/platform/arm64/lenovo-yoga-slim7x-gen11-ec.c new file +4
-0+if (IS_ERR (hwmon)) +return PTR_ERR (hwmon); + + ec->kbd_led.name ="platform::kbd_backlight" ;
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2