Skip to content

Commit 7febef5

Browse files
author
Jan Baisch
committed
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: linux-surface/linux-surface#2144 (comment) Link: linux-surface/linux-surface#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 <jan.baisch@protonmail.com>
1 parent 7d3b315 commit 7febef5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

drivers/input/misc/soc_button_array.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,27 @@ static int soc_device_check_MSHW0040(struct device *dev)
553553
{
554554
acpi_handle handle = ACPI_HANDLE(dev);
555555
bool exists;
556+
int gpio, irq, error;
556557

557558
// check if OEM platform revision DSM call exists
558559
exists = acpi_check_dsm(handle, &MSHW0040_DSM_UUID,
559560
MSHW0040_DSM_REVISION,
560561
BIT(MSHW0040_DSM_GET_OMPR));
562+
if (!exists)
563+
return -ENODEV;
561564

562-
return exists ? 0 : -ENODEV;
565+
/*
566+
* Explicitly check if the GPIO controller is ready. The generic
567+
* button creation path deliberately ignores -EPROBE_DEFER because
568+
* some Intel platforms expose virtual GPIO resources which never
569+
* acquire a GPIO provider. MSHW0040, however, is expected to have
570+
* a real power-button GPIO at index 0.
571+
*/
572+
error = soc_button_lookup_gpio(dev, 0, &gpio, &irq);
573+
if (error == -EPROBE_DEFER)
574+
return error;
575+
576+
return 0;
563577
}
564578

565579
/*

0 commit comments

Comments
 (0)