A driver for the PlanB video input of the PowerMac 7x00/8x00 series

Apple had the good idea to equip the popular 7x00/8x00 series of PCI PowerMacintosh computers with a video-input. Unfortunately, until now, this video input has been useless under Linux.

Discovering Alan Cox' video4linux, a generic API in the kernel for video input devices, I decided to give writing a Linux driver a try.

I'll prepare a page with some documentation about the hardware details of the video input. It is built around a Philips video chipset and an Apple ASIC that does DMA and has some glue logic.

The most difficult part was to get at the hardware specs. The two Philips video chips are well documented, but the DMA controller, code-named PlanB, is not documented in any publicly available document that I know of.

So, I had a few sleepless nights switching between MacOS and MacsBug, before I got it all pretty much sorted out. Time to sit down and hack a few lines of C! Gee, it had been a while since I'd done this the last time...

I started with Ralph Metzler's bttv driver, used for the Brooktre BT848 chips found in most common PC video boards. I reused Ralph's framework and added the specifics of the PlanB hardware. The hardest part was programming the DMA engine, but once I got docs from Apple about their DMA implementation, it started to make sense and I eventually got it running.

That's when Takashi Oe dropped in and helped clean out remaining bugs and added lots of functionality. Right now, the driver is working on 24/32 bpp and 16 bpp displays under Xpmac and XF68_FBDev, on kernel version 2.1.125, for PAL, SECAM and NTSC. Both the composite and the SVHS input are supported, and the picture settings can be adjusted. There is no audio support at this time, but XawTV can be made to switch to the correct audio input.

This is the older release 0.06, the first release to include grabbing support.

Here is release 1.0. It includes grayscale support as well. Nothing new apart from that, though; I released it mostly because I didn't have any bug reports on 0.06, and thought PlanB was ready for primetime now!

The readme file for PlanB-1.0 is here.

The tarball for PlanB now includes a sofisticated ;-) Makefile; try 'make' to get a list of possible targets. Among other things, it can build the planb.o and videodev.o modules outside of the kernel source tree (i.e. no patching needed). However, you will need the kernel sources installed.

Starting at kernel 2.2.8, PlanB is part of the official kernel tree, as distributed via ftp.kernel.org and its mirrors. So no need to patch the kernels newer than 2.2.8.

However, the version included in the official kernel has a bug with interrupts. Here is a patch for kernel 2.2.15 as found on ftp.kernel.org.

The 2.2.15 patch is integrated in the 2.3 kernel series starting 2.3.99-pre6. You really shouldn't run any 2.3 kernel older than that...

More recent versions of PlanB patches for 2.2 series kernels:

The 2.2.18 patch applies cleanly to more recent 2.2 kernels. Normally, the forthcoming 2.2.21 kernel should include the above patch.

As for 2.4 kernels, due to changes in kernel APIs, you need the patches below in order to use PlanB. In case you want to play with videotext on PlanB (and crash your machine real fast ;-), all 2.4 patches include basic videotext support via the /dev/vbi0 device. But it will crash your machine sooner or later!

Some patches against older 2.4 kernels:

New!Updated 20020403: Staying home ill can have nice side effects: I have worked a few days on PlanB and fixed a few things:

VBI is still untested; it will probably crash your machine.

Ah yes, you need some kind of application to actually use PlanB. I suggest XawTV, which you can find here.

The latest release of XawTV at this time is 3.38. I have put up a source RPM package and a binary RPM package. There are also the other XawTV binary packages: misc   radio   webcam. I haven't tested these; and obviously radio isn't of much use for planb systems. It might work with radio cards, however.

For those few with R4 systems (have you ever considered upgrading?), here is xawtv-3.01, xawtv-misc-3.01 and xawtv-radio-3.01, the latest versions I have compiled for R4 systems. Since I'm not maintaining an R4 system anymore, there won't be any newer versions.

Important: When upgrading from XawTV 2.xx to version 3.xx, you need to adapt your .xawtv startup file. Here is mine.

Other V4L-compliant apps might also work, but are not tested. There may be some format or byteorder issues. fbtv (console-only app) of the above packages is known to coredump on R4.

Don't forget to keep me posted on your experiences with PlanB!

Enjoy ;-)

To be continued....

Michel Lanners, 20020403