aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/zc0301.h
diff options
context:
space:
mode:
authorLuca Risolia <luca.risolia@studio.unibo.it>2006-02-25 01:57:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:50:00 -0500
commita847423905c6a8ccd6671d05f5877d893d10cd9f (patch)
treeca7a67a3f37889bf7c612d246fa5173dfbef320a /drivers/usb/media/zc0301.h
parentccad7789d5e557644d1c866b018394872af0ec5b (diff)
[PATCH] USB: ZC0301 driver updates
ZC0301 driver updates. Changes: + new, - removed, * cleanup, @ bugfix @ Need usb_get|put_dev() when disconnecting, if the device is open * Cleanups and updates in the documentation + Use per-device sensor structures + Add frame_timeout module parameter Signed-off-by: Luca Risolia <luca.risolia@studio.unibo.it> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/media/zc0301.h')
-rw-r--r--drivers/usb/media/zc0301.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/media/zc0301.h b/drivers/usb/media/zc0301.h
index cb1a0823bc63..9ba9135e824b 100644
--- a/drivers/usb/media/zc0301.h
+++ b/drivers/usb/media/zc0301.h
@@ -34,7 +34,8 @@
34#include <linux/param.h> 34#include <linux/param.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <linux/rwsem.h> 36#include <linux/rwsem.h>
37#include <asm/semaphore.h> 37#include <linux/stddef.h>
38#include <linux/string.h>
38 39
39#include "zc0301_sensor.h" 40#include "zc0301_sensor.h"
40 41
@@ -51,7 +52,7 @@
51#define ZC0301_ALTERNATE_SETTING 7 52#define ZC0301_ALTERNATE_SETTING 7
52#define ZC0301_URB_TIMEOUT msecs_to_jiffies(2 * ZC0301_ISO_PACKETS) 53#define ZC0301_URB_TIMEOUT msecs_to_jiffies(2 * ZC0301_ISO_PACKETS)
53#define ZC0301_CTRL_TIMEOUT 100 54#define ZC0301_CTRL_TIMEOUT 100
54#define ZC0301_FRAME_TIMEOUT 2 * 1000 * msecs_to_jiffies(1) 55#define ZC0301_FRAME_TIMEOUT 2
55 56
56/*****************************************************************************/ 57/*****************************************************************************/
57 58
@@ -94,6 +95,7 @@ enum zc0301_stream_state {
94 95
95struct zc0301_module_param { 96struct zc0301_module_param {
96 u8 force_munmap; 97 u8 force_munmap;
98 u16 frame_timeout;
97}; 99};
98 100
99static DECLARE_RWSEM(zc0301_disconnect); 101static DECLARE_RWSEM(zc0301_disconnect);
@@ -101,7 +103,7 @@ static DECLARE_RWSEM(zc0301_disconnect);
101struct zc0301_device { 103struct zc0301_device {
102 struct video_device* v4ldev; 104 struct video_device* v4ldev;
103 105
104 struct zc0301_sensor* sensor; 106 struct zc0301_sensor sensor;
105 107
106 struct usb_device* usbdev; 108 struct usb_device* usbdev;
107 struct urb* urb[ZC0301_URBS]; 109 struct urb* urb[ZC0301_URBS];
@@ -129,11 +131,19 @@ struct zc0301_device {
129 131
130/*****************************************************************************/ 132/*****************************************************************************/
131 133
134struct zc0301_device*
135zc0301_match_id(struct zc0301_device* cam, const struct usb_device_id *id)
136{
137 if (usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id))
138 return cam;
139
140 return NULL;
141}
142
132void 143void
133zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor) 144zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor)
134{ 145{
135 cam->sensor = sensor; 146 memcpy(&cam->sensor, sensor, sizeof(struct zc0301_sensor));
136 cam->sensor->usbdev = cam->usbdev;
137} 147}
138 148
139/*****************************************************************************/ 149/*****************************************************************************/