Syniurge / i2c-amd-mp2

DKMS-ready driver for AMD PCI-E MP2 I2C controllers
22 stars 4 forks source link

Touchpad stops working on HP EliteBook 745 G5 #15

Open Slater91 opened 4 years ago

Slater91 commented 4 years ago

Hi! I'm using KDE neon, based on Ubuntu 18.04, with the Xanmod kernel (currently kernel 5.5, but I've tried everything since kernel 5.0). Ever since I have started using this computer one years ago I have been experiencing the touchpad suddenly and apparently randomly stopping to work. I have recently been able to pinpoint the issue in some kind of incompatibility with USB - whenever I plug something in a USB port the touchpad may stop working. Whenever that happens I am met with these messages in dmesg:

[546631.787290] xhci_hcd 0000:04:00.3: refused to change power state from D3hot to D0 [546631.801726] xhci_hcd 0000:04:00.3: enabling device (0000 -> 0002) [546634.907766] irq 32: nobody cared (try booting with the "irqpoll" option) [546634.907770] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 5.5.2-xanmod2 #1.200206 [546634.907771] Hardware name: HP HP EliteBook 745 G5/83D5, BIOS Q81 Ver. 01.09.01 10/18/2019 [546634.907772] Call Trace: [546634.907774] [546634.907780] dump_stack+0x66/0x90 [546634.907783] __report_bad_irq+0x35/0xa7 [546634.907785] note_interrupt.cold+0xb/0x63 [546634.907786] handle_irq_event_percpu+0x6f/0x80 [546634.907787] handle_irq_event+0x34/0x51 [546634.907789] handle_fasteoi_irq+0x8b/0x130 [546634.907791] do_IRQ+0x50/0xe0 [546634.907792] common_interrupt+0xf/0xf [546634.907794] [546634.907795] RIP: 0010:poll_idle+0x59/0xb2 [546634.907797] Code: 00 65 4c 8b 34 25 c0 8b 01 00 f0 41 80 4e 02 20 49 8b 06 a8 08 75 3a 4c 89 e7 48 89 ee e8 ff 65 df ff 49 89 c4 b8 c9 00 00 00 <49> 8b 16 83 e2 08 75 1f f3 90 83 e8 01 75 f1 65 8b 3d 69 07 f3 55 [546634.907797] RSP: 0018:ffffffffaac03e28 EFLAGS: 00000206 ORIG_RAX: ffffffffffffffc4 [546634.907799] RAX: 0000000000000084 RBX: 0001f1295b7fba04 RCX: 000000000000001f [546634.907799] RDX: 0000000000000000 RSI: 00000000401ec933 RDI: 0001d17410821d96 [546634.907800] RBP: ffff9da89d6ab800 R08: 0001f1295b7fbacc R09: 00000000000005fe [546634.907800] R10: 0000000000000000 R11: ffff9da89fe2b9c4 R12: 00000000000007d0 [546634.907801] R13: 0000000000000000 R14: ffffffffaac13780 R15: ffffffffaac13780 [546634.907804] ? poll_idle+0x74/0xb2 [546634.907807] cpuidle_enter_state+0x81/0x410 [546634.907808] cpuidle_enter+0x29/0x40 [546634.907810] do_idle+0x1e4/0x280 [546634.907812] cpu_startup_entry+0x19/0x20 [546634.907814] start_kernel+0x556/0x573 [546634.907818] secondary_startup_64+0xa4/0xb0 [546634.907820] handlers: [546634.907824] [<000000008dc9ecdd>] amd_mp2_irq_isr [i2c_amd_mp2_pci] [546634.907825] Disabling IRQ #32

After this happens the touchpad will just click randomly whenever I touch it, but it won't move the cursor. Does anyone have any idea what's going on? Thanks!

Syniurge commented 4 years ago

Sorry for not noticing your issue earlier, it looks interesting.

It looks like plugging some USB device triggers the interrupt line for the MP2 I2C controller, but since the MP2 interrupt handler in the driver doesn't see any new info from the MP2 it ignores the interrupt (passes it to other interrupt handlers if there are any, but there's only one in your case) which triggers this error.

I have no clue why plugging something in a USB port would have anything to do with the I2C controller interrupt. Could be a hardware issue if it's random. I tried to find similar cases on Google but couldn't find any, and you're the first person to report this to me.

The workaround below would be to always tell the kernel that the IRQ was handled so that the IRQ doesn't get disabled, but that's assuming that the interrupt line isn't shared with other devices. In your case it isn't, but it might cause problems for other laptops.

static irqreturn_t amd_mp2_irq_isr(int irq, void *dev)
{
    // (...)

    for (bus_id = 0; bus_id < 2; bus_id++) {
        // (...)
    }

    if (ret != IRQ_HANDLED) {
        // (...)
    }

        ret  = IRQ_HANDLED; // <===== WORKAROUND
    return ret;
}

Or maybe the MP2 is meant to always have its own interrupt line and the assumption holds (which may be why the problem doesn't occur on Windows). I'll ask AMD people..