Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: i8042 - Trust firmware a bit more when probing on X86

The error message "Can't read CTR while initializing i8042" appears on
Cherry Trail-based devices at each boot time:

i8042: PNP: No PS/2 controller found. Probing ports directly.
i8042: Can't read CTR while initializing i8042
i8042: probe of i8042 failed with error -5

This happens because we historically do not trust firmware on X86 and,
while noting that PNP does not show keyboard or mouse devices, we still
charge ahead and try to probe the controller. Let's relax this a bit and if
results of PNP probe agree with the results of platform
initialization/quirks conclude that there is, in fact, no i8042.

While at it, let's avoid using x86_platform.i8042_detect() and instead
abort execution early if platform indicates that it can not possibly have
i8042 (x86_platform.legacy.i8042 equals X86_LEGACY_I8042_PLATFORM_ABSENT).

Reported-and-tested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Cc: linux-input@vger.kernel.org
Link: http://lkml.kernel.org/r/1481317061-31486-3-git-send-email-dmitry.torokhov@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Dmitry Torokhov and committed by
Thomas Gleixner
d79e141c 93ffa9a4

+7 -3
+7 -3
drivers/input/serio/i8042-x86ia64io.h
··· 983 983 #if defined(__ia64__) 984 984 return -ENODEV; 985 985 #else 986 - pr_info("PNP: No PS/2 controller found. Probing ports directly.\n"); 986 + pr_info("PNP: No PS/2 controller found.\n"); 987 + if (x86_platform.legacy.i8042 != 988 + X86_LEGACY_I8042_EXPECTED_PRESENT) 989 + return -ENODEV; 990 + pr_info("Probing ports directly.\n"); 987 991 return 0; 988 992 #endif 989 993 } ··· 1074 1070 1075 1071 #ifdef CONFIG_X86 1076 1072 u8 a20_on = 0xdf; 1077 - /* Just return if pre-detection shows no i8042 controller exist */ 1078 - if (!x86_platform.i8042_detect()) 1073 + /* Just return if platform does not have i8042 controller */ 1074 + if (x86_platform.legacy.i8042 == X86_LEGACY_I8042_PLATFORM_ABSENT) 1079 1075 return -ENODEV; 1080 1076 #endif 1081 1077