diff options
| author | Michael Hunold <hunold@linuxtv.org> | 2003-12-31 19:25:13 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-12-31 19:25:13 -0800 |
| commit | 6569e964a477d71c4602f8a568eb71d99890d623 (patch) | |
| tree | fe71bc52811dac6d17fb628721de4f913f409d5c | |
| parent | e68b286ab3a7b8028cff1624541b12b4ce1be61b (diff) | |
[PATCH] DVB: Add static firmware compilation again
- add Kconfig magic to select a firmware that can be compiled into the
driver
- add some hooks to av7110 to compile a firmware into the driver again
| -rw-r--r-- | drivers/media/dvb/ttpci/Kconfig | 17 | ||||
| -rw-r--r-- | drivers/media/dvb/ttpci/Makefile | 9 | ||||
| -rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 25 | ||||
| -rw-r--r-- | drivers/media/dvb/ttpci/fdump.c | 44 |
4 files changed, 95 insertions, 0 deletions
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index ccb809aab3d5..ff4e96330063 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig @@ -13,6 +13,23 @@ config DVB_AV7110 Say Y if you own such a card and want to use it. +config DVB_AV7110_FIRMWARE + bool "Compile AV7110 firmware into the driver" + depends on DVB_AV7110 + help + The AV7110 firmware is normally loaded by the firmware hotplug manager. + If you want to compile the firmware into the driver you need to say + Y here and provide the correct path of the firmware. You need this + option if you want to compile the whole driver statically into the + kernel. + + All other people say N. + +config DVB_AV7110_FIRMWARE_FILE + string "Full pathname of av7110 firmware file" + depends on DVB_AV7110_FIRMWARE + default "/usr/lib/hotplug/firmware/dvb-ttpci-01.fw" + config DVB_AV7110_OSD bool "AV7110 OSD support" depends on DVB_AV7110 diff --git a/drivers/media/dvb/ttpci/Makefile b/drivers/media/dvb/ttpci/Makefile index 317e401be14e..2c97d5512d2e 100644 --- a/drivers/media/dvb/ttpci/Makefile +++ b/drivers/media/dvb/ttpci/Makefile @@ -12,3 +12,12 @@ obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-core.o budget-patch.o ttpci-eeprom.o obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o ttpci-eeprom.o EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ + +host-progs := fdump + +ifdef CONFIG_DVB_AV7110_FIRMWARE +$(obj)/av7110.o: $(obj)/fdump $(obj)/av7110_firm.h + +$(obj)/av7110_firm.h: + $(obj)/fdump $(CONFIG_DVB_AV7110_FIRMWARE_FILE) dvb_ttpci_fw $@ +endif diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index dd854a4c5452..f2a1dd6f47ed 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -4498,9 +4498,21 @@ static u8 saa7113_init_regs[] = { static struct saa7146_ext_vv av7110_vv_data_st; static struct saa7146_ext_vv av7110_vv_data_c; + + + + +#ifdef CONFIG_DVB_AV7110_FIRMWARE_FILE +#include "av7110_firm.h" +#endif + static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext) { +#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE const struct firmware *fw; +#else + struct firmware *fw; +#endif struct av7110 *av7110 = NULL; int ret = 0; u32 crc = 0, len = 0; @@ -4508,12 +4520,22 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ DEB_EE(("dev: %p, av7110: %p\n",dev,av7110)); +#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE /* request the av7110 firmware, this will block until someone uploads it */ ret = request_firmware(&fw, "dvb-ttpci-01.fw", &dev->pci->dev); if ( 0 != ret ) { printk("dvb-ttpci: cannot request firmware!\n"); return -EINVAL; } +#else + fw = vmalloc(sizeof(struct firmware)); + if (NULL == fw) { + printk("dvb-ttpci: not enough memory\n"); + return -ENOMEM; + } + fw->size = sizeof(dvb_ttpci_fw); + fw->data = dvb_ttpci_fw; +#endif if (fw->size <= 200000) { printk("dvb-ttpci: this firmware is way too small.\n"); @@ -4580,6 +4602,9 @@ static int av7110_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_ av7110->bin_root = ptr; av7110->size_root = len; +#ifdef CONFIG_DVB_AV7110_FIRMWARE_FILE + vfree(fw); +#endif /* go on with regular device initialization */ av7110->card_name = (char*)pci_ext->ext_priv; av7110->dev=(struct saa7146_dev *)dev; diff --git a/drivers/media/dvb/ttpci/fdump.c b/drivers/media/dvb/ttpci/fdump.c new file mode 100644 index 000000000000..0b478db3e744 --- /dev/null +++ b/drivers/media/dvb/ttpci/fdump.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +int main(int argc, char **argv) +{ + unsigned char buf[8]; + unsigned int i, count, bytes = 0; + FILE *fd_in, *fd_out; + + if (argc != 4) { + fprintf(stderr, "\n\tusage: %s <ucode.bin> <array_name> <output_name>\n\n", argv[0]); + return -1; + } + + fd_in = fopen(argv[1], "rb"); + if (fd_in == NULL) { + fprintf(stderr, "firmware file '%s' not found\n", argv[1]); + return -1; + } + + fd_out = fopen(argv[3], "w+"); + if (fd_out == NULL) { + fprintf(stderr, "cannot create output file '%s'\n", argv[3]); + return -1; + } + + fprintf(fd_out, "\n#include <asm/types.h>\n\nu8 %s [] = {", argv[2]); + + while ((count = fread(buf, 1, 8, fd_in)) > 0) { + fprintf(fd_out, "\n\t"); + for (i = 0; i < count; i++, bytes++) + fprintf(fd_out, "0x%02x, ", buf[i]); + } + + fprintf(fd_out, "\n};\n\n"); + + fclose(fd_in); + fclose(fd_out); + + return 0; +} |
