summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-12 10:42:33 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-12 10:42:33 -0200
commit01d75ca958ddacff75e9a47150a32fa064d9367d (patch)
treeb9eed897aea9fde2dbe80cd48223a9085b3a1e79
parent1664cd632369ed984a7ab5572fc0b84718f81205 (diff)
parent2c2545da4d6f060cd6b64c71469a61cd455ba6d9 (diff)
downloadmediapointer-dvb-s2-01d75ca958ddacff75e9a47150a32fa064d9367d.tar.gz
mediapointer-dvb-s2-01d75ca958ddacff75e9a47150a32fa064d9367d.tar.bz2
merge: http://linuxtv.org/hg/~pinchartl/uvcvideo
From: Mauro Carvalho Chehab <mchehab@redhat.com> Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--linux/drivers/media/video/uvc/uvc_ctrl.c2
-rw-r--r--linux/drivers/media/video/uvc/uvc_driver.c2
-rw-r--r--linux/drivers/media/video/uvc/uvc_status.c12
-rw-r--r--linux/drivers/media/video/uvc/uvc_v4l2.c6
-rw-r--r--linux/drivers/media/video/uvc/uvc_video.c4
-rw-r--r--linux/drivers/media/video/uvc/uvcvideo.h1
-rw-r--r--v4l/compat.h65
-rw-r--r--v4l/versions.txt2
8 files changed, 92 insertions, 2 deletions
diff --git a/linux/drivers/media/video/uvc/uvc_ctrl.c b/linux/drivers/media/video/uvc/uvc_ctrl.c
index f16aafe9c..9de8a1db5 100644
--- a/linux/drivers/media/video/uvc/uvc_ctrl.c
+++ b/linux/drivers/media/video/uvc/uvc_ctrl.c
@@ -15,7 +15,9 @@
#include <linux/version.h>
#include <linux/list.h>
#include <linux/module.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)
#include <linux/uaccess.h>
+#endif
#include <linux/usb.h>
#include <linux/videodev2.h>
#include <linux/vmalloc.h>
diff --git a/linux/drivers/media/video/uvc/uvc_driver.c b/linux/drivers/media/video/uvc/uvc_driver.c
index 2760ddb96..046b98871 100644
--- a/linux/drivers/media/video/uvc/uvc_driver.c
+++ b/linux/drivers/media/video/uvc/uvc_driver.c
@@ -1915,7 +1915,9 @@ struct uvc_driver uvc_driver = {
.reset_resume = uvc_reset_resume,
#endif
.id_table = uvc_ids,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
.supports_autosuspend = 1,
+#endif
},
};
diff --git a/linux/drivers/media/video/uvc/uvc_status.c b/linux/drivers/media/video/uvc/uvc_status.c
index 5d60b264d..ab62d7bf9 100644
--- a/linux/drivers/media/video/uvc/uvc_status.c
+++ b/linux/drivers/media/video/uvc/uvc_status.c
@@ -15,7 +15,11 @@
#include <linux/version.h>
#include <linux/input.h>
#include <linux/usb.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
+#include <linux/usb_input.h>
+#else
#include <linux/usb/input.h>
+#endif
#include "uvcvideo.h"
@@ -45,7 +49,11 @@ static int uvc_input_init(struct uvc_device *dev)
input->name = dev->name;
input->phys = phys;
usb_to_input_id(udev, &input->id);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
input->dev.parent = &dev->intf->dev;
+#else
+ input->cdev.dev = &dev->intf->dev;
+#endif
set_bit(EV_KEY, input->evbit);
set_bit(BTN_0, input->keybit);
@@ -118,7 +126,11 @@ static void uvc_event_control(struct uvc_device *dev, __u8 *data, int len)
data[1], data[3], attrs[data[4]], len);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+static void uvc_status_complete(struct urb *urb, struct pt_regs *regs)
+#else
static void uvc_status_complete(struct urb *urb)
+#endif
{
struct uvc_device *dev = urb->context;
int len, ret;
diff --git a/linux/drivers/media/video/uvc/uvc_v4l2.c b/linux/drivers/media/video/uvc/uvc_v4l2.c
index 624bf74de..5588698e2 100644
--- a/linux/drivers/media/video/uvc/uvc_v4l2.c
+++ b/linux/drivers/media/video/uvc/uvc_v4l2.c
@@ -413,14 +413,18 @@ static int uvc_v4l2_open(struct inode *inode, struct file *file)
goto done;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
ret = usb_autopm_get_interface(video->dev->intf);
if (ret < 0)
goto done;
+#endif
/* Create the device handle. */
handle = kzalloc(sizeof *handle, GFP_KERNEL);
if (handle == NULL) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
usb_autopm_put_interface(video->dev->intf);
+#endif
ret = -ENOMEM;
goto done;
}
@@ -459,7 +463,9 @@ static int uvc_v4l2_release(struct inode *inode, struct file *file)
kfree(handle);
file->private_data = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
usb_autopm_put_interface(video->dev->intf);
+#endif
kref_put(&video->dev->kref, uvc_delete);
return 0;
}
diff --git a/linux/drivers/media/video/uvc/uvc_video.c b/linux/drivers/media/video/uvc/uvc_video.c
index 4af94707e..987e110fe 100644
--- a/linux/drivers/media/video/uvc/uvc_video.c
+++ b/linux/drivers/media/video/uvc/uvc_video.c
@@ -566,7 +566,11 @@ static void uvc_video_decode_bulk(struct urb *urb,
}
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+static void uvc_video_complete(struct urb *urb, struct pt_regs *regs)
+#else
static void uvc_video_complete(struct urb *urb)
+#endif
{
struct uvc_video_device *video = urb->context;
struct uvc_video_queue *queue = &video->queue;
diff --git a/linux/drivers/media/video/uvc/uvcvideo.h b/linux/drivers/media/video/uvc/uvcvideo.h
index 595b90ee6..f95040380 100644
--- a/linux/drivers/media/video/uvc/uvcvideo.h
+++ b/linux/drivers/media/video/uvc/uvcvideo.h
@@ -4,6 +4,7 @@
#include <linux/kernel.h>
#include <linux/videodev2.h>
+#include "compat.h"
/*
* Dynamic controls
diff --git a/v4l/compat.h b/v4l/compat.h
index 57b1aba8d..98f57879b 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -262,4 +262,69 @@ static inline int list_is_singular(const struct list_head *head)
#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+#ifdef __LINUX_USB_H
+/*
+ * usb_endpoint_* functions
+ *
+ * Included in Linux 2.6.19
+ * Backported to 2.6.18 in Red Hat Enterprise Linux 5.2
+ */
+
+#ifdef RHEL_RELEASE_CODE
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 2)
+#define RHEL_HAS_USB_ENDPOINT
+#endif
+#endif
+
+#ifndef RHEL_HAS_USB_ENDPOINT
+static inline int
+usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
+{
+ return (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN;
+}
+
+static inline int
+usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
+{
+ return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_INT;
+}
+
+static inline int
+usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
+{
+ return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_ISOC;
+}
+
+static inline int
+usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
+{
+ return (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+ USB_ENDPOINT_XFER_BULK;
+}
+
+static inline int
+usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
+{
+ return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
+}
+#endif /* RHEL_HAS_USB_ENDPOINT */
+#endif /* __LINUX_USB_H */
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
+/*
+ * Linked list API
+ */
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+/*
+ * uninitialized_var() macro
+ */
+#define uninitialized_var(x) x
+#endif
+
#endif
diff --git a/v4l/versions.txt b/v4l/versions.txt
index 576af0ecd..3ef9af5d8 100644
--- a/v4l/versions.txt
+++ b/v4l/versions.txt
@@ -16,8 +16,6 @@ SOC_CAMERA_MT9M001
VIDEO_TCM825X
# This driver requires list_first_entry
USB_STKWEBCAM
-#Initial version for this driver
-USB_VIDEO_CLASS
# This driver needs div64_64
DVB_DRX397XD
# Assumes struct input_dev has a dev field