From 72f297be4182a7ebc0db2f38eb7ada75ad7b2ee4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 24 Jul 2008 13:15:47 -0300 Subject: backport commit 0a2a736afa91e8a0402c9dbdaf2ee28481a50bd3 From: Mauro Carvalho Chehab kernel-sync: Author: David Woodhouse Date: Thu May 29 19:50:06 2008 +0300 ttusb-budget: use request_firmware() This patch will keep using the enclosed .h firmware for out-of-kernel compilations. For in-kernel compilation, it will use the firmware on a .bin file that is linkedited together with dvb-ttusb-budget target. On both cases, the firmware will be inside dvb-ttusb-budget.ko module. Signed-off-by: Mauro Carvalho Chehab --- .../media/dvb/ttusb-budget/dvb-ttusb-budget.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'linux/drivers/media/dvb/ttusb-budget') diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 133648277..ceae085cb 100644 --- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -21,6 +21,9 @@ #include #include "compat.h" #include +#ifdef TTUSB_KERNEL +#include +#endif #include "dvb_frontend.h" #include "dmxdev.h" @@ -287,13 +290,27 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num return i; } +#ifndef TTUSB_KERNEL #include "dvb-ttusb-dspbootcode.h" +#endif static int ttusb_boot_dsp(struct ttusb *ttusb) { +#ifdef TTUSB_KERNEL + const struct firmware *fw; +#endif int i, err; u8 b[40]; +#ifdef TTUSB_KERNEL + err = request_firmware(&fw, "ttusb-budget/dspbootcode.bin", + &ttusb->dev->dev); + if (err) { + printk(KERN_ERR "ttusb-budget: failed to request firmware\n"); + return err; + } + +#endif /* BootBlock */ b[0] = 0xaa; b[2] = 0x13; @@ -301,8 +318,13 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) /* upload dsp code in 32 byte steps (36 didn't work for me ...) */ /* 32 is max packet size, no messages should be splitted. */ +#ifndef TTUSB_KERNEL for (i = 0; i < sizeof(dsp_bootcode); i += 28) { memcpy(&b[4], &dsp_bootcode[i], 28); +#else + for (i = 0; i < fw->size; i += 28) { + memcpy(&b[4], &fw->data[i], 28); +#endif b[1] = ++ttusb->c; @@ -1809,3 +1831,6 @@ module_exit(ttusb_exit); MODULE_AUTHOR("Holger Waechtler "); MODULE_DESCRIPTION("TTUSB DVB Driver"); MODULE_LICENSE("GPL"); +#ifdef TTUSB_KERNEL +MODULE_FIRMWARE("ttusb-budget/dspbootcode.bin"); +#endif -- cgit v1.2.3