summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/usbvideo/vicam.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-26 06:44:30 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-26 06:44:30 -0300
commitb42ffafbaf363a50a8b7188a53d9c391c7ff7468 (patch)
tree392683dbf0e3bf34a48bd9bc1ab2b40d5b452fc2 /linux/drivers/media/video/usbvideo/vicam.c
parent253922fc720f48e98e6bc9030b5c712044ab83fc (diff)
parentdbe96ea057cb7cf8050f22c934df078560d88c65 (diff)
downloadmediapointer-dvb-s2-b42ffafbaf363a50a8b7188a53d9c391c7ff7468.tar.gz
mediapointer-dvb-s2-b42ffafbaf363a50a8b7188a53d9c391c7ff7468.tar.bz2
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-fixes
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/usbvideo/vicam.c')
-rw-r--r--linux/drivers/media/video/usbvideo/vicam.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c
index 17f542dfb..2aa05f7ca 100644
--- a/linux/drivers/media/video/usbvideo/vicam.c
+++ b/linux/drivers/media/video/usbvideo/vicam.c
@@ -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 send_control_msg(struct vicam_camera *cam,
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 *cam)
};
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_exit(usb_vicam_exit);
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