All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Abel Vesa <abel.vesa@oss.qualcomm.com>
Cc: "Sebastian Reichel" <sre@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Abel Vesa" <abelvesa@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/3] platform: arm64: lenovo-thinkpad-t14s: Add Gen 7 EC support
Date: Wed, 11 Nov 2026 14:08:57 +0100	[thread overview]
Message-ID: <c4e4c30d-ebb6-42fa-b957-dcbfa10d3e5e@kernel.org> (raw)
In-Reply-To: <o55caq7vadrcc6ioc7n7aplbyh55n63mqgno6j2mgcksrjzb35@ptnencuakeo6>

Hi,

On 9-Nov-26 22:59, Abel Vesa wrote:
> On 26-11-09 15:52:16, Hans de Goede wrote:
>> Hi Abel,
>>
>> On 6-Nov-26 23:01, Abel Vesa wrote:
>>> The embedded controller of the ThinkPad T14s Gen 7 uses the same
>>> register layout and event codes as the Gen 6 one, but a different set
>>> of I2C commands. Going by the ACPI EC accessors in the Gen 7 firmware:
>>>
>>>   - register read:  write {0x80, reg}, then write {0x80} + read 1 byte
>>>   - register write: write {0x81, reg, val}
>>>   - event read:     write {0x84, 0x00}, then write {0x84} + read 1 byte
>>>> With the Gen 6 commands the EC never reports any event and the LED
>>> and keyboard backlight accesses have no effect.
>>
>> Thank you for working in this. I've been testing this and my own T14s gen7
>> and also I've taken a closer look at the DSDT leading to a bunch of
>> improvements. Instead of making these as suggested I've just gone ahead and
>> implemented these as fixup-s to be squashed into a v2 patch.
>>
>> For easier review by you I've split the improvements into 4 patches (attached):
>>
>> 1: Fix Fn-F12 not emitting a key-press + filter out some EC codes being reported
>> when pressing Fn + Fxx key combos which already send an I2C-HID kbd event.
>>
>> 2: Add Gen 7 suspend/resume handling
>>
>> 3: Cleanup: has_kbd_bl2_and_standby and mic_mute_led_generic checks are
>> really just checks for the original (gen6) support vs gen7 support
>> drop the bools and directly check which variant ec->variant points
>> at instead.
>> 4: Cleanup: has_kbd_bl2_and_standby and mic_mute_led_generic checks are
>> really just checks for the original (gen6) support vs gen7 support
>> drop the bools and directly check which variant ec->variant points
>> at instead.
>>
>>> Describe the bus accessors and event read per variant and add one for
>>> the Gen 7. The Gen 7 firmware does not use the second keyboard backlight
>>> register or the modern standby register, it drives the mic mute LED as a
>>> generic LED (id 0x0e) instead of a bit in the audio register and, when
>>> the keyboard backlight is cycled with Fn+Space, it also reports 3 for
>>> the high level, so handle those differences too. Also handle the Gen 7
>>> only events as known ones.
>>
>> So about these differences:
>>
>> 1: For the spk / mic mute LEDs, on a hunch I tried using std LED controls
>> with a LED idx/id of 15 for the spk mute LED and that also works.
>>
>> I did not find either way (REG_AUD vs REG_LED) for the spk mute LED in
>> the DSDT, instead the DSDT ends up sending an ACPI notify event, relying
>> on some windows driver to handle this.
>>
>> How did you find that REG_AUD still works, did you just try the gen 6
>> method ?
> 
> Yep, just tried the Gen 6 method and it worked. Nothing in the DSDT
> for it either.
> 
> Re-checked just now: the speaker mute led lights up both via REG_AUD bit 6
> and as generic led 15 via REG_LED. Since the mic mute led is already a generic
> led (0x0e) on Gen 7, I'm fine with moving the speaker mute one to 15 too,
> if you prefer. Otherwise I'll keep REG_AUD, since that path is shared with Gen 6.

I don't have a preference either way.

I tried both methods (REG_LED and REG_AUD) for the spkr mute LED and both
work. Which ever one is written last wins and gets to determine the actual
LED state.

This means that the spk-mute bit in REG_AUD may not actually reflect the LED
state, since it stays set when disabling the LED through REG_LED.

>> 2: For the kbd backlight, again the DSDT ends up sending an ACPI notify event
>> and does not access the EC itself at all.
>>
>> How did you find that T14S_EC_REG_KBD_BL1 also works on gen 7?
> 
> Same, tried the Gen 6 register and it worked. Writes change the level
> and reads follow the Fn+Space changes, which is how I noticed the extra
> level.
> 
>>
>> 3: For suspend/resume the DSDT does have modern-standby handling both
>> making the LEDS glow and setting some magic bit (which presumably makes
>> the EC use less power or maybe makes it send less wakeup events if we
>> were to make the EC IRQ a wakeup source) ?  This is implemented in
>> my second fixup patch.
> 
> Squashed it in, thanks. Haven't been able to verify this path on my
> unit though, suspend has some unrelated other issues. Will try tomorrow.
> 
>>
>> Regards,
>>
>> Hans
> 
> All four fixups are squashed into patch 2 for v2, with your
> Co-developed-by and Signed-off-by.

Thank you.

Regards,

Hans


  reply	other threads:[~2026-11-11 13:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 22:01 [PATCH 0/3] platform: arm64: lenovo-thinkpad-t14s: Add support for the Gen 7 EC Abel Vesa
2026-11-06 22:01 ` [PATCH 1/3] dt-bindings: embedded-controller: lenovo,thinkpad-t14s-ec: Add Gen 7 support Abel Vesa
2026-11-11 12:48   ` Krzysztof Kozlowski
2026-11-06 22:01 ` [PATCH 2/3] platform: arm64: lenovo-thinkpad-t14s: Add Gen 7 EC support Abel Vesa
2026-11-09 14:52   ` Hans de Goede
2026-11-09 15:14     ` Hans de Goede
2026-11-09 22:02       ` Abel Vesa
2026-11-09 21:59     ` Abel Vesa
2026-11-11 13:08       ` Hans de Goede [this message]
2026-11-06 22:01 ` [PATCH 3/3] arm64: dts: qcom: mahua-lenovo-thinkpad-t14s-gen7: Describe the Embedded Controller Abel Vesa
2026-11-09 10:19   ` Konrad Dybcio
2026-11-09 11:07     ` Abel Vesa

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=c4e4c30d-ebb6-42fa-b957-dcbfa10d3e5e@kernel.org \
    --to=hansg@kernel.org \
    --cc=abel.vesa@oss.qualcomm.com \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.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=sre@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.