Skip to content

Commit 2617317

Browse files
committed
platform/x86: intel-vbtn: Eval VBDL after registering our notifier
The VBDL ACPI method enables button/switch reporting through the intel-vbtn device. In some cases the embedded-controller (EC) might call Notify() on the intel-vbtn device immediately after the the VBDL call to make sure that the OS is synced with the EC's button and switch state. If we register our notify_handler after evaluating VBDL this means that we might miss the Notify() calls made by the EC to sync the state. E.g. the HP Stream x360 Convertible PC 11 has a VGBS method which always returns 0, independent of the actual SW_TABLET_MODE state of the device; and immediately after the VBDL call it calls Notify(0xCD) or Notify(0xCC) to report the actual state. Move the evaluation of VBDL to after registering our notify_handler so that we don't miss any events. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3a2f53c commit 2617317

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/platform/x86/intel-vbtn.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
189189
sparse_keymap_report_event(input_dev, event, val, autorelease);
190190
}
191191

192-
static bool intel_vbtn_has_buttons(acpi_handle handle)
193-
{
194-
acpi_status status;
195-
196-
status = acpi_evaluate_object(handle, "VBDL", NULL, NULL);
197-
return ACPI_SUCCESS(status);
198-
}
199-
200192
/*
201193
* There are several laptops (non 2-in-1) models out there which support VGBS,
202194
* but simply always return 0, which we translate to SW_TABLET_MODE=1. This in
@@ -271,7 +263,7 @@ static int intel_vbtn_probe(struct platform_device *device)
271263
acpi_status status;
272264
int err;
273265

274-
has_buttons = intel_vbtn_has_buttons(handle);
266+
has_buttons = acpi_has_method(handle, "VBDL");
275267
has_switches = intel_vbtn_has_switches(handle);
276268

277269
if (!has_buttons && !has_switches) {
@@ -300,6 +292,12 @@ static int intel_vbtn_probe(struct platform_device *device)
300292
if (ACPI_FAILURE(status))
301293
return -EBUSY;
302294

295+
if (has_buttons) {
296+
status = acpi_evaluate_object(handle, "VBDL", NULL, NULL);
297+
if (ACPI_FAILURE(status))
298+
dev_err(&device->dev, "Error VBDL failed with ACPI status %d\n", status);
299+
}
300+
303301
device_init_wakeup(&device->dev, true);
304302
/*
305303
* In order for system wakeup to work, the EC GPE has to be marked as

0 commit comments

Comments
 (0)