Skip to content

Commit 892a012

Browse files
jason77-wangrafaeljw
authored andcommitted
ACPI: resources: Add DMI-based legacy IRQ override quirk
After the commit 0ec4e55 ("ACPI: resources: Add checks for ACPI IRQ override") is reverted, the keyboard on Medion laptops can't work again. To fix the keyboard issue, add a DMI-based override check that will not affect other machines along the lines of prt_quirks[] in drivers/acpi/pci_irq.c. If similar issues are seen on other platforms, the quirk table could be expanded in the future. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213031 BugLink: http://bugs.launchpad.net/bugs/1909814 Suggested-by: Rafael J. Wysocki <[email protected]> Reported-by: Manuel Krause <[email protected]> Tested-by: Manuel Krause <[email protected]> Signed-off-by: Hui Wang <[email protected]> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6880fa6 commit 892a012

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

drivers/acpi/resource.c

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/ioport.h>
1717
#include <linux/slab.h>
1818
#include <linux/irq.h>
19+
#include <linux/dmi.h>
1920

2021
#ifdef CONFIG_X86
2122
#define valid_IRQ(i) (((i) != 0) && ((i) != 2))
@@ -380,9 +381,51 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
380381
}
381382
EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
382383

384+
static const struct dmi_system_id medion_laptop[] = {
385+
{
386+
.ident = "MEDION P15651",
387+
.matches = {
388+
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
389+
DMI_MATCH(DMI_BOARD_NAME, "M15T"),
390+
},
391+
},
392+
{ }
393+
};
394+
395+
struct irq_override_cmp {
396+
const struct dmi_system_id *system;
397+
unsigned char irq;
398+
unsigned char triggering;
399+
unsigned char polarity;
400+
unsigned char shareable;
401+
};
402+
403+
static const struct irq_override_cmp skip_override_table[] = {
404+
{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
405+
};
406+
407+
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
408+
u8 shareable)
409+
{
410+
int i;
411+
412+
for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
413+
const struct irq_override_cmp *entry = &skip_override_table[i];
414+
415+
if (dmi_check_system(entry->system) &&
416+
entry->irq == gsi &&
417+
entry->triggering == triggering &&
418+
entry->polarity == polarity &&
419+
entry->shareable == shareable)
420+
return false;
421+
}
422+
423+
return true;
424+
}
425+
383426
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
384427
u8 triggering, u8 polarity, u8 shareable,
385-
bool legacy)
428+
bool check_override)
386429
{
387430
int irq, p, t;
388431

@@ -401,7 +444,9 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
401444
* using extended IRQ descriptors we take the IRQ configuration
402445
* from _CRS directly.
403446
*/
404-
if (legacy && !acpi_get_override_irq(gsi, &t, &p)) {
447+
if (check_override &&
448+
acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
449+
!acpi_get_override_irq(gsi, &t, &p)) {
405450
u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
406451
u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
407452

0 commit comments

Comments
 (0)