b1c1l1BlogMacBookPro8,2 Kernel Patches for Linux 3.1.1

MacBookPro8,2 Kernel Patches for Linux 3.1.1

November 19, 2011 · linux · macbook pro

I have run Gentoo Linux on multiple generations of the MacBook Pro since its introduction in 2006:

  • MacBookPro1,1
  • MacBookPro5,3
  • MacBookPro8,2

However, Apple uses bleeding edge and sometimes proprietary hardware in their products, which can be problematic for users of operating systems other than Mac OS because Apple does not provide drivers for those operating systems. This is especially true with the latest generation of hardware, which includes the second generation Intel Core processors, codenamed Sandy Bridge, with on-socket integrated Intel HD Graphics.

Consequently, I have compiled a set of patches for the Linux kernel that improves support for the 15-inch MacBookPro8,2:

blee@supra ~ $ sudo dmidecode -s system-product-name
MacBookPro8,2
blee@supra ~ $ lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation 2nd Generation Core Processor Family DRAM Controller [8086:0104] (rev 09)
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port [8086:0101] (rev 09)
00:01.1 PCI bridge [0604]: Intel Corporation Sandy Bridge PCI Express Root Port [8086:0105] (rev 09)
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0126] (rev 09)
00:16.0 Communication controller [0780]: Intel Corporation Cougar Point HECI Controller #1 [8086:1c3a] (rev 04)
00:1a.0 USB Controller [0c03]: Intel Corporation Cougar Point USB Universal Host Controller #5 [8086:1c2c] (rev 05)
00:1a.7 USB Controller [0c03]: Intel Corporation Cougar Point USB Enhanced Host Controller #2 [8086:1c2d] (rev 05)
00:1b.0 Audio device [0403]: Intel Corporation Cougar Point High Definition Audio Controller [8086:1c20] (rev 05)
00:1c.0 PCI bridge [0604]: Intel Corporation Cougar Point PCI Express Root Port 1 [8086:1c10] (rev b5)
00:1c.1 PCI bridge [0604]: Intel Corporation Cougar Point PCI Express Root Port 2 [8086:1c12] (rev b5)
00:1c.2 PCI bridge [0604]: Intel Corporation Cougar Point PCI Express Root Port 3 [8086:1c14] (rev b5)
00:1d.0 USB Controller [0c03]: Intel Corporation Cougar Point USB Universal Host Controller #1 [8086:1c27] (rev 05)
00:1d.7 USB Controller [0c03]: Intel Corporation Cougar Point USB Enhanced Host Controller #1 [8086:1c26] (rev 05)
00:1f.0 ISA bridge [0601]: Intel Corporation HM65 Express Chipset Family LPC Controller [8086:1c49] (rev 05)
00:1f.2 SATA controller [0106]: Intel Corporation Cougar Point 6 port SATA AHCI Controller [8086:1c03] (rev 05)
00:1f.3 SMBus [0c05]: Intel Corporation Cougar Point SMBus Controller [8086:1c22] (rev 05)
01:00.0 VGA compatible controller [0300]: ATI Technologies Inc Whistler [AMD Radeon HD 6600M Series] [1002:6741]
01:00.1 Audio device [0403]: ATI Technologies Inc Device [1002:aa90]
02:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM57765 Gigabit Ethernet PCIe [14e4:16b4] (rev 10)
02:00.1 SD Host controller [0805]: Broadcom Corporation NetXtreme BCM57765 Memory Card Reader [14e4:16bc] (rev 10)
03:00.0 Network controller [0280]: Broadcom Corporation BCM4331 802.11a/b/g/n [14e4:4331] (rev 02)
04:00.0 FireWire (IEEE 1394) [0c00]: Agere Systems FW643 PCI Express1394b Controller (PHY/Link) [11c1:5901] (rev 08)

These patches will also be useful for users of the 13-inch MacBookPro8,1 and 17-inch MacBookPro8,3 but I have not tested those models because I do not have access to them.

The following patches are for Linux 3.1.1:

  • apple_bl-gmux.patch

    The display backlight on the MacBookPro8,2 is controlled by the Apple gMux. This patch adds Apple gMux support to the apple_bl driver to enable control of the display backlight.

    The following kernel parameters must be specified to use the Apple gMux to control the display backlight:

    acpi_backlight=vendor apple_bl.use_gmux=1

    Related links:

  • apple_gmux.patch

    The MacBookPro8,2 includes two GPUs: the integrated Intel HD Graphics 3000 and the discrete ATI Radeon HD 6750M. In Mac OS, the discrete GPU is activated when an external monitor is connected or certain graphics-intensive applications are launched. This patch adds a driver for the Apple gMux to enable switching between GPUs using the vga_switcheroo mechanism. This patch is unnecessary when booting into BIOS emulation mode because the UEFI firmware prevents the integrated GPU from being accessed in BIOS emulation mode.

    Related links:

  • b43-ht-phy.patch

    The Broadcom BCM4331 wireless chip in the MacBookPro8,2 is currently unsupported in the mainline kernel. This patch adds support for HT-PHY devices, including the BCM4331, to the b43 driver. I generated this patch by pulling the latest versions of the b43 driver and the related modules, bcma and ssb, from the wireless-testing.git tree. The b43 driver is currently the only driver with BCM4331 support, but the brcm80211 driver may add BCM4331 support in the near future.

    Related links:

  • efifb-hi-res.patch

    My MacBookPro8,2 includes a high-resolution 1680x1050 display, which meant that the hard coded display information in the efifb driver was not correct for my display. This patch updates the efifb driver with the proper display information for the high-resolution display.

    The display information was obtained using DTrace in Mac OS:

    blee@supra ~ $ sudo ioreg -lw0 | grep product-name | cut -d'"' -f4
    MacBookPro8,2
    blee@supra ~ $ sudo dtrace -qn 'BEGIN {
    > boot_args = (struct boot_args *) (`PE_state).bootArgs;
    > printf("FrameBufferBase: 0x%08x\n", boot_args->Video.v_baseAddr);
    > printf("PixelsPerScanLine: %d\n", boot_args->Video.v_rowBytes/4);
    > printf("HorizontalResolution: %d\n", boot_args->Video.v_width);
    > printf("VerticalResolution: %d", boot_args->Video.v_height);
    > exit(0);
    > }'
    FrameBufferBase: 0x90010000
    PixelsPerScanLine: 1728
    HorizontalResolution: 1680
    VerticalResolution: 1050

    Related links:

  • i915-lvds_channels.patch

    By default, the i915 driver probes the video BIOS to determine the number of LVDS channels. However, this probing fails to correctly determine the number of LVDS channels on the MacBookPro8,2. This patch allows the number of LVDS channels to be set manually.

    The following kernel parameter must be specified to enable dual channel mode:

    i915.lvds_channels=2

    Related links:

  • quirks-mbp_force_ahci.patch

    When booting into BIOS emulation mode, the UEFI firmware puts the SATA controller into legacy IDE mode. This patch adds a quirk to force the SATA controller into AHCI mode. This patch is unnecessary when booting into EFI mode because the SATA controller uses AHCI by default in EFI mode.

    The following kernel parameter must be specified in order to force the SATA controller into AHCI mode:

    quirks.mbp_force_ahci=1

    Related links:

  • radeon-read_bios_from_firmware.patch

    When booting into EFI mode, the UEFI firmware does not load a video BIOS into memory. This lack of a video BIOS prevents both the radeon and fglrx drivers from functioning. This patch allows the radeon driver to read the video BIOS from a firmware file instead of from memory. The firmware file can be generated by dumping the video BIOS while booted into BIOS emulation mode.

    The following command can be used to dump the video BIOS while booted into BIOS emulation mode:

    dd if=/dev/mem of=/lib/firmware/radeon/vbios.bin bs=65536 skip=12 count=1

    Related links:

« Blog