From 7afe0115ff6f85703755fe9875d001b2fdb6a1d7 Mon Sep 17 00:00:00 2001 From: Jan Baisch Date: Wed, 12 Aug 2026 16:34:02 +0200 Subject: [PATCH] Input: soc_button_array: defer MSHW0040 probe until GPIO is ready MSHW0040 Surface devices use GPIO index 0 for the physical power button. On the Surface Pro 12 for Business Intel, soc_button_array can probe before the Panther Lake GPIO provider is ready. On affected boots, the GPIO lookups for the power and volume buttons return -EPROBE_DEFER. Reloading the unchanged soc_button_array driver after the GPIO provider has initialized makes the driver bind and all three buttons work. The generic button creation path deliberately ignores -EPROBE_DEFER because some Intel platforms expose virtual GPIO resources which never acquire a GPIO provider. Propagating that error from the generic path has previously caused severe deferred-probe loops on such systems. Instead, check the known real MSHW0040 power-button GPIO before creating any child devices and propagate only -EPROBE_DEFER. Keep all other lookup errors and the generic virtual-GPIO handling unchanged. This follows the direction already considered during the original MSHW0040 Surface button support discussion, while avoiding the generic error propagation that was later reverted. The Surface Pro 12 Intel provides a reliable reproducer with both CONFIG_INPUT_SOC_BUTTON_ARRAY and CONFIG_PINCTRL_INTEL_PLATFORM built as modules. Link: https://github.com/linux-surface/linux-surface/issues/2144#issuecomment-5226810584 Link: https://github.com/linux-surface/linux-surface/issues/61 Link: https://lore.kernel.org/all/20190516142523.117978-3-luzmaximilian@gmail.com/ Link: https://lore.kernel.org/all/65b265d2-f7a8-bcd7-e63f-f8efb7349324@gmail.com/ Signed-off-by: Jan Baisch Link: https://github.com/linux-surface/kernel/pull/172 Patchset: surface-button --- drivers/input/misc/soc_button_array.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index 43b5d56383e36..7abae4f3c8436 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -553,13 +553,27 @@ static int soc_device_check_MSHW0040(struct device *dev) { acpi_handle handle = ACPI_HANDLE(dev); bool exists; + int gpio, irq, error; // check if OEM platform revision DSM call exists exists = acpi_check_dsm(handle, &MSHW0040_DSM_UUID, MSHW0040_DSM_REVISION, BIT(MSHW0040_DSM_GET_OMPR)); + if (!exists) + return -ENODEV; - return exists ? 0 : -ENODEV; + /* + * Explicitly check if the GPIO controller is ready. The generic + * button creation path deliberately ignores -EPROBE_DEFER because + * some Intel platforms expose virtual GPIO resources which never + * acquire a GPIO provider. MSHW0040, however, is expected to have + * a real power-button GPIO at index 0. + */ + error = soc_button_lookup_gpio(dev, 0, &gpio, &irq); + if (error == -EPROBE_DEFER) + return error; + + return 0; } /*