[PATCH v5 0/3] platform: arm64: thinkpad-t14s-ec: new driver

Sebastian Reichel
2025-09-18T21:20:57Z

Introduce driver for the ThinkPad T14s Gen6 Snapdragon EC. In theory
it seems to be compatible with the ThinkPad ACPI driver, but these
devices are booted with device tree. As the name implies, the existing
ThinkPad ACPI driver only supports the ACPI interface. Looking at
the implementation, the ACPI DSDT contains many mapping functions
to translate the low level I2C messages into the interface used by
the ThinkPad ACPI driver. Adding DT support to the ThinkPad ACPI driver
would require adding all those translation functions, which would add
more or less the same amount of code as writing a separate driver using
the low level interface directly. I don't think it's sensible to make
the existing ACPI driver even more complicated, so I went for a separate
driver.

I managed to get system LEDs, audio LEDs, extra keys and the keyboard
backlight control working. The EC also seems to be used for some thermal
bits, which I haven't looked into deeply. As far as I understand most
thermal and fan control is handled by a different controller
(0x36@i2c5) anyways.

Apart from that the EC is involved in proper system suspend, which
is something I do not yet understand (I don't have any documentation
apart from the dis-assembled DSDT and existing ACPI driver). Right
now I disabled wake capabilities for the IRQ, since it would wake
up the system when closing the LID. Hopefully a way to mask specific
events will be found in the future.

Changes in v5:
- Link to v4: https://lore.kernel.org/r/20250909-thinkpad-t14s-ec-v4-0-caf6159daaee@collabora.com
- Change order of u8 buf[4] in a couple of places to be closer to for reverse Christmas order
- Drop thinkpad_ prefix from all symbols

Changes in v4:
- Link to v3: https://lore.kernel.org/r/20250906-thinkpad-t14s-ec-v3-0-3ce6ec21ae89@collabora.com
- Add thermal zone event IDs and handle them with a custom dev_dbg() message
- Use lower case letters in all hexadecimal numbers
- Improve comment when userspace does not choose blink timings
- Change logic to use == instead of != comparison for led cache check

Changes in v3:
- Link to v2: https://lore.kernel.org/r/20250905-thinkpad-t14s-ec-v2-0-7da5d70aa423@collabora.com
- Add <linux/container_of.h> include (Ilpo Järvinen)
- Add <linux/dev_printk.h> include (Ilpo Järvinen)
- Add <linux/interrupt.h> include (Ilpo Järvinen)
- Align CMD defines (Ilpo Järvinen)
- Rename thinkpad_t14s_led_set() to thinkpad_t14s_led_brightness_set() (Ilpo Järvinen)
- Replace && with & in thinkpad_t14s_audio_led_get(); good catch! (Konrad Dybcio)
- Use regmap_assign_bits in thinkpad_t14s_audio_led_set (Konrad Dybcio)
- Directly return input_register_device() at the end of
thinkpad_t14s_input_probe (Konrad Dybcio)
- Remove THINKPAD_ prefix (Konrad Dybcio)
- Also use T14S_EC_ prefix for LEDs states (myself)
- Collect Reviewed-by tags

Changes in v2:
- Link to v1: https://lore.kernel.org/r/20250831-thinkpad-t14s-ec-v1-0-6e06a07afe0f@collabora.com
- Apply Reviewed-by tags from Bryan O'Donoghue
- Apply Tested-by tags from Neil Armstrong
- Update DT binding description, location and examples (Krzysztof Kozlowski)
- Add missing wakeup-source to DT binding (Rob Herring Bot)
- Update DTS newlines, pinctrl order, nodename (Konrad Dybcio)
- Updates to EC driver
- Add bits.h and bitfield.h include (Ilpo Järvinen)
- Drop mutex.h (myself, leftover from development)
- Drop DEBUG define (Ilpo Järvinen)
- Add THINKPAD_T14S_EC_BLINK_RATE_ON_OFF_MS (Bryan O'Donoghue, Ilpo Järvinen)
- Add THINKPAD_T14S_EC_KEY_EVT_OFFSET (Ilpo Järvinen)
- Add THINKPAD_T14S_EC_KEY_ENTRY (myself, to keep line length sane
after THINKPAD_T14S_EC_KEY_EVT_OFFSET)
- Align values of thinkpad_t14s_ec_led_status_t (Ilpo Järvinen)
- Use u8 instead of char for I2C command buffers (Ilpo Järvinen)
- Add some more newlines after goto/return (Bryan O'Donoghue)
- Use FIELD_PREP/FIELD_GET instead of _SHIFT (Ilpo Järvinen)
- Explicitly map to LED_ON/LED_OFF in audio_led_get (Ilpo Järvinen)
- Add missing , after .driver.of_match_table (Ilpo Järvinen)
- Change from KEY_MODE to KEY_PERFORMANCE (myself after seeing a patch
for HID lenovo being sent to the list)

Signed-off-by: Sebastian Reichel <sre@kernel.org>
---
Sebastian Reichel (3):
dt-bindings: platform: Add Lenovo Thinkpad T14s EC
platform: arm64: thinkpad-t14s-ec: new driver
arm64: dts: qcom: x1e80100-t14s: add EC

.../lenovo,thinkpad-t14s-ec.yaml | 50 ++
MAINTAINERS | 6 +
.../dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtsi | 24 +
drivers/platform/arm64/Kconfig | 20 +
drivers/platform/arm64/Makefile | 1 +
drivers/platform/arm64/lenovo-thinkpad-t14s.c | 616 +++++++++++++++++++++
6 files changed, 717 insertions(+)
---
base-commit: f83ec76bf285bea5727f478a68b894f5543ca76e
change-id: 20250831-thinkpad-t14s-ec-ddeb23dbdafb

Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>