cb22 / macbook12-spi-driver

WIP input driver for the SPI touchpad / keyboard found in the 12" MacBook (MacBook8,1 + MacBook9,1)
GNU General Public License v2.0
300 stars 106 forks source link

intel-lpss error in latest archlinux #11

Closed xinyifly closed 7 years ago

xinyifly commented 7 years ago

intel-lpss error in dmesg

[root@tux ~]# dmesg | grep lpss
[    3.719311] intel-lpss 0000:00:15.0: enabling device (0000 -> 0002)
[    3.719446] intel-lpss 0000:00:15.0: can't derive routing for PCI INT A
[    3.719449] intel-lpss 0000:00:15.0: PCI INT A: not connected
[    3.719480] intel-lpss: probe of 0000:00:15.0 failed with error -22
[    3.732717] intel-lpss 0000:00:15.2: enabling device (0000 -> 0002)
[    3.732835] intel-lpss 0000:00:15.2: can't derive routing for PCI INT C
[    3.732837] intel-lpss 0000:00:15.2: PCI INT C: not connected
[    3.732866] intel-lpss: probe of 0000:00:15.2 failed with error -22
[    3.745981] intel-lpss 0000:00:19.0: enabling device (0000 -> 0002)
[    3.746103] intel-lpss 0000:00:19.0: can't derive routing for PCI INT A
[    3.746106] intel-lpss 0000:00:19.0: PCI INT A: not connected
[    3.746135] intel-lpss: probe of 0000:00:19.0 failed with error -22
[    3.759311] intel-lpss 0000:00:1e.0: enabling device (0000 -> 0002)
[    3.759435] intel-lpss 0000:00:1e.0: can't derive routing for PCI INT A
[    3.759437] intel-lpss 0000:00:1e.0: PCI INT A: not connected
[    3.759465] intel-lpss: probe of 0000:00:1e.0 failed with error -22
[    3.772647] intel-lpss 0000:00:1e.3: enabling device (0000 -> 0002)
[    3.772761] intel-lpss 0000:00:1e.3: can't derive routing for PCI INT D
[    3.772764] intel-lpss 0000:00:1e.3: PCI INT D: not connected
[    3.772801] intel-lpss: probe of 0000:00:1e.3 failed with error -22

DSDT Checked

[root@tux newdsdt]# cp /sys/firmware/acpi/tables/DSDT dsdt.dat && iasl -d dsdt.dat

Intel ACPI Component Architecture
ASL+ Optimizing Compiler version 20160930-64
Copyright (c) 2000 - 2016 Intel Corporation

Input file dsdt.dat, Length 0x883D (34877) bytes
ACPI: DSDT 0x0000000000000000 00883D (v03 APPLE  MacBook  00080002 INTL 20160930)
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed

Found 2 external control methods, reparsing with new information
Pass 1 parse of [DSDT]
Pass 2 parse of [DSDT]
Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)

Parsing completed
Disassembly completed
ASL Output:    dsdt.dsl - 307556 bytes
[root@tux newdsdt]# grep -i '_SB_.PCI0.SPI1.SPIT._CRS.UBUF' -C3 dsdt.dsl 
                        })
                        If (OSDW ())
                        {
                            Return (UBUF) /* \_SB_.PCI0.SPI1.SPIT._CRS.UBUF */
                        }

                        Return (ABUF) /* \_SB_.PCI0.SPI1.SPIT._CRS.ABUF */

With latest linux 4.9.11-1-ARCH

[root@tux ~]# dmesg | grep -i dsdt
[    0.000000] ACPI: DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x883d]
[    0.000000] ACPI: Table Upgrade: override [DSDT-APPLE - MacBook]
[    0.000000] ACPI: DSDT 0x000000008AFEB000 Physical table override, new table: 0x000000008A862000
[    0.000000] ACPI: DSDT 0x000000008A862000 00883D (v03 APPLE  MacBook  00080002 INTL 20160930)
[    0.623896] ACPI: \_SB_.PCI0.LPCB.EC__: Used as boot DSDT EC to handle transactions
[    0.837321] ACPI: \_SB_.PCI0.LPCB.EC__: Used as boot DSDT EC to handle transactions and events

With linux 4.6.4-1-ARCH

[root@tux newdsdt]# dmesg | grep -i dsdt
[    0.000000] DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x883d]
[    0.000000] ACPI: Override [DSDT- MacBook], this is unsafe: tainting kernel
[    0.000000] ACPI: DSDT 0x000000008AFEB000 Physical table override, new table: 0x000000008A862000
[    0.000000] ACPI: DSDT 0x000000008A862000 00883D (v03 APPLE  MacBook  00080002 INTL 20160930)
[root@tux ~]# dmesg | grep -i 'kernel command line'
[    0.000000] Kernel command line: initrd=\acpi_override initrd=\initramfs-linux.img root=PARTUUID=e6323f91-bb51-4563-aa54-15d7f490dbb1 rw noapic intremap=nosid

How to confirm spi device?

[root@tux ~]# find /sys -iname *spi*
/sys/fs/cgroup/pids/user.slice/user-0.slice/user@0.service/at-spi-dbus-bus.service
/sys/fs/cgroup/systemd/user.slice/user-0.slice/user@0.service/at-spi-dbus-bus.service
/sys/bus/spi
/sys/class/spi_master
/sys/kernel/debug/tracing/events/spi
/sys/kernel/debug/tracing/events/spi/spi_master_idle
/sys/kernel/debug/tracing/events/spi/spi_master_busy
/sys/kernel/debug/tracing/events/spi/spi_message_submit
/sys/kernel/debug/tracing/events/spi/spi_message_start
/sys/kernel/debug/tracing/events/spi/spi_message_done
/sys/kernel/debug/tracing/events/spi/spi_transfer_start
/sys/kernel/debug/tracing/events/spi/spi_transfer_stop
[root@tux ~]# find /sys -iname *app000d*
/sys/bus/acpi/devices/APP000D:00
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/APP000D:00
[root@tux linux]# lspci 
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 515 (rev 07)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:15.2 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #2 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:19.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #2 (rev 21)
00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)
00:1d.1 PCI bridge: Intel Corporation Device 9d19 (rev f1)
00:1e.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #0 (rev 21)
00:1e.3 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO SPI Controller #1 (rev 21)
00:1f.0 ISA bridge: Intel Corporation Device 9d46 (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
01:00.0 Mass storage controller: Apple Inc. Device 2003 (rev 11)
02:00.0 Network controller: Broadcom Limited BCM4350 802.11ac Wireless Network Adapter (rev 05)
03:00.0 Multimedia controller: Broadcom Limited 720p FaceTime HD Camera

So I can't get my keyboard work after make test with this driver

Link to StackExchange

http://unix.stackexchange.com/questions/349259/new-macbook-2016-april-12-inch-keyboard-problem-spi-and-dsdt

xinyifly commented 7 years ago

Is it because the Arch Kernel > 4.7 ? DSDT patch not working ? https://github.com/cb22/macbook12-spi-driver/pull/1

Dunedan commented 7 years ago

I have it working here with Linux 4.10, so the kernel version shouldn't be the issue.

Have you already checked that the modification you did to the DSDT is there after you started up with it being patched?

xinyifly commented 7 years ago

@Dunedan Thank you for help. I updated the description and checked the DSDT above.

Pamelloes commented 7 years ago

I'm also having this same issue with 4.9.11-1-ARCH. I've patched the DSDT successfully (the override is logged in dmesg) and I've passed intremap=nosid to the kernel. However, I get the same dmesg output as xinyifly and the keyboard does not work.

omnibrain commented 7 years ago

I'm having the same problem with 4.10.1-1-ARCH.

Pamelloes commented 7 years ago

I was able to fix the issue by compiling the patches DSDT table into the kernel; the dynamic override wouldn't work.

omnibrain commented 7 years ago

Still not working for me unfortunately... I'm getting the exact same outputs as posted above.

Pamelloes commented 7 years ago

Also make sure you have "intremap=none" but NOT "noapic" as kernel parameters. Noapic will disable spi as a side effect.

omnibrain commented 7 years ago

THANK YOU!!!! That was exactly the problem, I had the "noapi" kernel parameter. Now it's finally working.

PS you probably meant "intremap=nosid"

jnvandermeer commented 7 years ago

... does this mean that keyboard and trackpad can be activated (and everything is working)?

On Mar 17, 2017 6:01 AM, "Raphael" notifications@github.com wrote:

THANK YOU!!!! That was exactly the problem, I had the "noapi" kernel parameter. Now it's finally working.

PS you probably meant "intremap=nosid"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cb22/macbook12-spi-driver/issues/11#issuecomment-287174393, or mute the thread https://github.com/notifications/unsubscribe-auth/ACkrqBp0Yb7yPaFpVEa4yn0O9F2Ge5l9ks5rmZUKgaJpZM4MTcwx .

omnibrain commented 7 years ago

I've only been using it for an hour or so but I'm very happy with it, absolutely no complaints so far. Great work @cb22 !! You should put a bitcoin address in the readme for donations, I want to buy you a beer as a token of appreciation :)

EDIT: I gave credit to the wrong user

Pamelloes commented 7 years ago

(FYI the driver was written by @cb22)

omnibrain commented 7 years ago

Oops you're right. Edited my comment.

xinyifly commented 7 years ago

Cheers guys! The driver and the noapic information by @Pamelloes saved my life. @cb22 Should we close this issue now?

PS: An update with README for avoid using noapic kernel parameter would be helpful :)

omnibrain commented 7 years ago

Sorry for the off-topic question but did you get suspend/hibernate working on the early 2016 macbook9,1?

Pamelloes commented 7 years ago

No, I've spent a few days trying to get it to work; I've tried all sorts of horrible kernel hacks and have consulted with various channels on Freenode to no avail :( The one bit of progress I did make was setting the kernel parameter no_console_suspend=1 which revealed debug output from during suspend that was lost otherwise: it turns out that the issues is the hard drive doesn't get turned back on after any form of suspend. If you have any suggestions for how to try and fix this, or where a better forum for discussing the issue would be, let me know :)

omnibrain commented 7 years ago

That's too bad... On the Arch Wiki it says:

Suspend-to-RAM works out of the box.

...under the macbook9,1 model specific information. I guess that's just plain wrong then :(

EDIT: I just changed the wiki to say hibernate / suspend doesn't work.

omnibrain commented 7 years ago

@carinawi if my stalking is correct, you are the author of the macbook9,1 article of the Arch wiki. Does/did suspend really work for you? Have you done anything to make it work or did it just work out of the box?

PS I tried to send you an email but the email you have on your Github doesn't work.

cb22 commented 7 years ago

@xinyifly Good to hear it's sorted; I'll change the README to make a note about not needing noapic (intremap=nosid is what replaces it)

@Pamelloes Yeah, the big problem with suspend / resume is currently the fact that the NVMe device disappeared. I did some digging on that which is documented in #2 - but unfortunately I never got around to testing sending custom opcodes.

In a nutshell, the NVMe device disappears, and refuses to be woken up. It seems like the Apple driver runs some custom commands on suspend / resume to ensure the device is in a usable state.

Funnily enough, that does mean that if you boot off USB, suspend / resume does actually work.