Skip to content

Add macbook12-spi-driver with kernel 6.17 compatibility fixes (PR #77)#3

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-compilation-errors-linux-kernel-6-17
Closed

Add macbook12-spi-driver with kernel 6.17 compatibility fixes (PR #77)#3
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-compilation-errors-linux-kernel-6-17

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

The macbook12-spi-driver (Touch Bar, keyboard, trackpad, ALS) fails to compile on Linux kernel 6.17 due to 16 API breakages across four modules. This adds the full driver source with all fixes from roadrunner2/macbook12-spi-driver#77 applied.

Changes by file

  • applespi.c — 8 fixes:

    • asm/unaligned.hlinux/unaligned.h
    • spi_transfer.delay_usecsdelay.value + delay.unit = SPI_DELAY_UNIT_USECS (4 instances)
    • no_llseeknoop_llseek
    • Replace deprecated efivar_entry_get/set_safe with efivar_get_variable / efivar_set_variable
    • applespi_remove / appleacpi_remove: intvoid
    • Remove .owner = THIS_MODULE from struct acpi_driver
    • Add MODULE_IMPORT_NS("EFIVAR")
  • apple-ibridge.c — 3 fixes:

    • appleib_report_fixup return type: __u8 *const __u8 *
    • appleib_remove: intvoid
    • Remove .owner from acpi_driver
  • apple-ib-tb.c — 1 fix:

    • appletb_platform_remove: intvoid
  • apple-ib-als.c — 3 fixes:

    • iio_device_alloc / iio_trigger_alloc now require parent struct device * as first arg
    • iio_dev->idiio_device_id(iio_dev)
    • appleals_platform_remove: intvoid
  • Supporting files: Makefile, dkms.conf, applespi.h, applespi_trace.h, apple-ibridge.h

Example: SPI delay fix

/* Before — removed field */
dl_t->delay_usecs = applespi->spi_settings.spi_cs_delay;

/* After — new struct layout */
dl_t->delay.value = applespi->spi_settings.spi_cs_delay;
dl_t->delay.unit  = SPI_DELAY_UNIT_USECS;
Original prompt

Create a fork of roadrunner2/macbook12-spi-driver and apply the changes from pull request #77 (Fix compilation errors for Linux kernel 6.17) to make it compatible with kernel 6.17+.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: I'm just install Ubuntu24 on my Macbook Pro2017, I need to support my drive and other things like touchbar, speaker, wifi and so on

Assistant: To get all your hardware working on a 2017 MacBook Pro running Ubuntu, the best and most comprehensive community resource is the Dunedan/mbp-2016-linux repository. This repository tracks the state of Linux on 2016 and 2017 MacBook Pros and provides step-by-step solutions for missing drivers.

Here is a breakdown of what you'll need to do for your specific components:

1. Wi-Fi

On 2017 models, the Broadcom Wi-Fi card usually requires proprietary drivers.

  • You will need to install the bcmwl-kernel-source package.
  • If you don't have internet right now, you might need to tether your phone via USB to download the driver first.
  • Command: sudo apt install bcmwl-kernel-source

2. Touchbar

The Touchbar requires a specific driver called macbook12-spi-driver or the appletb driver, depending on your kernel.

  • Most modern solutions for the Touchbar use roadrunner2/macbook12-spi-driver.
  • Follow the instructions in the repository to compile and install the module via DKMS, which will enable the Touchbar to function with standard function keys.

3. Audio / Speakers

Audio is historically the most complex part of getting Linux working perfectly on this generation of MacBooks.

  • You will likely need to install a specific audio driver to get the internal speakers to work.
  • Look into the davidjo/snd_hda_macbookpro repository, which provides a script to set up the necessary kernel modules for sound on modern MacBooks.

4. Suspend / Wake

Suspend can sometimes be finicky on these models. The Dunedan repo contains specific GRUB boot parameters and fixes to ensure your laptop wakes up correctly when you open the lid.

Next Steps:

I highly recommend reading through the State of Linux on the MacBook Pro 2016 & 2017 README. It includes a support matrix and links to the specific drivers you need for your exact model (either MacBookPro14,1, MacBookPro14,2, or MacBookPro14,3).

User: How should I do to use my touchbar?

Assistant: To get your Touchbar working on Ubuntu 24, you'll need to install the macbook12-spi-driver created by the community (specifically by the user roadrunner2). This driver package handles the Touchbar (via the iBridge chip), as well as the internal keyboard and trackpad for 2016/2017 MacBooks.

Here are the step-by-step instructions to install it using DKMS (Dynamic Kernel Module Support), which ensures the driver stays installed even when Ubuntu updates your kernel.

Open your terminal and run the following commands:

1. Add the necessary modules to initramfs

First, you need to tell Ubuntu to load the SPI and Apple drivers during boot:

sudo bash -c 'echo -e "\n# applespi\napplespi\nspi_pxa2xx_platform\nintel_lpss_pci" >> /etc/initramfs-tools/modules'

2. Install DKMS and Git

Make sure you have git and dkms installed so you can download and build the driver:

sudo apt update
sudo apt install git dkms

3. Download and Install the Driver

Clone the repository into the /usr/src directory, then use DKMS to install it:

sudo git clone https://github.com/roadrunner2/macbook12-spi-driver.git /usr/src/applespi-0.1
sudo dkms install -m applespi -v 0.1

4. Update Initramfs

After the driver is installed, update your initial ramdisk so the new modules are included on the next boot:

sudo update-initramfs -u

5. Reboot

Restart your MacBook:

sudo reboot

How the Touchbar will work:

Once rebooted, the apple_ibridge and apple_ib_tb kernel modules will load automatically.

  • It provides basic Touchbar functionality, showing the standard F1-F12 function keys and media controls.
  • It will switch modes based on whether you are holding the Fn key.
  • The Touchbar will automatically dim and turn off after 5 minutes of inactivity to save battery, and wake up instantly when you touch the trackpad, keyboard, or Touchbar itself.

User: I: The initramfs will attempt to resume from /dev/nvme0n1p3
I: (UUID=b09ba33e-606a-49da-9ba2-1875c24ad88b)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
broadcom-sta-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
lesliekeys@lesliekeys-MacBookPro:~/Downloads$

Assistant: The error you are seeing is because the broadcom-sta-dkms package (which provides the proprietary wl dri...

This pull request was created from Copilot chat.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Applied all fixes from roadrunner2/macbook12-spi-driver#77:
- applespi.c: linux/unaligned.h header, SPI delay struct fields,
  noop_llseek, efivar API update, void remove callbacks,
  remove .owner from acpi_driver, MODULE_IMPORT_NS(EFIVAR)
- apple-ibridge.c: const report_fixup return type, void remove,
  remove .owner from acpi_driver
- apple-ib-tb.c: void platform_remove callback
- apple-ib-als.c: iio_device_alloc/iio_trigger_alloc parent arg,
  iio_device_id(), void platform_remove callback

Co-authored-by: LeslieKeys <66516783+LeslieKeys@users.noreply.github.com>
Agent-Logs-Url: https://github.com/LeslieKeys/skills-introduction-to-github/sessions/0b2ef6e7-9a92-4b51-b4a4-16034156f587
Copilot AI changed the title [WIP] Fix compilation errors for Linux kernel 6.17+ Add macbook12-spi-driver with kernel 6.17 compatibility fixes (PR #77) Mar 21, 2026
Copilot AI requested a review from LeslieKeys March 21, 2026 15:29
@LeslieKeys LeslieKeys closed this Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants