]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - drivers/acpi/resource.c
ACPI: resources: Add DMI-based legacy IRQ override quirk
[thirdparty/kernel/linux.git] / drivers / acpi / resource.c
index ee78a210c6068645574b8a5954e14578efd7e564..7bf38652e6aca052ff1fffe56cbe18465258e5ea 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/irq.h>
+#include <linux/dmi.h>
 
 #ifdef CONFIG_X86
 #define valid_IRQ(i) (((i) != 0) && ((i) != 2))
@@ -380,9 +381,51 @@ 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[] = {
+       {
+               .ident = "MEDION P15651",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
+                       DMI_MATCH(DMI_BOARD_NAME, "M15T"),
+               },
+       },
+       { }
+};
+
+struct irq_override_cmp {
+       const struct dmi_system_id *system;
+       unsigned char irq;
+       unsigned char triggering;
+       unsigned char polarity;
+       unsigned char shareable;
+};
+
+static const struct irq_override_cmp skip_override_table[] = {
+       { medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
+};
+
+static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
+                                 u8 shareable)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
+               const struct irq_override_cmp *entry = &skip_override_table[i];
+
+               if (dmi_check_system(entry->system) &&
+                   entry->irq == gsi &&
+                   entry->triggering == triggering &&
+                   entry->polarity == polarity &&
+                   entry->shareable == shareable)
+                       return false;
+       }
+
+       return true;
+}
+
 static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
                                     u8 triggering, u8 polarity, u8 shareable,
-                                    bool legacy)
+                                    bool check_override)
 {
        int irq, p, t;
 
@@ -401,7 +444,9 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
         * using extended IRQ descriptors we take the IRQ configuration
         * from _CRS directly.
         */
-       if (legacy && !acpi_get_override_irq(gsi, &t, &p)) {
+       if (check_override &&
+           acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
+           !acpi_get_override_irq(gsi, &t, &p)) {
                u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
                u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;