diff mbox series

ACPI / x86: Add ACPI_QUIRK_UART1_SKIP for Lenovo Yoga Book yb1-x90f/l

Message ID 20230429163458.73479-1-hdegoede@redhat.com
State Accepted
Commit f91280f35895d6dcb53f504968fafd1da0b00397
Headers show
Series ACPI / x86: Add ACPI_QUIRK_UART1_SKIP for Lenovo Yoga Book yb1-x90f/l | expand

Commit Message

Hans de Goede April 29, 2023, 4:34 p.m. UTC
The Lenovo Yoga Book yb1-x90f/l 2-in-1 which ships with Android as
Factory OS has (another) bug in its DSDT where the UART resource for
the BTH0 ACPI device contains "\\_SB.PCIO.URT1" as path to the UART.

Note that is with a letter 'O' instead of the number '0' which is wrong.

This causes Linux to instantiate a standard /dev/ttyS? device for
the UART instead of a /sys/bus/serial device, which in turn causes
bluetooth to not work.

Similar DSDT bugs have been encountered before and to work around those
the acpi_quirk_skip_serdev_enumeration() helper exists.

Previous devices had the broken resource pointing to the first UART, while
the BT HCI was on the second UART, which ACPI_QUIRK_UART1_TTY_UART2_SKIP
deals with. Add a new ACPI_QUIRK_UART1_SKIP quirk for skipping enumeration
of UART1 instead for the Yoga Book case and add this quirk to the
existing DMI quirk table entry for the yb1-x90f/l .

This leaves the UART1 controller unbound allowing the x86-android-tablets
module to manually instantiate a serdev for it fixing bluetooth.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/x86/utils.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki May 18, 2023, 6:19 p.m. UTC | #1
On Sat, Apr 29, 2023 at 6:35 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> The Lenovo Yoga Book yb1-x90f/l 2-in-1 which ships with Android as
> Factory OS has (another) bug in its DSDT where the UART resource for
> the BTH0 ACPI device contains "\\_SB.PCIO.URT1" as path to the UART.
>
> Note that is with a letter 'O' instead of the number '0' which is wrong.
>
> This causes Linux to instantiate a standard /dev/ttyS? device for
> the UART instead of a /sys/bus/serial device, which in turn causes
> bluetooth to not work.
>
> Similar DSDT bugs have been encountered before and to work around those
> the acpi_quirk_skip_serdev_enumeration() helper exists.
>
> Previous devices had the broken resource pointing to the first UART, while
> the BT HCI was on the second UART, which ACPI_QUIRK_UART1_TTY_UART2_SKIP
> deals with. Add a new ACPI_QUIRK_UART1_SKIP quirk for skipping enumeration
> of UART1 instead for the Yoga Book case and add this quirk to the
> existing DMI quirk table entry for the yb1-x90f/l .
>
> This leaves the UART1 controller unbound allowing the x86-android-tablets
> module to manually instantiate a serdev for it fixing bluetooth.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/acpi/x86/utils.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
> index 4cfee2da0675..c2b925f8cd4e 100644
> --- a/drivers/acpi/x86/utils.c
> +++ b/drivers/acpi/x86/utils.c
> @@ -259,10 +259,11 @@ bool force_storage_d3(void)
>   * drivers/platform/x86/x86-android-tablets.c kernel module.
>   */
>  #define ACPI_QUIRK_SKIP_I2C_CLIENTS                            BIT(0)
> -#define ACPI_QUIRK_UART1_TTY_UART2_SKIP                                BIT(1)
> -#define ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY                    BIT(2)
> -#define ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY                     BIT(3)
> -#define ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS                    BIT(4)
> +#define ACPI_QUIRK_UART1_SKIP                                  BIT(1)
> +#define ACPI_QUIRK_UART1_TTY_UART2_SKIP                                BIT(2)
> +#define ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY                    BIT(3)
> +#define ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY                     BIT(4)
> +#define ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS                    BIT(5)
>
>  static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
>         /*
> @@ -319,6 +320,7 @@ static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
>                         DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
>                 },
>                 .driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS |
> +                                       ACPI_QUIRK_UART1_SKIP |
>                                         ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY |
>                                         ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS),
>         },
> @@ -449,6 +451,9 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
>         if (dmi_id)
>                 quirks = (unsigned long)dmi_id->driver_data;
>
> +       if ((quirks & ACPI_QUIRK_UART1_SKIP) && uid == 1)
> +               *skip = true;
> +
>         if (quirks & ACPI_QUIRK_UART1_TTY_UART2_SKIP) {
>                 if (uid == 1)
>                         return -ENODEV; /* Create tty cdev instead of serdev */
> --

Applied as 6.5 material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
index 4cfee2da0675..c2b925f8cd4e 100644
--- a/drivers/acpi/x86/utils.c
+++ b/drivers/acpi/x86/utils.c
@@ -259,10 +259,11 @@  bool force_storage_d3(void)
  * drivers/platform/x86/x86-android-tablets.c kernel module.
  */
 #define ACPI_QUIRK_SKIP_I2C_CLIENTS				BIT(0)
-#define ACPI_QUIRK_UART1_TTY_UART2_SKIP				BIT(1)
-#define ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY			BIT(2)
-#define ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY			BIT(3)
-#define ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS			BIT(4)
+#define ACPI_QUIRK_UART1_SKIP					BIT(1)
+#define ACPI_QUIRK_UART1_TTY_UART2_SKIP				BIT(2)
+#define ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY			BIT(3)
+#define ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY			BIT(4)
+#define ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS			BIT(5)
 
 static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
 	/*
@@ -319,6 +320,7 @@  static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
 			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
 		},
 		.driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS |
+					ACPI_QUIRK_UART1_SKIP |
 					ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY |
 					ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS),
 	},
@@ -449,6 +451,9 @@  int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 	if (dmi_id)
 		quirks = (unsigned long)dmi_id->driver_data;
 
+	if ((quirks & ACPI_QUIRK_UART1_SKIP) && uid == 1)
+		*skip = true;
+
 	if (quirks & ACPI_QUIRK_UART1_TTY_UART2_SKIP) {
 		if (uid == 1)
 			return -ENODEV; /* Create tty cdev instead of serdev */