Categories
Geekery Kernel Linux MacBook Air

FaceTime Webcam

The last piece

The webcam built into the MacBook Air is quite odd in a number of ways. It appears to use an unusual hardware configuration involving a wifi-disabled Broadcom BCM15700A2 chip – and it was the one piece of hardware that didn’t work out-the-box on the Linux Mint installation. I also identified it as the culprit that was preventing deep CPU package sleep states (and hence full battery life) under Gentoo.

It isn’t too difficult to get it working properly – but it does require a custom firemware driver and activation of the right kernel modules.

Webcam firmware driver

Fortunately, this is all automated using the FaceTimeHD driver available on github at patjak/facetimehd. This will download and extract some firmware from apple, and then add the appropriate kernel module to run the webcam.

On Gentoo, this has been conveniently packaged up on a custom overlay called toaster. Once you’ve added it to layman as documented here, you just need to set the ~amd64 keyword for the driver and firmware packages needed to install. These are:

media-video/apple_facetimehd_firmware
media-video/bcwc_pcie

then install the packages.

Kernel Modules

The webcam system (facetimehd) uses the Video for Linux 2 (V4L2) videobuf drivers, specifically ipu3-cio2 It’s important to make sure these are compiled as kernel modules rather than integrated. To do this, ensure CONFIG_VIDEO_IPU3_CIO2 is set to modular:

-> Device Drivers
    -> Multimedia support (MEDIA_SUPPORT [=y])
        [*]  Autoselect ancillary drivers (tuners, sensors, i2c, spi, frontends) (CONFIG_MEDIA_SUBDRV_AUTOSELECT)
        -> Media device types
            [*]   Cameras and video grabbers (CONFIG_MEDIA_CAMERA_SUPPORT)
        -> Media drivers
            -> Media PCI Adapters (MEDIA_PCI_SUPPORT [=y])
                <M>   Intel ipu3-cio2 driver (CONFIG_VIDEO_IPU3_CIO2)

If you then have problems with the webcam preventing package sleep and eating up battery life, you can then prevent it loading on boot by blacklisting the modules:

blacklist facetimehd
blacklist videobuf2_dma_sg
blacklist videobuf2_memops
blacklist videobuf2_v4l2
blacklist videobuf2_common

When you want to use the webcam, you’ll just need to load the module:

modprobe facetimehd
Cheese
Webcam reveals I need a shave