diff mbox series

[1/2] ACPI: resource: Consolidate IRQ trigger-type override DMI tables

Message ID 20230913111951.30414-1-hdegoede@redhat.com (mailing list archive)
State Mainlined, archived
Headers show
Series [1/2] ACPI: resource: Consolidate IRQ trigger-type override DMI tables | expand

Commit Message

Hans de Goede Sept. 13, 2023, 11:19 a.m. UTC
Before this patch there were 6 dmi_system_id tables. While looking at
the override_table[] there are only 2 cases:
1. irq 1, level, active-low, not-shared, skip-override
2. irq 1, edge, activ-low, shared, force-override

Merge the dmi_system_id tables for identical cases together,
going from 6 dmi_system_id tables and 6 override_table[] entries
to just 2, one for each case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note this applies on top of my recent quirk submission for
the ASUS ExpertBook B1402CBA:
https://lore.kernel.org/linux-acpi/20230912100827.303590-1-hdegoede@redhat.com/
---
 drivers/acpi/resource.c | 52 +++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

Comments

Rafael J. Wysocki Sept. 18, 2023, 6:52 p.m. UTC | #1
On Wed, Sep 13, 2023 at 1:20 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Before this patch there were 6 dmi_system_id tables. While looking at
> the override_table[] there are only 2 cases:
> 1. irq 1, level, active-low, not-shared, skip-override
> 2. irq 1, edge, activ-low, shared, force-override
>
> Merge the dmi_system_id tables for identical cases together,
> going from 6 dmi_system_id tables and 6 override_table[] entries
> to just 2, one for each case.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Note this applies on top of my recent quirk submission for
> the ASUS ExpertBook B1402CBA:
> https://lore.kernel.org/linux-acpi/20230912100827.303590-1-hdegoede@redhat.com/
> ---
>  drivers/acpi/resource.c | 52 +++++++++++++++++------------------------
>  1 file changed, 21 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index 8116b55b6c98..c6bb28db8f30 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -385,7 +385,12 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
>  }
>  EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
>
> -static const struct dmi_system_id medion_laptop[] = {
> +/*
> + * DMI matches for boards where the DSDT specifies the kbd IRQ as
> + * level active-low and using the override changes this to rising edge,
> + * stopping the keyboard from working.
> + */
> +static const struct dmi_system_id irq1_level_low_skip_override[] = {
>         {
>                 .ident = "MEDION P15651",
>                 .matches = {
> @@ -407,10 +412,6 @@ static const struct dmi_system_id medion_laptop[] = {
>                         DMI_MATCH(DMI_BOARD_NAME, "M1xA"),
>                 },
>         },
> -       { }
> -};
> -
> -static const struct dmi_system_id asus_laptop[] = {
>         {
>                 .ident = "Asus Vivobook K3402ZA",
>                 .matches = {
> @@ -474,20 +475,28 @@ static const struct dmi_system_id asus_laptop[] = {
>                         DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"),
>                 },
>         },
> +       {
> +               .ident = "LG Electronics 17U70P",
> +               .matches = {
> +                       DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
> +                       DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
> +               },
> +       },
>         { }
>  };
>
> -static const struct dmi_system_id tongfang_gm_rg[] = {
> +/*
> + * DMI matches for AMD Zen boards where the DSDT specifies the kbd IRQ
> + * as falling edge and this must be overridden to rising edge,
> + * to have a working keyboard.
> + */
> +static const struct dmi_system_id irq1_edge_low_force_override[] = {
>         {
>                 .ident = "TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD",
>                 .matches = {
>                         DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
>                 },
>         },
> -       { }
> -};
> -
> -static const struct dmi_system_id maingear_laptop[] = {
>         {
>                 .ident = "MAINGEAR Vector Pro 2 15",
>                 .matches = {
> @@ -502,10 +511,6 @@ static const struct dmi_system_id maingear_laptop[] = {
>                         DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"),
>                 },
>         },
> -       { }
> -};
> -
> -static const struct dmi_system_id pcspecialist_laptop[] = {
>         {
>                 .ident = "PCSpecialist Elimina Pro 16 M",
>                 /*
> @@ -520,17 +525,6 @@ static const struct dmi_system_id pcspecialist_laptop[] = {
>         { }
>  };
>
> -static const struct dmi_system_id lg_laptop[] = {
> -       {
> -               .ident = "LG Electronics 17U70P",
> -               .matches = {
> -                       DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
> -                       DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
> -               },
> -       },
> -       { }
> -};
> -
>  struct irq_override_cmp {
>         const struct dmi_system_id *system;
>         unsigned char irq;
> @@ -541,12 +535,8 @@ struct irq_override_cmp {
>  };
>
>  static const struct irq_override_cmp override_table[] = {
> -       { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
> -       { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
> -       { tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
> -       { maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
> -       { pcspecialist_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
> -       { lg_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
> +       { irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
> +       { irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
>  };
>
>  static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
> --

Applied, along with the [2/2], as 6.7 material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 8116b55b6c98..c6bb28db8f30 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -385,7 +385,12 @@  unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
 }
 EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
 
-static const struct dmi_system_id medion_laptop[] = {
+/*
+ * DMI matches for boards where the DSDT specifies the kbd IRQ as
+ * level active-low and using the override changes this to rising edge,
+ * stopping the keyboard from working.
+ */
+static const struct dmi_system_id irq1_level_low_skip_override[] = {
 	{
 		.ident = "MEDION P15651",
 		.matches = {
@@ -407,10 +412,6 @@  static const struct dmi_system_id medion_laptop[] = {
 			DMI_MATCH(DMI_BOARD_NAME, "M1xA"),
 		},
 	},
-	{ }
-};
-
-static const struct dmi_system_id asus_laptop[] = {
 	{
 		.ident = "Asus Vivobook K3402ZA",
 		.matches = {
@@ -474,20 +475,28 @@  static const struct dmi_system_id asus_laptop[] = {
 			DMI_MATCH(DMI_BOARD_NAME, "B2502CBA"),
 		},
 	},
+	{
+		.ident = "LG Electronics 17U70P",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
+			DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
+		},
+	},
 	{ }
 };
 
-static const struct dmi_system_id tongfang_gm_rg[] = {
+/*
+ * DMI matches for AMD Zen boards where the DSDT specifies the kbd IRQ
+ * as falling edge and this must be overridden to rising edge,
+ * to have a working keyboard.
+ */
+static const struct dmi_system_id irq1_edge_low_force_override[] = {
 	{
 		.ident = "TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD",
 		.matches = {
 			DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
 		},
 	},
-	{ }
-};
-
-static const struct dmi_system_id maingear_laptop[] = {
 	{
 		.ident = "MAINGEAR Vector Pro 2 15",
 		.matches = {
@@ -502,10 +511,6 @@  static const struct dmi_system_id maingear_laptop[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"),
 		},
 	},
-	{ }
-};
-
-static const struct dmi_system_id pcspecialist_laptop[] = {
 	{
 		.ident = "PCSpecialist Elimina Pro 16 M",
 		/*
@@ -520,17 +525,6 @@  static const struct dmi_system_id pcspecialist_laptop[] = {
 	{ }
 };
 
-static const struct dmi_system_id lg_laptop[] = {
-	{
-		.ident = "LG Electronics 17U70P",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
-			DMI_MATCH(DMI_BOARD_NAME, "17U70P"),
-		},
-	},
-	{ }
-};
-
 struct irq_override_cmp {
 	const struct dmi_system_id *system;
 	unsigned char irq;
@@ -541,12 +535,8 @@  struct irq_override_cmp {
 };
 
 static const struct irq_override_cmp override_table[] = {
-	{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
-	{ asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
-	{ tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
-	{ maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
-	{ pcspecialist_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
-	{ lg_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
+	{ irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
+	{ irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
 };
 
 static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,