Some DVB cards and many newer frontends require proprietary,
binary-only firmware.

The DVB drivers will be converted to use the request_firmware()
hotplug interface (see linux/Documentation/firmware_class/).
(CONFIG_FW_LOADER)

The firmware can be loaded automatically via the hotplug manager
or manually with the steps described below.

Currently the drivers still use various different methods
to load their firmwares, so here's just a short list of the
current state:

- dvb-ttpci: driver uses firmware hotplug interface
- ttusb-budget: firmware is compiled in (dvb-ttusb-dspbootcode.h)
- sp887x: firmware is compiled in (sp887x_firm.h)
- alps_tdlb7: firmware is loaded from path specified by
		"mcfile" module parameter; the binary must be
		extracted from the Windows driver (Sc_main.mc).
- tda1004x: firmware is loaded from path specified in
		DVB_TDA1004X_FIRMWARE_FILE kernel config
		variable (default /usr/lib/hotplug/firmware/tda1004x.bin); the
		firmware binary must be extracted from the windows
		driver
- ttusb-dec: see "ttusb-dec.txt" for details

1) Automatic firmware loading

You need to install recent hotplug scripts if your distribution did not do it
for you already, especially the  /etc/hotplug/firmware.agent.
http://linux-hotplug.sourceforge.net/ (Call /sbin/hotplug without arguments
to find out if the firmware agent is installed.)

The firmware.agent script expects firmware binaries in
/usr/lib/hotplug/firmware/. To avoid naming and versioning
conflicts we propose the following naming scheme:

  /usr/lib/hotplug/firmware/dvb-{driver}-{ver}.fw	for MPEG decoders etc.
  /usr/lib/hotplug/firmware/dvb-fe-{driver}-{ver}.fw	for frontends

  {driver} name is the basename of the driver kernel module (e.g. dvb-ttpci)
  {ver} is a version number/name that should change only when the
  driver/firmware internal API changes (so users are free to install the
  latest firmware compatible with the driver).

2) Manually loading the firmware into a driver
   (currently only the dvb-ttpci / av7110 driver supports this)
   
Step a) Mount sysfs-filesystem.

Sysfs provides a means to export kernel data structures, their attributes,
and the linkages between them to userspace. 

For detailed informations have a look at Documentation/filesystems/sysfs.txt 
All you need to know at the moment is that firmware loading only works through
sysfs.

> mkdir /sys
> mount -t sysfs sysfs /sys

Step b) Exploring the firmware loading facilities

Firmware_class support is located in
/sys/class/firmware

> dir /sys/class/firmware

The "timeout" values specifies the amount of time that is waited before the
firmware upload  process is cancelled. The default values is 10 seconds. If
you use a hotplug script for the firmware upload, this is sufficient. If
you want to upload the firmware by hand, however, this might be too fast.

> echo "180" > /sys/class/firmware/timeout

Step c) Getting a usable firmware file for the dvb-ttpci driver/av7110 card.

You can download the firmware files from
http://linuxtv.org/download/dvb/

Please note that in case of the dvb-ttpci driver this is *not* the "Root"
file you probably know from the 2.4 DVB releases driver.

The ttpci-firmware utility from linuxtv.org CVS can be used to
convert Dpram and Root files into a usable firmware image.
See dvb-kerrnel/scripts/ in http://linuxtv.org/cvs/.

> wget http://www.linuxtv.org/download/dvb/dvb-ttpci-01.fw
gets you the version 01 of the firmware fot the ttpci driver.

Step d) Loading the dvb-ttpci driver and loading the firmware

"modprobe" will take care that every needed module will be loaded
automatically (except the frontend driver)

> modprobe dvb-ttpci

The "modprobe" process will hang until
a) you upload the firmware or
b) the timeout occurs.

Change to another terminal and have a look at 

> dir /sys/class/firmware/

total 0
drwxr-xr-x    2 root     root            0 Jul 29 11:00 0000:03:05.0
-rw-r--r--    1 root     root            0 Jul 29 10:41 timeout

"0000:03:05.0" is the id for my dvb-c card. It depends on the pci slot,
so it changes if you plug the card to different slots.

You can upload the firmware like that:

> export DEVDIR=/sys/class/firmware/0000\:03\:05.0
> echo 1 > $DEVDIR/loading
> cat dvb-ttpci-01.fw > $DEVDIR/data
> echo 0 > $DEVDIR/loading

That's it. The driver should be up and running now.
