The patch number 8514 was added via Jean-Francois Moine <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

merge: v4l-dvb


---

 linux/Documentation/video4linux/w9968cf.txt             |    3 
 linux/drivers/media/dvb/dvb-core/dvb_net.c              |    8 +
 linux/drivers/media/dvb/dvb-core/dvbdev.c               |    6 
 linux/drivers/media/dvb/dvb-usb/dw2102.h                |    2 
 linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c |   25 +++
 linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c           |    4 
 linux/drivers/media/video/cpia2/cpia2_core.c            |   54 ++++++
 linux/drivers/media/video/dabusb.c                      |   80 +++++++++-
 linux/drivers/media/video/usbvideo/vicam.c              |   43 +++++
 v4l/scripts/gentree.pl                                  |    2 
 10 files changed, 217 insertions(+), 10 deletions(-)

diff -r 28b8203a830e -r 4c0004ee02c2 linux/Documentation/video4linux/w9968cf.txt
--- a/linux/Documentation/video4linux/w9968cf.txt       Fri Jul 25 13:53:03 
2008 +0200
+++ b/linux/Documentation/video4linux/w9968cf.txt       Fri Jul 25 13:53:43 
2008 +0200
@@ -193,9 +193,6 @@ Description:     Automatic 'ovcamchip' m
                 loads that module automatically. This action is performed as
                 once soon as the 'w9968cf' module is loaded into memory.
 Default:         1
-Note:            The kernel must be compiled with the CONFIG_KMOD option
-                enabled for the 'ovcamchip' module to be loaded and for
-                this parameter to be present.
 -------------------------------------------------------------------------------
 Name:           simcams
 Type:           int
diff -r 28b8203a830e -r 4c0004ee02c2 linux/drivers/media/dvb/dvb-core/dvb_net.c
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c        Fri Jul 25 13:53:03 
2008 +0200
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c        Fri Jul 25 13:53:43 
2008 +0200
@@ -1165,7 +1165,11 @@ static void wq_set_multicast_list (struc
 #ifdef OLD_XMIT_LOCK   /* Kernels equal or lower than 2.6.17 */
        spin_lock_bh(&dev->xmit_lock);
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
        netif_tx_lock_bh(dev);
+#else
+       netif_addr_lock_bh(dev);
+#endif
 #endif
 
        if (dev->flags & IFF_PROMISC) {
@@ -1194,7 +1198,11 @@ static void wq_set_multicast_list (struc
 #ifdef OLD_XMIT_LOCK   /* Kernels equal or lower than 2.6.17 */
        spin_unlock_bh(&dev->xmit_lock);
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
        netif_tx_unlock_bh(dev);
+#else
+       netif_addr_unlock_bh(dev);
+#endif
 #endif
        dvb_net_feed_start(dev);
 }
diff -r 28b8203a830e -r 4c0004ee02c2 linux/drivers/media/dvb/dvb-core/dvbdev.c
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.c Fri Jul 25 13:53:03 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c Fri Jul 25 13:53:43 2008 +0200
@@ -242,9 +242,15 @@ int dvb_register_device(struct dvb_adapt
 
        mutex_unlock(&dvbdev_register_lock);
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26)
+       clsdev = device_create_drvdata(dvb_class, adap->device,
+                              MKDEV(DVB_MAJOR, nums2minor(adap->num, type, 
id)),
+                              NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
+#else
        clsdev = device_create(dvb_class, adap->device,
                               MKDEV(DVB_MAJOR, nums2minor(adap->num, type, 
id)),
                               "dvb%d.%s%d", adap->num, dnames[type], id);
+#endif
        if (IS_ERR(clsdev)) {
                printk(KERN_ERR "%s: failed to create device dvb%d.%s%d 
(%ld)\n",
                       __func__, adap->num, dnames[type], id, PTR_ERR(clsdev));
diff -r 28b8203a830e -r 4c0004ee02c2 linux/drivers/media/dvb/dvb-usb/dw2102.h
--- a/linux/drivers/media/dvb/dvb-usb/dw2102.h  Fri Jul 25 13:53:03 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/dw2102.h  Fri Jul 25 13:53:43 2008 +0200
@@ -2,7 +2,7 @@
 #define _DW2102_H_
 
 #define DVB_USB_LOG_PREFIX "dw2102"
-#include <dvb-usb.h>
+#include "dvb-usb.h"
 
 extern int dvb_usb_dw2102_debug;
 #define deb_xfer(args...) dprintk(dvb_usb_dw2102_debug, 0x02, args)
diff -r 28b8203a830e -r 4c0004ee02c2 
linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
--- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c   Fri Jul 25 
13:53:03 2008 +0200
+++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c   Fri Jul 25 
13:53:43 2008 +0200
@@ -21,6 +21,9 @@
 #include <linux/jiffies.h>
 #include "compat.h"
 #include <linux/mutex.h>
+#ifdef TTUSB_KERNEL
+#include <linux/firmware.h>
+#endif
 
 #include "dvb_frontend.h"
 #include "dmxdev.h"
@@ -287,13 +290,27 @@ static int master_xfer(struct i2c_adapte
        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 *
 
        /* 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_AUTHOR("Holger Waechtler <holger@
 MODULE_AUTHOR("Holger Waechtler <[EMAIL PROTECTED]>");
 MODULE_DESCRIPTION("TTUSB DVB Driver");
 MODULE_LICENSE("GPL");
+#ifdef TTUSB_KERNEL
+MODULE_FIRMWARE("ttusb-budget/dspbootcode.bin");
+#endif
diff -r 28b8203a830e -r 4c0004ee02c2 
linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c
--- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c     Fri Jul 25 13:53:03 
2008 +0200
+++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c     Fri Jul 25 13:53:43 
2008 +0200
@@ -1284,7 +1284,11 @@ static int ttusb_dec_boot_dsp(struct ttu
        u8 b1[] = { 0x61 };
        u8 *b;
        char idstring[21];
+#ifndef TTUSB_KERNEL
        u8 *firmware = NULL;
+#else
+       const u8 *firmware = NULL;
+#endif
        size_t firmware_size = 0;
        u16 firmware_csum = 0;
        __be16 firmware_csum_ns;
diff -r 28b8203a830e -r 4c0004ee02c2 
linux/drivers/media/video/cpia2/cpia2_core.c
--- a/linux/drivers/media/video/cpia2/cpia2_core.c      Fri Jul 25 13:53:03 
2008 +0200
+++ b/linux/drivers/media/video/cpia2/cpia2_core.c      Fri Jul 25 13:53:43 
2008 +0200
@@ -33,11 +33,16 @@
 
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#include <linux/firmware.h>
+#endif
 
 /* #define _CPIA2_DEBUG_ */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
 #include "cpia2patch.h"
 
+#endif
 #ifdef _CPIA2_DEBUG_
 
 static const char *block_name[] = {
@@ -893,14 +898,42 @@ int cpia2_set_low_power(struct camera_da
  *  apply_vp_patch
  *
  *****************************************************************************/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+static int cpia2_send_onebyte_command(struct camera_data *cam,
+                                     struct cpia2_command *cmd,
+                                     u8 start, u8 datum)
+{
+       cmd->buffer.block_data[0] = datum;
+       cmd->start = start;
+       cmd->reg_count = 1;
+       return cpia2_send_command(cam, cmd);
+}
+
+#endif
 static int apply_vp_patch(struct camera_data *cam)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        int i, j;
+#else
+       const struct firmware *fw;
+       const char fw_name[] = "cpia2/stv0672_vp4.bin";
+       int i, ret;
+#endif
        struct cpia2_command cmd;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       ret = request_firmware(&fw, fw_name, &cam->dev->dev);
+       if (ret) {
+               printk(KERN_ERR "cpia2: failed to load VP patch \"%s\"\n",
+                      fw_name);
+               return ret;
+       }
+
+#endif
        cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP;
        cmd.direction = TRANSFER_WRITE;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        for (i = 0; i < PATCH_DATA_SIZE; i++) {
                for (j = 0; j < patch_data[i].count; j++) {
                        cmd.buffer.block_data[j] = patch_data[i].data[j];
@@ -908,9 +941,30 @@ static int apply_vp_patch(struct camera_
 
                cmd.start = patch_data[i].reg;
                cmd.reg_count = patch_data[i].count;
+#else
+       /* First send the start address... */
+       cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */
+       cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */
+
+       /* ... followed by the data payload */
+       for (i = 2; i < fw->size; i += 64) {
+               cmd.start = 0x0C; /* Data */
+               cmd.reg_count = min_t(int, 64, fw->size - i);
+               memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count);
+#endif
                cpia2_send_command(cam, &cmd);
        }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       /* Next send the start address... */
+       cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */
+       cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */
+
+       /* ... followed by the 'goto' command */
+       cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1);
+
+       release_firmware(fw);
+#endif
        return 0;
 }
 
diff -r 28b8203a830e -r 4c0004ee02c2 linux/drivers/media/video/dabusb.c
--- a/linux/drivers/media/video/dabusb.c        Fri Jul 25 13:53:03 2008 +0200
+++ b/linux/drivers/media/video/dabusb.c        Fri Jul 25 13:53:43 2008 +0200
@@ -39,9 +39,15 @@
 #include <linux/usb.h>
 #include "compat.h"
 #include <linux/mutex.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#include <linux/firmware.h>
+#include <linux/ihex.h>
+#endif
 
 #include "dabusb.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
 #include "dabfirmware.h"
+#endif
 
 /*
  * Version Information
@@ -302,7 +308,12 @@ static int dabusb_bulk (pdabusb_t s, pbu
        return ret;
 }
 /* --------------------------------------------------------------------- */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
 static int dabusb_writemem (pdabusb_t s, int pos, unsigned char *data, int len)
+#else
+static int dabusb_writemem (pdabusb_t s, int pos, const unsigned char *data,
+                           int len)
+#endif
 {
        int ret;
        unsigned char *transfer_buffer =  kmalloc (len, GFP_KERNEL);
@@ -329,24 +340,63 @@ static int dabusb_loadmem (pdabusb_t s, 
 static int dabusb_loadmem (pdabusb_t s, const char *fname)
 {
        int ret;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        PINTEL_HEX_RECORD ptr = firmware;
+#else
+       const struct ihex_binrec *rec;
+       const struct firmware *fw;
+#endif
 
        dbg("Enter dabusb_loadmem (internal)");
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       ret = request_ihex_firmware(&fw, "dabusb/firmware.fw", &s->usbdev->dev);
+       if (ret) {
+               err("Failed to load \"dabusb/firmware.fw\": %d\n", ret);
+               goto out;
+       }
+#endif
        ret = dabusb_8051_reset (s, 1);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        while (ptr->Type == 0) {
-
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                dbg("dabusb_writemem: %04X %p %d)", ptr->Address, ptr->Data, 
ptr->Length);
-
+#else
+       for (rec = (const struct ihex_binrec *)fw->data; rec;
+            rec = ihex_next_binrec(rec)) {
+               dbg("dabusb_writemem: %04X %p %d)", be32_to_cpu(rec->addr),
+                   rec->data, be16_to_cpu(rec->len));
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                ret = dabusb_writemem (s, ptr->Address, ptr->Data, ptr->Length);
+#else
+               ret = dabusb_writemem(s, be32_to_cpu(rec->addr), rec->data,
+                                      be16_to_cpu(rec->len));
+#endif
                if (ret < 0) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                        err("dabusb_writemem failed (%d %04X %p %d)", ret, 
ptr->Address, ptr->Data, ptr->Length);
+#else
+                       err("dabusb_writemem failed (%d %04X %p %d)", ret,
+                           be32_to_cpu(rec->addr), rec->data,
+                           be16_to_cpu(rec->len));
+#endif
                        break;
                }
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                ptr++;
+#endif
        }
        ret = dabusb_8051_reset (s, 0);
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+
+#else
+       release_firmware(fw);
+ out:
+#endif
        dbg("dabusb_loadmem: exit");
 
        return ret;
@@ -381,9 +431,14 @@ static int dabusb_fpga_download (pdabusb
 static int dabusb_fpga_download (pdabusb_t s, const char *fname)
 {
        pbulk_transfer_t b = kmalloc (sizeof (bulk_transfer_t), GFP_KERNEL);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       const struct firmware *fw;
+#endif
        unsigned int blen, n;
        int ret;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        unsigned char *buf = bitstream;
+#endif
 
        dbg("Enter dabusb_fpga_download (internal)");
 
@@ -392,10 +447,22 @@ static int dabusb_fpga_download (pdabusb
                return -ENOMEM;
        }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev);
+       if (ret) {
+               err("Failed to load \"dabusb/bitstream.bin\": %d\n", ret);
+               return ret;
+       }
+
+#endif
        b->pipe = 1;
        ret = dabusb_fpga_clear (s, b);
        mdelay (10);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        blen = buf[73] + (buf[72] << 8);
+#else
+       blen = fw->data[73] + (fw->data[72] << 8);
+#endif
 
        dbg("Bitstream len: %i", blen);
 
@@ -407,7 +474,11 @@ static int dabusb_fpga_download (pdabusb
        for (n = 0; n <= blen + 60; n += 60) {
                // some cclks for startup
                b->size = 64;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                memcpy (b->data + 4, buf + 74 + n, 60);
+#else
+               memcpy (b->data + 4, fw->data + 74 + n, 60);
+#endif
                ret = dabusb_bulk (s, b);
                if (ret < 0) {
                        err("dabusb_bulk failed.");
@@ -418,6 +489,9 @@ static int dabusb_fpga_download (pdabusb
 
        ret = dabusb_fpga_init (s, b);
        kfree (b);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       release_firmware(fw);
+#endif
 
        dbg("exit dabusb_fpga_download");
 
diff -r 28b8203a830e -r 4c0004ee02c2 linux/drivers/media/video/usbvideo/vicam.c
--- a/linux/drivers/media/video/usbvideo/vicam.c        Fri Jul 25 13:53:03 
2008 +0200
+++ b/linux/drivers/media/video/usbvideo/vicam.c        Fri Jul 25 13:53:43 
2008 +0200
@@ -43,6 +43,10 @@
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#include <linux/firmware.h>
+#include <linux/ihex.h>
+#endif
 #include "usbvideo.h"
 
 // #define VICAM_DEBUG
@@ -70,6 +74,7 @@
 
 #define VICAM_HEADER_SIZE       64
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
 /* Not sure what all the bytes in these char
  * arrays do, but they're necessary to make
  * the camera work.
@@ -348,6 +353,7 @@ static unsigned char setup5[] = {
        0x46, 0x05, 0x6C, 0x05, 0x00, 0x00
 };
 
+#endif
 /* rvmalloc / rvfree copied from usbvideo.c
  *
  * Not sure why these are not yet non-statics which I can reference through
@@ -464,6 +470,7 @@ static int
 static int
 initialize_camera(struct vicam_camera *cam)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        const struct {
                u8 *data;
                u32 size;
@@ -478,14 +485,41 @@ initialize_camera(struct vicam_camera *c
        };
 
        int err, i;
-
+#else
+       int err;
+       const struct ihex_binrec *rec;
+       const struct firmware *fw;
+
+       err = request_ihex_firmware(&fw, "vicam/firmware.fw", &cam->udev->dev);
+       if (err) {
+               printk(KERN_ERR "Failed to load \"vicam/firmware.fw\": %d\n",
+                      err);
+               return err;
+       }
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
        for (i = 0, err = 0; firmware[i].data && !err; i++) {
                memcpy(cam->cntrlbuf, firmware[i].data, firmware[i].size);
+#else
+       for (rec = (void *)fw->data; rec; rec = ihex_next_binrec(rec)) {
+               memcpy(cam->cntrlbuf, rec->data, be16_to_cpu(rec->len));
+#endif
 
                err = send_control_msg(cam, 0xff, 0, 0,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
                                       cam->cntrlbuf, firmware[i].size);
-       }
-
+#else
+                                      cam->cntrlbuf, be16_to_cpu(rec->len));
+               if (err)
+                       break;
+#endif
+       }
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+       release_firmware(fw);
+
+#endif
        return err;
 }
 
@@ -1226,3 +1260,6 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+MODULE_FIRMWARE("vicam/firmware.fw");
+#endif
diff -r 28b8203a830e -r 4c0004ee02c2 v4l/scripts/gentree.pl
--- a/v4l/scripts/gentree.pl    Fri Jul 25 13:53:03 2008 +0200
+++ b/v4l/scripts/gentree.pl    Fri Jul 25 13:53:43 2008 +0200
@@ -71,6 +71,8 @@ my %defs = (
        'CONFIG_VIVI_SCATTER' => 0,
        'CONFIG_BIGPHYS_AREA' => 0,
        'BUZ_USE_HIMEM' => 1,
+       'NEED_SOUND_DRIVER_H' => 0,
+       'TTUSB_KERNEL' => 1,
 );
 
 #################################################################


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/4c0004ee02c2ec48f19fdd6ba2145ad2581a81be

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to