mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN
@ 2026-11-28 11:08 Rostislav Maksimenko
  2026-12-01  6:44 ` Dmitry Torokhov
  2026-12-01 11:32 ` Rostislav Maksimenko
  0 siblings, 2 replies; 3+ messages in thread
From: Rostislav Maksimenko @ 2026-11-28 11:08 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, stable, Rostislav Maksimenko

On the NEC VersaPro PC-VK22TGSCN the internal keyboard and the Elantech
touchpad intermittently fail to work at boot. atkbd reports:

  atkbd serio0: Failed to deactivate keyboard on isa0060/serio0
  atkbd serio0: Failed to enable keyboard on isa0060/serio0

and the AUX port is never registered, so the touchpad does not appear at
all. Both devices work in BIOS and in GRUB, and i8042 status reads are
fine (no "Can't read CTR" / "Reset failed"), so the EC-emulated PS/2
interface simply does not accept commands until it is reset.

The failure is frequent: 22 of the last 47 boots in my journal show it,
and in all 22 the AUX port is missing as well. Rebooting usually fixes
it, which matches the EC not being ready when i8042 initializes.

Booting with "i8042.reset" fixes both devices: the last 13 boots with
that parameter show no failure and a working AUX port, with no side
effects observed. Add a DMI quirk for the model I can test. Other
VersaPro models from the same era likely need the same quirk, but I have
no unit to confirm that.

Note that DMI_SYS_VENDOR "NEC" is already used in other kernel quirk
tables (drivers/acpi/battery.c), it was only missing from
i8042_dmi_quirk_table.

Cc: stable@vger.kernel.org
Signed-off-by: Rostislav Maksimenko <Maildeltachat1@yandex.ru>
---
 drivers/input/serio/i8042-acpipnpio.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index 1b1c5d4..3014376 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -962,6 +962,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
 		},
 		.driver_data = (void *)(SERIO_QUIRK_NOLOOP)
 	},
+	{
+		/* NEC VersaPro PC-VK22TGSCN */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "PC-VK22TGSCN"),
+		},
+		.driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS)
+	},
 	{
 		/* Medion MAM 2070 */
 		.matches = {
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN
  2026-11-28 11:08 [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN Rostislav Maksimenko
@ 2026-12-01  6:44 ` Dmitry Torokhov
  2026-12-01 11:32 ` Rostislav Maksimenko
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2026-12-01  6:44 UTC (permalink / raw)
  To: Rostislav Maksimenko; +Cc: linux-input, linux-kernel, stable

Hi Rostislav,

On Sat, Nov 28, 2026 at 02:08:10PM +0300, Rostislav Maksimenko wrote:
> On the NEC VersaPro PC-VK22TGSCN the internal keyboard and the Elantech
> touchpad intermittently fail to work at boot. atkbd reports:
>
>   atkbd serio0: Failed to deactivate keyboard on isa0060/serio0
>   atkbd serio0: Failed to enable keyboard on isa0060/serio0
>
> and the AUX port is never registered, so the touchpad does not appear at
> all. Both devices work in BIOS and in GRUB, and i8042 status reads are
> fine (no "Can't read CTR" / "Reset failed"), so the EC-emulated PS/2
> interface simply does not accept commands until it is reset.
>
> The failure is frequent: 22 of the last 47 boots in my journal show it,
> and in all 22 the AUX port is missing as well. Rebooting usually fixes
> it, which matches the EC not being ready when i8042 initializes.
>
> Booting with "i8042.reset" fixes both devices: the last 13 boots with
> that parameter show no failure and a working AUX port, with no side
> effects observed. Add a DMI quirk for the model I can test. Other
> VersaPro models from the same era likely need the same quirk, but I have
> no unit to confirm that.

Before applying this quirk, could you help check whether the EC actually
needs the controller selftest reset command (0xaa), or whether
"i8042.reset" just delays initialization enough to avoid a boot race
(for example with the EC finishing initialization or concurrent async
ACPI EC traffic such as the battery driver)?

Note that "i8042.probe_defer" would not distinguish the two here because
it only defers when reading CTR fails. Instead, if you have an external
keyboard or SSH access on a failed boot (without "i8042.reset"), could
you test whether simply rebinding i8042 later recovers both devices:

	echo i8042 > /sys/bus/platform/drivers/i8042/unbind
	echo i8042 > /sys/bus/platform/drivers/i8042/bind

Under the default reset mode, unbinding does not issue the controller
selftest, so if rebinding works that points to a timing issue rather
than a permanently wedged controller.

Could you also share dmesg with "i8042.debug=1" from both a failing boot
and a working "i8042.reset" boot (including the "PNP: PS/2 Controller"
line)? That will show where i8042_check_aux() fails and whether
i8042_controller_selftest() succeeds right away or has to retry.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN
  2026-11-28 11:08 [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN Rostislav Maksimenko
  2026-12-01  6:44 ` Dmitry Torokhov
@ 2026-12-01 11:32 ` Rostislav Maksimenko
  1 sibling, 0 replies; 3+ messages in thread
From: Rostislav Maksimenko @ 2026-12-01 11:32 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel

Hi Dmitry,

Thanks for taking a look. I ran the experiments you asked for. Short
version: it looks like a timing race, not a controller that needs the
0xaa selftest. Details and traces below.

> Before applying this quirk, could you help check whether the EC
> actually needs the controller selftest reset command (0xaa), or
> whether "i8042.reset" just delays initialization enough to avoid a
> boot race (for example with the EC finishing initialization or
> concurrent async ACPI EC traffic such as the battery driver)?

It is the delay, not the selftest. Two independent pieces of evidence:

1) Rebinding on a failed boot recovers both devices, and the bind
   path does not send 0xaa in default reset mode (i8042_reset !=
   ALWAYS). On a reset=0 boot where the keyboard had failed:

     echo i8042 > /sys/bus/platform/drivers/i8042/unbind
     echo i8042 > /sys/bus/platform/drivers/i8042/bind

   re-created both serio ports and both devices came back (AT
   keyboard registered, elantech touchpad re-queried and bound).
   So the controller accepts commands fine when probed later; it did
   not need 0xaa to un-wedge.

2) Pure delay without any reset also avoids the failure. Booting cold
   with "i8042.debug=1" but WITHOUT "i8042.reset" (debug only slows
   down early init via printk, it does not issue 0xaa): 10 cold boots
   (poweroff -> wait 30-60s -> power button), zero failures, same
   hardware, same cold power state.

On the battery/ACPI-traffic part of the hypothesis: in the failing
trace the AUX probe runs at ~0.586s, while ACPI battery registers
only at ~1.588s, i.e. after the probe. So concurrent battery traffic
is not the racer; it is the EC's own power-on initialization still
settling.

> Note that "i8042.probe_defer" would not distinguish the two here
> because it only defers when reading CTR fails. Instead, if you have
> an external keyboard or SSH access on a failed boot (without
> "i8042.reset"), could you test whether simply rebinding i8042 later
> recovers both devices: ... Under the default reset mode, unbinding
> does not issue the controller selftest, so if rebinding works that
> points to a timing issue rather than a permanently wedged
> controller.

Confirmed: rebinding works and recovers both devices (see 1 above),
which points to a timing issue, exactly as you predicted. The keyboard
even self-recovers without any rebind: "Failed to enable keyboard" at
1.2004s, then a burst of ACKs and a working keyboard by 1.418s. The
AUX port, however, is never created on a failing boot (only one serio
port exists at the end of the session), which matches i8042_check_aux()
giving up after a single attempt.

> Could you also share dmesg with "i8042.debug=1" from both a failing
> boot and a working "i8042.reset" boot (including the "PNP: PS/2
> Controller" line)? That will show where i8042_check_aux() fails and
> whether i8042_controller_selftest() succeeds right away or has to
> retry.

Both traces below. The PNP line is identical in the two and lists BOTH
ports, so the ACPI tables are fine and the failure is purely in probe
timing.

Failing boot (reset=0, debug=1):
  [    0.585218] i8042: PNP: PS/2 Controller [PNP0320:PS2K,PNP0f0e:PS2M] at 0x60,0x64 irq 1,12
  [    0.585326] i8042: [0] 65 <- i8042 (return)          (read CTR ok)
  [    0.586392] i8042: [0] d3 -> i8042 (command)         (AUX loopback)
  [    0.586863] i8042: [0] 5a -> i8042 (parameter)
  [    0.586870] i8042: [0]      -- i8042 (auxerr)        (loopback fails)
  [    0.587132] i8042: [0] a9 -> i8042 (command)         (AUX self-test)
  [    0.587140] i8042: [0] 69 <- i8042 (return)          (got 0x69, not 0x00)
  [    0.588675] serio: i8042 KBD port at 0x60,0x64 irq 1 (AUX port NOT created)
  [    1.200372] atkbd serio0: Failed to enable keyboard on isa0060/serio0
  [    1.418516] i8042: [208] fa <- i8042 (interrupt, 0, 1) (kbd recovers ~0.8s later)

The 0x69 returned to the AUX self-test is the same power-on scan code
this machine emits at boot ("Unknown key released ... code 0x69"),
which strongly suggests a stale byte from the not-yet-settled EC was
read as the AUX test result.

Working boot (reset=1, debug=1):
  [    0.593014] i8042: PNP: PS/2 Controller [PNP0320:PS2K,PNP0f0e:PS2M] at 0x60,0x64 irq 1,12
  [    0.593113] i8042: [0] aa -> i8042 (command)         (controller self-test)
  [    0.594307] i8042: [0] d3 -> i8042 (command)         (AUX loopback)
  [    0.597712] i8042: [1] d3 -> i8042 (command)         (retry)
  [    0.598609] i8042: [1] d3 -> i8042 (command)         (retry)
  [    0.599972] i8042: [1] d3 -> i8042 (command)         (retry)
  [    0.603168] serio: i8042 AUX port at 0x60,0x64 irq 12

So with reset the self-test is issued and the AUX loopback retries
until it passes; without reset the single AUX attempt reads the stale
0x69 and the port is abandoned.

Given all this, the reset quirk does fix it on this model. But if you
feel the correct fix is to give the AUX probe more time/retries rather
than a DMI reset quirk, I am happy to test an alternative and send a
v2.

For reference, without any parameter the failure rate is ~22 of the
last 47 recorded boots, and in every failing boot the AUX port is
missing as well.

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-28 11:08 [PATCH] Input: i8042 - add reset quirk for NEC VersaPro PC-VK22TGSCN Rostislav Maksimenko
2026-12-01  6:44 ` Dmitry Torokhov
2026-12-01 11:32 ` Rostislav Maksimenko

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®