From 9b80b36c4af38c620a3dfcfc6ca61d3dcdb61286 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 9 Apr 2025 12:28:22 +0100 Subject: [PATCH] drivers/usb/bluetooth: Skip calling _ON when device is already enabled Add a check in the _ON method, similar to coreboot's ONSK handling in its RTD3 driver, to determine whether the enable GPIO is already asserted. This prevents the OS from repeatedly invoking _ON, which can happen because USB Bluetooth takes around 200ms to initialize after the GPIO is enabled. Change-Id: I424bc5f4c5b990fd5cb54daa3d6207828386c6f2 Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/87239 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/drivers/usb/acpi/intel_bluetooth.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/drivers/usb/acpi/intel_bluetooth.c b/src/drivers/usb/acpi/intel_bluetooth.c index 97fb4816f8..180320349b 100644 --- a/src/drivers/usb/acpi/intel_bluetooth.c +++ b/src/drivers/usb/acpi/intel_bluetooth.c @@ -110,6 +110,9 @@ void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, * } * Method (_ON, 0, NotSerialized) * { + * If ((\_SB.PCI0.GBTE() == 1)) + * Return (1) + * } * \_SB.PCI0.SBTE(1) * } * Method (_OFF, 0, NotSerialized) @@ -126,7 +129,7 @@ void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, * \_SB.PCI0.BTRK (One) * Sleep (RDLY) * Release (\_SB.PCI0.CNMT) - } + * } * } * } */ @@ -149,6 +152,16 @@ void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, acpigen_write_method("_ON", 0); { if (enable_gpio->pin_count) { + acpigen_write_store(); + acpigen_emit_namestring("\\_SB.PCI0.GBTE"); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_write_if_lequal_op_int(LOCAL0_OP, 1); + { + acpigen_write_return_integer(1); + } + acpigen_pop_len(); + acpigen_emit_namestring("\\_SB.PCI0.SBTE"); acpigen_emit_byte(1); }