Not receiving interrupts for SPI slave device on x86

Federico Lorenzi florenzi+kernel at gmail.com
Tue Aug 9 18:25:04 EDT 2016


Hi all,

I've been working on a driver [1] for the SPI touchpad / keyboard
found in the new 12" Apple MacBooks. While the driver works OK as a
polled device, I can't seem to get interrupts working.

I'm requesting an IRQ with:
result = request_irq(spi->irq, applespi_irq_handler, IRQF_SHARED,
"applespi", applespi);

which shows up correctly under /proc/interrupts:
14:          0          0          0          0  IR-IO-APIC
14-fasteoi   applespi

This is the relevant bit from the DSDT of the SPI slave device (rest
of the DSDT at [3]):
    Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
    {
        0x0000000E,
    }

However, no amount of pressing keys will cause an interrupt to happen.
While I don't fully understand the packets I'm using to initialize the
SPI device, they're an exact copy of what the Windows driver uses on
bootup, and they get the same response.

I am booting the kernel with intremap=nosid,no_x2apic_optout; without
nosid it won't boot at all, and without no_x2apic_optout the result is
the same.

One theory I have is that the IOAPIC is incorrectly configuring the
pin (full dmesg [2]):
[    0.034850] IOAPIC[0]: Set routing entry (2-14 -> 0x3e -> IRQ 14
Mode:0 Active:0 Dest:1)
[    0.034857] IOAPIC[2]: Set IRTE entry (P:1 FPD:0 Dst_Mode:1
Redir_hint:1 Trig_Mode:0 Dlvry_Mode:1 Avail:0 Vector:3F Dest:00000001
SID:F0F8 SQ:0 SVT:0)

Compared with IRQ 23 (which is the SPI controller):
[   15.245319] IOAPIC[2]: Set IRTE entry (P:1 FPD:0 Dst_Mode:1
Redir_hint:1 Trig_Mode:0 Dlvry_Mode:1 Avail:0 Vector:53 Dest:00000001
SID:F0F8 SQ:0 SVT:0)
[   15.245321] IOAPIC[0]: Set routing entry (2-23 -> 0x53 -> IRQ 23
Mode:1 Active:1 Dest:1)

Similarly, this is the DSDT bit for the SPI controller:
    Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
    {
        0x00000017,
    }

Any suggestions or pointers would be most welcome.

Cheers,
Federico

[1] https://github.com/cb22/macbook12-spi-driver
[2] http://paste.ubuntu.com/22851538/
[3] http://paste.ubuntu.com/22851971/



More information about the Kernelnewbies mailing list