Bug 99891 - Macbook8,1 12-inch (Early 2015) keyboard and trackpad don't work
Summary: Macbook8,1 12-inch (Early 2015) keyboard and trackpad don't work
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: Intel Linux
: P1 high
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-13 08:30 UTC by reroute
Modified: 2020-10-12 15:32 UTC (History)
44 users (show)

See Also:
Kernel Version: 3.16, 3.18, 3.19
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg (56.43 KB, text/plain)
2015-09-05 07:28 UTC, derarnold
Details
lspci (1.74 KB, text/plain)
2015-09-05 07:28 UTC, derarnold
Details
lsusb (490 bytes, text/plain)
2015-09-05 07:28 UTC, derarnold
Details
uname (120 bytes, text/plain)
2015-09-05 07:29 UTC, derarnold
Details
lshw (13.85 KB, text/plain)
2016-01-06 01:02 UTC, Leif Liddy
Details
lsusb (no ext devices) (126 bytes, text/plain)
2016-01-06 02:28 UTC, Leif Liddy
Details
lsusb -v (no ext devices) (5.29 KB, text/plain)
2016-01-06 02:33 UTC, Leif Liddy
Details
guide - register APP000D slave device (1.70 KB, text/plain)
2016-03-02 19:35 UTC, Leif Liddy
Details
Sys dump of MacBook12-2015 (3.69 MB, application/octet-stream)
2016-06-17 13:55 UTC, Andreas Jonsson
Details

Description reroute 2015-06-13 08:30:23 UTC
When I boot in any linux (Ubuntu, OpenSUSE, Debian) laptop's keyboard and mouse don't work at all. Still I am able to use external mouse and keyboard.
Comment 1 derarnold 2015-09-05 07:26:46 UTC
Hi Folks.

To give you something to work with, I have installed Ubuntu 15.10 Beta and updated to 4.2 Kernel.Still the same behavor no Keyboard, no trackpad and no harddisk :(

I have attached some logfiles. Since the issue is reproducable 100% on request I can give you some more.


Success derarnold


Further Info:
There is a related ticket on launchpad https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1462761
Comment 2 derarnold 2015-09-05 07:28:11 UTC
Created attachment 186761 [details]
dmesg
Comment 3 derarnold 2015-09-05 07:28:31 UTC
Created attachment 186771 [details]
lspci
Comment 4 derarnold 2015-09-05 07:28:48 UTC
Created attachment 186781 [details]
lsusb
Comment 5 derarnold 2015-09-05 07:29:31 UTC
Created attachment 186791 [details]
uname

Linux -MacBook 4.2.0-040200-generic #201508301530 SMP Sun Aug 30 19:31:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Comment 6 derarnold 2015-09-05 07:32:16 UTC
To identify exactly the hardware:

This is the 2015 Macbook (not PRO!!!) with only the USB-C connector.
Comment 7 derarnold 2015-09-05 07:34:17 UTC
Can someone update the kernel version also to 4.2 ?
Comment 8 Dmitry Torokhov 2015-09-05 18:09:52 UTC
I do not see any Apple devices in lsusb, USB folks need to take a look.
Comment 9 derarnold 2015-09-07 10:27:42 UTC
Hi there. 

For what it is worth, here is the system information from OSX:

Interesting, it is listed in SPI devices

Apple Internal Keyboard/Trackpad:

  Produkt-ID:	0x0272
  Hersteller-ID:	0x05ac (Apple Inc.)
  Version:	6.22
  Seriennummer:	D3H5201293SFT9FAM3KS
  Hersteller:	Apple Inc.
  Standort-ID:	0x01000000


And some info about the SSD it is listen under NVMExpress:


APPLE SSD AP0512H:

  Kapazität:	500,28 GB (500.277.788.672 Byte)
  TRIM-Unterstützung:	Ja
  Modell:	APPLE SSD AP0512H
  Version:	5.844.01
  Seriennummer:	C02525200KNFVF6AQ
  Link-Breite:	x4
  Link-Geschwindigkeit:	5.0 GT/s
  Absteckbares Laufwerk:	Nein
  BSD-Name:	disk0
  Partitionstabellentyp:	GPT (GUID-Partitionstabelle)
  Wechselmedien:	Nein
  S.M.A.R.T.-Status:	Nicht unterstützt
  Volumes:
EFI:
  Kapazität:	314,6 MB (314.572.800 Byte)
  BSD-Name:	disk0s1
  Inhalt:	EFI
  UUID des Volumes:	E783267B-A4C3-3556-B751-DBED770EB996
disk0s2:
  Kapazität:	499,31 GB (499.313.168.384 Byte)
  BSD-Name:	disk0s2
  Inhalt:	Apple_CoreStorage
Recovery HD:
  Kapazität:	650 MB (650.002.432 Byte)
  BSD-Name:	disk0s3
  Inhalt:	Apple_Boot
  UUID des Volumes:	F204F0CF-97B8-39DD-BBC8-B168A66E2A53


derarnold
Comment 10 derarnold 2015-09-08 09:25:44 UTC
Hi Guys on openSUSE I found this info:

"I tried a similar thing last weekend. Like you I've experimented with Ubuntu, so I'm afraid I detailed the results in an Ubuntu Forum so a not to mix things up. http://ubuntuforums.org/showthread.php?t=2290700 Essentially it's because the keyboard is attached via the SPI interface, rather than USB - if you notice the Macbook Pro & Air users are lucky enough to see the keyboard/touchpad in the list when they type lspci. We are not so lucky. We see the SPI interface when you type lspci, but I've not found any information on how to list the devices hanging off the SPI bus (it doesn't appear in /sys/bus/spi)."

https://forums.opensuse.org/showthread.php/507933-openSUSE-on-the-2015-Apple-12-Inch-Retina-MacBook/page3

Perhaps it helps.

derarnold
Comment 11 TJ 2015-09-29 17:46:23 UTC
I think the reason the MacBook NVMe SSD isn't being found is Apple messed up and gave it the wrong PCI Class ID:


drivers/block/nvme-core.c: "#define PCI_CLASS_STORAGE_EXPRESS       0x010802" 

Apple: "pci 0000:03:00.0: [106b:2001] type 00 class 0x018002"

PCI Class 01 == Mass Storage, 08 == Non-Volatile memory controller, 02 == NVM Express
Comment 12 TJ 2015-09-29 17:49:35 UTC
Clarification: "messed up" == the controller device isn't really NVMe.
Comment 13 TJ 2015-09-29 18:42:46 UTC
The iFixIt tear-down Step 14 [1] shows a custom application processor, 338S00055, in a Package-on-Package with a SK Hynix H9TKNNN4GDMRRR-NGM 4 Gb (512 MB) LPDDR2-SDRAM on top. The 338S00055 has the markings:

338S00055
NPK813.00
504600-K12
AM 1507
S1X A2

[1] https://www.ifixit.com/Teardown/Retina+Macbook+2015+Teardown/39841#s90315
Comment 14 derarnold 2015-10-07 13:30:59 UTC
Hello all.

It took a while, but I have the logfiles. To help you guys to create a bootable stick to debug yourself, here is a guide that finally worked:
   http://www.lug-stormarn.de/index.php/infos/13-linux-auf-dem-macbook-air
It is in German, but if you see the commands, you will understand.

In this ticket, we track the keyboard & trackpad issue. I will create a new ticket for the NVM. You can find it here:
     https://bugzilla.kernel.org/show_bug.cgi?id=105621

So now to our problem:
When booting, the driver i2c-801 is not loaded. After manually loading, the keyboard & mouse is still not working :( 

I attached some more logfiles for you.

Oliver

P.s. since I have a working boot usb stick now, i can provide logs & tests much faster.
Comment 15 moepi 2015-11-04 00:34:08 UTC
Apple's NVMe controller should be supported from now on:
    http://lists.infradead.org/pipermail/linux-nvme/2015-November/002975.html

I'm working on the SPI keyboard, but so far... it's digging around. What I found:

There is an Intel-based serial controller (8086 9ce6)
|-> Below that one there is an 8086 049c (or is it 9c04--that crappy XML ouput given by OSX is one of the reasons I refuse to use it any more...), which is reported to be a SATA controller (wtf?)
  |-> below that one there are chained AppleIntelLpssSpiController and AppleIntelLpssSpiDevice
    |-> there is finally an AppleHSSPIController that connects the Apple Internal Keyboard / Trackpad


That info comes from OSX on an MacBook8,1.

With Linux I see the Intel SPI controllers but any driver refuses to claim them. Manual binding worked with the intel-pxa* modules, generating spi nodes in /sys/class/bus/spi/devices.

However, I don't had any luck to expose the bcm5974 that is supposed to sit there nor the keyboard/trackpad.

So far, my Filco is my best friend.
Comment 16 derarnold 2015-11-08 12:35:13 UTC
Can anyone confirm that this patch is in the Linux 4.3 release?
Comment 17 moepi 2015-11-08 12:40:37 UTC
(In reply to derarnold from comment #16)
> Can anyone confirm that this patch is in the Linux 4.3 release?

Have a look at the sources and answer the question yourself.

It has never been meant to be part of 4.3, it was only tested against a late RC.

With any luck it may be part von 4.4. But beware that there are reports of sudden controller resets and data loss.
Comment 18 derarnold 2015-11-11 20:24:31 UTC
Hi.

I just saw the following CL in the kernel git. It looks like it could bring the trackpad to life.

https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=22f8e9dbf671a2f36d90d3d8723a2a0c5227fa4b

Can anyone confirm, they work?

Oliver
Comment 19 Zheng Jinxin 2015-11-18 07:25:28 UTC
(In reply to derarnold from comment #18)
> Hi.
> 
> I just saw the following CL in the kernel git. It looks like it could bring
> the trackpad to life.
> 
> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/
> ?id=22f8e9dbf671a2f36d90d3d8723a2a0c5227fa4b
> 
> Can anyone confirm, they work?
> 
> Oliver

Hi Oliver,

That patch regarding the usb bluetooth targets the MacBookPro12,1 which is way different from MacBook8,1.

I checked that patch is in 4.4-rc1 and tested it. Not surprisingly the keyboard/trackpad/bluetooth are still missing..
Comment 20 derarnold 2015-11-24 08:47:05 UTC
Hi Zheng.

Unfortunately the Ubuntu 4.4-rc2 is not building :( Can yu confirm that you could see the SSD?

Oliver
Comment 21 Zheng Jinxin 2015-11-24 09:12:33 UTC
(In reply to derarnold from comment #20)
> Hi Zheng.
> 
> Unfortunately the Ubuntu 4.4-rc2 is not building :( Can yu confirm that you
> could see the SSD?
> 
> Oliver

The Apple NVMe SSD is supported in 4.4-rc1. But we need a hotfix in addition to work around the flush issue (maybe it will soon be included in the following rc's). Please see bug 105621.
Comment 22 noobermin 2015-12-20 20:18:31 UTC
Hi, are there any updates on the progress on keyboard/trackpad support?
Comment 23 Leif Liddy 2015-12-27 01:15:46 UTC
On this post:
http://www.spinics.net/lists/linux-acpi/msg61848.html

This guy is saying that on both the Macbook8,1 12-inch and the MacbookPro 13-inch, OSX reports the keyboard/trackpad as being connected via SPI --not USB. However, with Linux the keyboard/trackpad show up as USB devices on the MacbookPro12,1, but remain hidden for the Macbook8,1. 

Just a thought, but maybe the keyboard/trackpad should also be showing up as USB devices on the Mackbook8,1 as well in Linux.
Comment 24 noobermin 2015-12-28 05:33:26 UTC
(In reply to leif from comment #23)

> Just a thought, but maybe the keyboard/trackpad should also be showing up as
> USB devices on the Mackbook8,1 as well in Linux.

Can you clarify what you mean? Are you saying that it's possible that Mac OS X sees it as a USB device and not SPI? As moepi says above, Mac OS X reports it as SPI. I'm running Mac OS X and running system_profiler lists it as an SPI device as well.
Comment 25 Zheng Jinxin 2015-12-28 05:50:05 UTC
(In reply to noobermin from comment #24)
> (In reply to leif from comment #23)
> 
> > Just a thought, but maybe the keyboard/trackpad should also be showing up
> as
> > USB devices on the Mackbook8,1 as well in Linux.
> 
> Can you clarify what you mean? Are you saying that it's possible that Mac OS
> X sees it as a USB device and not SPI? As moepi says above, Mac OS X reports
> it as SPI. I'm running Mac OS X and running system_profiler lists it as an
> SPI device as well.

On MacbookPro12,1, the keyboard is reported as spi in OSX, and shows up as a usb device in Linux.

On Macbook8,1, the keyboard is also reported as spi (exactly the same as the Macbook Pro), but is not shown in Linux.
Comment 26 Leif Liddy 2016-01-06 01:02:57 UTC
Created attachment 198821 [details]
lshw
Comment 27 Leif Liddy 2016-01-06 02:11:22 UTC
The keyboard works in grub, and grub is using some pretty generic drivers. If anyone has ANY ideas of what to look for, things to test for, or what data to gather and post --please let me know. I've just posted the output of lshw. 
I'm running Fedora 23, 4.4.0-0.rc8 kernel, and have no external devices connected.
Comment 28 Leif Liddy 2016-01-06 02:28:50 UTC
Created attachment 198831 [details]
lsusb (no ext devices)
Comment 29 Leif Liddy 2016-01-06 02:33:43 UTC
Created attachment 198841 [details]
lsusb -v (no ext devices)
Comment 30 derarnold 2016-01-11 12:14:04 UTC
Has anyone tested the status on the released kernel 4.4?
Comment 31 Leif Liddy 2016-01-11 18:33:35 UTC
Tried it today, nothing has changed. If the issue is due to the spi_pxa2xx_platform driver not binding to the spi controller , than our best hope lies in the linux-next repo. There's a handful of pxa2xx-related commit's queued up to be merged into kernel 4.5.
Comment 32 Leif Liddy 2016-01-11 20:39:52 UTC
Has anyone got bluetooth working? Normally on macbooks, the device is discovered by usb and shows up as a "Bluetooth USB Host Controller"
Comment 33 Leif Liddy 2016-01-11 21:04:21 UTC
This device looks like a bluetooth serial port???  --but there no modalias listed for BCM2E7C.


P: /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:17/BCM2E7C:00
E: DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:17/BCM2E7C:00
E: ID_VENDOR_FROM_DATABASE=Broadcom
E: MODALIAS=acpi:BCM2E7C:APPLE-UART-BLTH:
E: SUBSYSTEM=acpi
E: USEC_INITIALIZED=7539067
Comment 34 Andy Shevchenko 2016-01-20 17:05:01 UTC
So, if it's (trackpad) USB then it has nothing to do with LPSS.
If it's one of LPSS connected device then close this bug with duplication to bug #110901.
Comment 35 noobermin 2016-02-08 08:03:44 UTC
I have no knowledge of these things, but I read through this[0] (moepi's email to the acpi list) again and decided to google the hwid mentioned, "APPLE-SPI-TOPCASE" and I found this[1], some random fellow who seems to have put DSDT info on github, and apparently, the MacBookAir6,2 has this device listed as SPIT. It has the similar (or same) ACPI ID[2], APP000D.

Looking up things, I don't see any issues with that machine's keyboard, although the keyboard might not be connected via SPI. Unfortunately, for the little googling I'm capable of doing tonight[3], I don't know of driver information for SPI devices on that machine.

But it's a step forward, at least this device exists on another machine that has full linux support. 



[0] http://www.spinics.net/lists/linux-acpi/msg61848.html
[1] https://github.com/Ramalama2/Apple/blob/master/1.%20Tables/MacBookAir6.2/DSDT.dsl#L7108
[2] I think it's an ACPI ID? I'm not sure.
[3] https://wiki.debian.org/InstallingDebianOn/Apple/MacBookAir/6-2
Comment 36 noobermin 2016-02-08 08:09:50 UTC
> Looking up things, I don't see any issues with that machine's keyboard,
> although the keyboard might not be connected via SPI. Unfortunately, for the
> little googling I'm capable of doing tonight[3], I don't know of driver
> information for SPI devices on that machine.

I should clarify that per [3] on that last post that the MacBookAir6,2--a device from 2013 to early 2014, has documented linux support for mostly everything, so they don't have an issue with APP000D in the way.

I'm not sure if this is helpful for anyone, it might be known already, but hopefully those more knowledgeable can help us figure out what to do next.
Comment 37 noobermin 2016-02-08 23:17:52 UTC
Also, it'd be beneficial if someone marked this CONFIRMED, it is certainly no longer NEW.
Comment 38 Leif Liddy 2016-03-02 19:35:37 UTC
Created attachment 206671 [details]
guide - register APP000D slave device

attached a quick and dirty guide on how to enable to SPI slave device (controls keyboard/trackpad). 

please test it out and provide feedback if you can

**still need an spi driver to make keyboard/trackpad work

**the ACPI devs are aware of the DSDT table issue. Hopefully, they'll be able to provide some sort of fix in the future
Comment 39 derarnold 2016-04-08 16:55:21 UTC
Hi Guys.

I just installed Ubuntu Mate 16.04 Beta2 and Kernel 4.6-rc2. Status:

- Network           works
- NVME (SSD)        works
- Bluetooth         does not work
- Keyboard & Mouse  does not work ...

I saw a lot of fixes ... but that is the status. If you have any ideas how to improve this, pls let me know.....
Comment 40 Praveen Kottarathil 2016-05-11 11:04:55 UTC
Hello All,

moepi wrote on moepi.net
--
What I would need are DSDT dumps and some infos from sysfs from someone who owns a MacBookPro12,1 (the 13″ model from 2015
--
I have access to a few of those devices. How can I be of help?
Comment 41 psrb191921 2016-06-03 07:49:20 UTC
I've got 12 inch macbook, I can help too. It's almost one year's old bug...
Comment 42 timothylui84 2016-06-12 17:33:47 UTC
I Have the 2016 version and can help
Comment 43 Andreas Jonsson 2016-06-17 13:49:08 UTC
I have a 2015 model. What can I do to help?
Comment 44 Andreas Jonsson 2016-06-17 13:55:37 UTC
Created attachment 220531 [details]
Sys dump of MacBook12-2015

This is a sys dump taken from OSX on a 2015 MacBook 12 inch.
Comment 45 littlejokee 2016-06-19 17:01:06 UTC
Is the ticket still in development, seems to be kind of quiet since a while.
I own the 2016 model and would like to help.
Comment 46 psrb191921 2016-06-19 17:50:09 UTC
Use it as a tea cup stand for more than one year already... We need it to be fixed, plz
Comment 47 Chad Voegele 2016-06-19 18:31:24 UTC
See also: https://bugzilla.kernel.org/show_bug.cgi?id=108331
Comment 48 Wes 2016-06-20 00:03:35 UTC
Still waiting for this myself.

@Greg I think it's time to change this to 'confirmed' :)
Comment 49 scramble 2016-06-20 00:23:58 UTC
Let me know if I can help with any dumps.
Comment 50 Jon 2016-06-23 08:54:15 UTC
I got one of these 12-inch macbooks -- model A1534 -- the day they were released and am still waiting for a keyboard driver for Linux.

Normally I run Gentoo GNU/Linux and the lack of a keyboard driver has prevented me from using this 12-inch macbook as much as I originally intended to.

Let me know if there is anything I can do to help with testing.


>> Should we raise a bounty?

I will happily pledge $200 USD out of pocket for working keyboard and trackpad drivers for the 12-inch macbooks, specifically the A1534 model.
Comment 51 Andreas Jonsson 2016-06-23 09:17:38 UTC
Can we use Bountysource or something like that to post it? I can add another $50 to the bounty.
Comment 52 Zheng Jinxin 2016-06-23 09:19:51 UTC
Perhaps the best way is to ask Apple for help. But I'm not so optimistic about it. I have already sold my 2015 12-inch. I will not purchase a new one until there's an explicit solution.
Comment 53 psrb191921 2016-06-23 09:22:11 UTC
I'm gonna add another $200
Comment 54 Jon 2016-06-23 11:00:03 UTC
>> Can we use Bountysource or something
>> like that to post it? I can add
>> another $50 to the bounty.

A bounty has been created.

https://www.bountysource.com/issues/35422234-macbook8-1-12-inch-early-2015-keyboard-and-trackpad-don-t-work
Comment 55 Jon 2016-06-23 11:09:49 UTC
I sent Apple an email through the web-forum linked below.   I let them know that for decades many GNU/Linux and *BSD users have run their OS of choice on Apple hardware, that *nix users will choose non-Apple hardware before compromising on their OS of choice, and I included the bountysource link.

https://www.apple.com/feedback/macbook.html
Comment 56 Wes 2016-06-23 13:44:02 UTC
   Nice, I'll throw some $ in to it in the morning, thanks
Comment 57 Andy Shevchenko 2016-06-23 14:40:35 UTC
Why not just buy a device and donate to subsytem maintainer, i.e. Benjamin Tissoires?
Comment 58 OddJob 2016-09-14 13:06:22 UTC
Has anyone tested with a 4.7RC Kernel?
Comment 59 Lukas Wunner 2016-09-17 19:31:05 UTC
(In reply to OddJob from comment #58)
> Has anyone tested with a 4.7RC Kernel?

So far there's no driver in mainline, just an experimental (but working) out-of-tree driver at
https://github.com/cb22/macbook12-spi-driver/
Comment 60 OddJob 2016-09-17 22:15:06 UTC
Thanks for pointing me to github and https://bugzilla.kernel.org/show_bug.cgi?id=108331. I am running 4.6, but unfortunately I have a 2015 model and am unsure of the steps to get the spi-pxa2xx driver working instead of the intel-loss driver in the 2016 model. It is encouraging to see some real progress on this though.
Comment 61 psrb191921 2016-09-21 22:54:54 UTC
I've got 2016 model with 512gb ssd and lastest 4.8 kernel (and stock 4.4 on ubuntu 16.04) can't boot (black screen with ext keyboard off) till i pass pci=noacpi, but after that it can't see an ssd :(
Comment 62 derarnold 2016-10-24 09:47:08 UTC
Gentlemen. 

I have just tested stock ubuntu mate 16.10 with kernel 4.8. Not working on a 2015 model. Does anyone have any idea how to fix this? I can provide a shell access to my installation for you to debug directly on my rig ....

Oliver
Comment 63 derarnold 2016-10-25 07:13:02 UTC
Since I tried to understand why the keyboard works in GRUB and not in the Linux, I have tried to install Ubuntu 12.04 .... And also no success.

Oliver
Comment 64 Lukas Wunner 2016-11-14 10:35:03 UTC
(In reply to derarnold from comment #63)
> Since I tried to understand why the keyboard works in GRUB and not in the
> Linux, I have tried to install Ubuntu 12.04 .... And also no success.
> 
> Oliver

The EFI Firmware Volume in ROM contains drivers for most of the chips, including the keyboard. Those drivers are disabled once ExitBootServices() is called (see UEFI spec for details). That is called either by grub immediately before starting the kernel, or by the kernel itself if the efistub is used. After that an OS driver is supposed to take over. So the keyboard in grub works because of the firmware-provided driver.
Comment 65 derarnold 2016-11-15 08:41:51 UTC
Hi Lukas.

New spin on this issue. Do you think there is any way we can use this drivers? Perhaps we can also analyst them to reverse engineer things?

Oliver
Comment 66 Lukas Wunner 2016-11-15 09:49:44 UTC
(In reply to derarnold from comment #65)
> New spin on this issue. Do you think there is any way we can use this
> drivers? Perhaps we can also analyst them to reverse engineer things?

They can't be used once ExitBootServices() has been called, we definitely need an OS-level driver such as the one Federico Lorenzi has begun.

Yes of course they can be reverse-engineered, they can easily be extracted from the EFI firmware updates Apple ships using binwalk or UEFIExtract, then opened in a disassembler. However usually it's easier to reverse-engineer the macOS driver as it contains function names, more debug messages etc.
Comment 67 trietch 2017-01-10 18:12:23 UTC
Any news?
Comment 68 Joël Krähemann 2017-01-19 15:24:44 UTC
Hi

I own a macbook pro 12,1 with function keys. Has the same issues. I try to develop SPI HID driver and doing an attempt to use existing drivers prior developed to interface with apple USB HID devices.

https://github.com/joelkraehemann/linux/blob/spi-hid-driver/drivers/hid/spi-hid/spi-hid.c

It is based on the code of i2c-hid.c

I'm complete beginner in kernel programming some help might be useful. Especially with the advanced topics like ACPI and a like.

I have found some inconsistency of the SPI probe function. Might be we have to introduce some incompatibility by doing an additional parameter. In order to be usable by HID probe interface.

Take a look at the probe parameters.

http://lxr.linux.no/#linux+v4.9.4/include/linux/spi/spi.h#L253
http://lxr.linux.no/#linux+v4.9.4/include/linux/hid.h#L686

bests,
Joël
Comment 69 cnd 2017-01-22 23:12:15 UTC
This guy appears to have made some progress:

https://github.com/cb22/macbook12-spi-driver

but may have been unaware of the $905 bounty:

https://www.bountysource.com/issues/35422234-macbook8-1-12-inch-early-2015-keyboard-and-trackpad-don-t-work

Hopefully this will encourage them :-)
Comment 70 Daniel Roschka 2017-06-13 18:14:49 UTC
For everybody who's not following the git repository of the "applespi" driver (https://github.com/cb22/macbook12-spi-driver), you might be interested to hear that it got a lot of new features in the meanwhile:

- no need to manually patch the ACPI DSDT table anymore
- parameter to set if the keyboard has ANSI or ISO layout
- working CAPS-lock LED
- reliable working touchpad
- working keyboard backlight (very soon)

All in all it's now a pretty good working driver, suitable for productive use. Still not mainline, but I guess that'll eventually come as well.
Comment 71 Wes 2017-06-13 22:42:55 UTC
Any idea if that includes the 2015 model?  The README.md still indicates that it's primarily for the 2016 model
Comment 72 Wes 2017-06-13 22:57:41 UTC
(In reply to Wes from comment #71)
> Any idea if that includes the 2015 model?  The README.md still indicates
> that it's primarily for the 2016 model

Answering my own question for everyone else here, looking at comments in the github issue tracker it appears that this does indeed work for the 2015 model now.  Testing it today, will report back
Comment 73 Wes 2017-06-14 04:59:50 UTC
Not working here on a 4.11.4 kernel.  Looks like I need to downgrade to ~4.6.5 and/or patch DSDT still.  I'll try the earlier kernel first.
Comment 74 psrb191921 2017-06-14 12:48:55 UTC
Does it work on macbook 12' 2017?
Comment 75 Daniel Roschka 2017-06-14 15:40:59 UTC
> Not working here on a 4.11.4 kernel.  Looks like I need to downgrade to
> ~4.6.5 and/or patch DSDT still.  I'll try the earlier kernel first.

According to other users it's working fine with the MacBook8,1 and MacBook9,1 without the need to patch the DSDT.
Ensure you have the other required kernel modules loaded, as noted in the README.
As the MacBook8,1 is the least tested device for this driver (and behaves quite differently) it could be helpful to add your experiences in https://github.com/cb22/macbook12-spi-driver/issues/9

> Does it work on macbook 12' 2017?

So far this is untested, but given that the 12" MacBook 2017 is only a minor update compared to last year, it's likely that it works as well.
I know for sure that it's working at least for the MacBook8,1, MacBook9,1 and all MacBookPro13,x.
Comment 76 Wes 2017-06-14 16:37:58 UTC
> On 15 Jun 2017, at 1:41 am, bugzilla-daemon@bugzilla.kernel.org wrote:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=99891
> 
> --- Comment #75 from Daniel Roschka (danielroschka+kernel@phoenitydawn.de)
> ---
>> Not working here on a 4.11.4 kernel.  Looks like I need to downgrade to
>> ~4.6.5 and/or patch DSDT still.  I'll try the earlier kernel first.
> 
> According to other users it's working fine with the MacBook8,1 and MacBook9,1
> without the need to patch the DSDT.
> Ensure you have the other required kernel modules loaded, as noted in the
> README.
> As the MacBook8,1 is the least tested device for this driver (and behaves
> quite
> differently) it could be helpful to add your experiences in
> https://github.com/cb22/macbook12-spi-driver/issues/9

The reports from the macbook8,1 users are a little contradictory once you read through it all.  Some do say they needed the dsdt patching still in other posts.  One even claims they needed to remove lpss entirely.  I've tried al combinations of kernel/modules reported so far with out luck.  Only thing left is the dsdt patching which will have to wait until this weekend when I get a few free minutes.  I will add my experiences once I've tried everything
Comment 77 Ronald 2017-08-11 02:17:42 UTC
(In reply to Wes from comment #76)
> The reports from the macbook8,1 users are a little contradictory once you
> read through it all.  Some do say they needed the dsdt patching still in
> other posts.  One even claims they needed to remove lpss entirely.  I've
> tried al combinations of kernel/modules reported so far with out luck.  Only
> thing left is the dsdt patching which will have to wait until this weekend
> when I get a few free minutes.  I will add my experiences once I've tried
> everything

The current state for Macbook8,1 is this (see also [1]): you need to configure
 your kernel with "CONFIG_X86_INTEL_LPSS=n", and of course use the latest
"applespi" driver.

One person has claimed that they also need to boot with "irqpoll" - that is
still being investigated.

[1] https://github.com/cb22/macbook12-spi-driver/issues/9#issuecomment-321717493
Comment 78 Wes 2017-08-11 03:38:59 UTC
Thanks for the update, however when I posted that I already had CONFIG_X86_INTEL_LPSS=n and the latest applespi module, it still didn't appear to work for me, with or without irqpoll.  Do we need the DSDT patching as well?
Comment 79 Wes 2017-08-11 04:27:36 UTC
I've just tested again now with the newer applespi code and it seems to be working so far \o/

thanks
Comment 80 Wes 2017-08-11 04:29:21 UTC
Well, the keyboard is at least, no trackpad yet
Comment 81 Ronald 2017-08-11 04:47:20 UTC
Oh, good - I was just writing a comment that you should try the latest
driver since it has some fixes related to MacBook8,1 since your original
post.

Regarding the trackpad, that may be an initialization issue. Does dmesg
show anything (dmesg | grep applespi)? Also, there's a pull request
pending (https://github.com/cb22/macbook12-spi-driver/pull/45) for some
touchpad init fixes - you might want to give that a try.
Comment 82 Wes 2017-08-11 04:55:10 UTC
I wasn't able to spend much time investigating right now, just a quick test while at work.  I'll check dmesg and try that PR tonight from home though.  Thanks for the pointers
Comment 83 Andy Shevchenko 2017-08-12 17:44:58 UTC
(In reply to Ronald from comment #77)
> (In reply to Wes from comment #76)

> The current state for Macbook8,1 is this (see also [1]): you need to
> configure
>  your kernel with "CONFIG_X86_INTEL_LPSS=n"

I didn't get why it doesn't work with this parameter to be set to "y"?
Comment 84 Ronald 2017-08-12 21:50:56 UTC
(In reply to Andy Shevchenko from comment #83)
> (In reply to Ronald from comment #77)
> > The current state for Macbook8,1 is this (see also [1]): you need to
> > configure
> >  your kernel with "CONFIG_X86_INTEL_LPSS=n"
> 
> I didn't get why it doesn't work with this parameter to be set to "y"?

I hope the commit message here explains that sufficiently (apologies for not cc'ing you on the patch submission):
https://patchwork.kernel.org/patch/9889813/
Comment 85 Andy Shevchenko 2017-08-13 09:37:27 UTC
(In reply to Ronald from comment #84)
> (In reply to Andy Shevchenko from comment #83)
> > (In reply to Ronald from comment #77)
> > > The current state for Macbook8,1 is this (see also [1]): you need to
> > > configure
> > >  your kernel with "CONFIG_X86_INTEL_LPSS=n"
> > 
> > I didn't get why it doesn't work with this parameter to be set to "y"?
> 
> I hope the commit message here explains that sufficiently (apologies for not
> cc'ing you on the patch submission):
> https://patchwork.kernel.org/patch/9889813/

It, frankly speaking, makes my confusion even deeper. The code patched by the mentioned commit is only executed when the above option is "y".
Comment 86 Ronald 2017-08-13 21:15:08 UTC
(In reply to Andy Shevchenko from comment #85)
> (In reply to Ronald from comment #84)
> > (In reply to Andy Shevchenko from comment #83)
> > > (In reply to Ronald from comment #77)
> > > > The current state for Macbook8,1 is this (see also [1]): you need to
> > > > configure
> > > >  your kernel with "CONFIG_X86_INTEL_LPSS=n"
> > > 
> > > I didn't get why it doesn't work with this parameter to be set to "y"?
> > 
> > I hope the commit message here explains that sufficiently (apologies for
> not
> > cc'ing you on the patch submission):
> > https://patchwork.kernel.org/patch/9889813/
> 
> It, frankly speaking, makes my confusion even deeper. The code patched by
> the mentioned commit is only executed when the above option is "y".

Sorry, let me try again then: the bug can be avoid by either setting CONFIG_X86_INTEL_LPSS=n or by applying the patch (in which case CONFIG_X86_INTEL_LPSS can be set to y). Since that patch won't be in till kernel 4.14, I'm suggesting to folks who want a working keyboard and touchpad now that they build with CONFIG_X86_INTEL_LPSS=n, at least until the patch has made it into their kernel. Asking folks to change a config option appears to be slightly easier than having them apply a patch, at least for some distros. But of course patching instead will also fix it.
Comment 87 derarnold 2017-10-02 14:41:37 UTC
Hi Guys.

I have tried Ubuntu 17.10 with Mainline Kernel 4.14-RC3 from the Ubuntu Repos 

http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14-rc3/

and the keyboard and touchpad still do not work on the Macbook 2015.

I thought all patches went into 4.14, right? Am I wrong?

Regards Oliver
Comment 88 Andy Shevchenko 2017-10-02 15:01:42 UTC
(In reply to derarnold from comment #87)
> I have tried Ubuntu 17.10 with Mainline Kernel 4.14-RC3 from the Ubuntu
> and the keyboard and touchpad still do not work on the Macbook 2015.
> I thought all patches went into 4.14, right? Am I wrong?

AFAIU you still need to build applespi driver yourself on top of new kernel.
Comment 89 derarnold 2017-10-02 15:44:24 UTC
Ohh. Can I have build a stock kernel before (changed some configs). Can you help me how to build the driver? Do I need to build the kernel first? Where do I find the driver?

Oliver
Comment 90 derarnold 2017-10-02 15:45:51 UTC
Do I need to follow this: https://github.com/cb22/macbook12-spi-driver
?
Comment 91 Ronald 2017-10-02 23:17:25 UTC
(In reply to derarnold from comment #90)
> Do I need to follow this: https://github.com/cb22/macbook12-spi-driver?

Yes. The fix in 4.14 is so you don't have to rebuild/reconfigure your existing kernel in addition to building the driver, but you still need to build the driver (upstreaming that is on the todo list, but we're not quite ready yet).

A slightly updated README with more precise info is available at
https://github.com/roadrunner2/macbook12-spi-driver/blob/9abd71c70f1489a0305a844af3dae1a7876e880c/README.md
(this is queued to be merged into the main README).
Comment 92 derarnold 2017-10-04 13:53:31 UTC
Nice and thank you very much. I will try it out. Keep your fingers crossed ...
Comment 93 Andy Shevchenko 2019-08-06 12:57:59 UTC
Can anybody test on v5.3-rc3 and confirm that it works?

https://elixir.bootlin.com/linux/v5.3-rc3/source/drivers/input/keyboard/applespi.c
Comment 94 Andy Shevchenko 2020-10-12 13:48:34 UTC
I'm about to close this bug since nobody appear to test and confirm the state. So I leave it in need info state for a while (day or two) and then close.
Comment 95 Leif Liddy 2020-10-12 15:29:11 UTC
You can close this ticket. The driver was added to the kernel ages ago. 
I believe initial support was provided in kernel 4.14.

Issues that occurred immediately afterwards were:
Some distros did not initially enable the CONFIG_KEYBOARD_APPLESPI module in the kernel config.

Some distros did not include the applespi module in their initramfs/initrd image, which would allow you to use the keyboard for decrypting a LUKS-encrypted drive at boot time. 

However, these were all distro-related issues (that had nothing to do with the kernel driver itself) that were resolved over time. 

In any case, I think the vast majority of all major distros (if not all) now include support for the CONFIG_KEYBOARD_APPLESPI module and have it included in their initramfs/initrd image as well.

However, not all distros have the dependent modules included in their initramfs/initrd image.
In fact, I just noticed on my Fedora 32 system that the (dependent) spi_pxa2xx_platform module is not included in the initramfs image. But, the the latest Ubuntu distro does have this module in its initrd image. 

I have a dracut config for this, so it's not something that I really ever look at. 
(going to submit a Fedora bug report for this now)
Anyways, this is all distro-specific, the applespi kernel module works fine. 
Thank you to everybody who helped contribute to this!
Comment 96 Andy Shevchenko 2020-10-12 15:32:41 UTC
Now closing based on comment #95. Please, submit tickets to the individual distro bug trackers.

Note You need to log in before you can comment on or make changes to this bug.