mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Robinson <alex@ironrobin.net>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Steev Klimaszewski <threeway@gmail.com>,
	platform-driver-x86@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 0/3] Lenovo ThinkPad X13s embedded controller support
Date: Mon, 28 Sep 2026 22:21:21 +0000	[thread overview]
Message-ID: <20260928222056.10044-1-alex@ironrobin.net> (raw)

Add support for the embedded controller found in the Lenovo ThinkPad X13s.

The X13s EC uses an I2C command transport similar to the ThinkPad T14s EC,
but its event, keyboard backlight, and power-management interfaces differ
enough to warrant a separate driver.

The EC event interrupt is provided by GPIO103. GPIO176 is a separate
host-controlled power-state signal used during low-power transitions. The
driver follows the EC command and GPIO sequencing described by the X13s
ACPI DSDT and defers EC event queries during suspend until the I2C
controller is available again on resume.

This initial series provides EC transport, power-management support, and
keyboard-backlight control. Other EC events have been left for follow-up
work rather than exposing unverified input mappings.

Disable EC wakeup by default, following the existing upstream ThinkPad
T14s EC driver policy. The EC interrupt multiplexes multiple events and
no selective X13s EC wake-event mask is currently known. In particular,
lid-close event 0x53 can wake the system, but the event type cannot be
determined until the system has resumed far enough to query the EC over
QUP8/I2C. Rather than attempting to filter an already-triggered wakeup,
disable EC wake broadly. Other EC events therefore cannot wake the system
by default either; another enabled wake source is needed. Feedback is
welcome if a selective X13s EC event-mask mechanism is known.

Normal runtime EC interrupts remain enabled. The low-power entry sequence
(0x80 <- 0x55, GPIO176 low), exit sequence (GPIO176 high, 10 ms delay,
0x80 <- 0xaa), deferred-event handling, and backlight behavior are unchanged
from v2. No speculative event filtering or EC register writes are added.

Retain wakeup-source in the DT node, binding, and example: it describes
hardware capability, not the driver's default wake policy. The I2C core
initializes wake capability and associates the IRQ before driver probe;
device_wakeup_disable() in probe disables policy without disabling normal
IRQ handling. Userspace can explicitly re-enable power/wakeup, with the
same risk of unwanted wakeups. This is a default-off policy, not a removal
of hardware wake capability.

This follows earlier X13s EC work by Konrad Dybcio and Steev Klimaszewski.

Development was assisted by an LLM, including analysis of the decompiled
X13s ACPI DSDT and review of the resulting implementation.

This series is based on Linux v7.3-rc4.

The v3 series was tested on a Lenovo ThinkPad X13s. With EC wake
disabled, runtime EC events continue to work and keyboard-backlight
state remains preserved across both manual s2idle and lid-triggered
suspend/resume. Closing the lid while the system is already suspended
does not wake it, while opening the lid still wakes the system through
the separate lid wake path. The QUP8 pin configuration was also
previously verified on hardware.

For v3, the package patches pass an application check and the driver
builds as an ARM64 module with W=1. Checkpatch reports no errors (only
the generic MAINTAINERS reminders; the series includes an entry).
A source comparison confirms that the only C changes from v2 are the
wakeup API include and the probe-time wake policy with its explanation.

Changes in v3:
- Disable EC system wakeup by default using device_wakeup_disable(), as
  in the upstream T14s EC driver, without disabling runtime IRQ handling.
- Explain why unknown selective event masking requires disabling EC wake
  broadly, and invite information about a selective X13s mechanism.
- Retain the DT wakeup-source capability description and all v2 low-power,
  deferred-event, and backlight behavior.
- Remove the Kconfig help text's claim of wake support.
- Verify on hardware that disabling EC wake prevents lid-close wake
  without breaking runtime EC events, lid-open wake, or backlight state
  restoration across suspend/resume.

Changes in v2:
- Make keyboard-backlight snapshot and EC power-management operations
  best-effort so EC failures do not prevent system suspend or resume.
- Save firmware-selected keyboard-backlight brightness in the EC on
  Fn+Space, following the DSDT's SCMS(0x20) operation.
- Save software-selected keyboard-backlight brightness in the EC so lid
  opening does not restore a stale setting.
- Restore the EC-saved keyboard-backlight brightness on lid open,
  following the DSDT's SCMS(0x21) operation.
- Process deferred EC events after the normal resume brightness restore
  so a lid-open restore takes precedence.
- Add the QUP8 pinctrl state for GPIO43 and GPIO44 using the configuration
  observed on the running hardware.
- Fix the placement and ordering of the i2c8 and EC pinctrl nodes.

Link: https://lore.kernel.org/all/20260925215358.33417-1-alex@ironrobin.net/

Alex Robinson (3):
  dt-bindings: embedded-controller: Add Lenovo ThinkPad X13s EC
  platform: arm64: Add Lenovo ThinkPad X13s EC driver
  arm64: dts: qcom: sc8280xp-x13s: Add embedded controller


             reply	other threads:[~2026-09-28 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 22:21 Alex Robinson [this message]
2026-09-28 22:21 ` [PATCH v3 1/3] dt-bindings: embedded-controller: Add Lenovo ThinkPad X13s EC Alex Robinson
2026-09-29  9:10   ` Krzysztof Kozlowski
2026-09-28 22:21 ` [PATCH v3 2/3] platform: arm64: Add Lenovo ThinkPad X13s EC driver Alex Robinson
2026-09-29  7:59   ` Ilpo Järvinen
2026-09-28 22:21 ` [PATCH v3 3/3] arm64: dts: qcom: sc8280xp-x13s: Add embedded controller Alex Robinson

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=20260928222056.10044-1-alex@ironrobin.net \
    --to=alex@ironrobin.net \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=threeway@gmail.com \
    /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®