diff options
author | Luca Risolia <luca.risolia@studio.unibo.it> | 2006-02-25 01:54:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:49:59 -0500 |
commit | ccad7789d5e557644d1c866b018394872af0ec5b (patch) | |
tree | c3894cc5b75fe11b4db85229927591387aa332a8 /drivers/usb/media/et61x251.h | |
parent | 2ffab02fea5880da284dc5511479b25a796a8dee (diff) |
[PATCH] USB: ET61X[12]51 driver updates
USB: ET61X[12]51 driver updates
Changes: + new, - removed, * cleanup, @ bugfix
@ Fix stream_interrupt()
@ Fix vidioc_enum_input() and split vidioc_gs_input()
@ Need usb_get|put_dev() when disconnecting, if the device is open
* Use wait_event_interruptible_timeout() instead of wait_event_interruptible()
when waiting for video frames
* replace wake_up_interruptible(&wait_stream) with wake_up(&wait_stream)
* Cleanups and updates in the documentation
* Use mutexes instead of semaphores
+ Use per-device sensor structures
+ Add support for PAS202BCA image sensors
+ 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/et61x251.h')
-rw-r--r-- | drivers/usb/media/et61x251.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/usb/media/et61x251.h b/drivers/usb/media/et61x251.h index 652238f329f3..eee8afc9be72 100644 --- a/drivers/usb/media/et61x251.h +++ b/drivers/usb/media/et61x251.h | |||
@@ -33,7 +33,9 @@ | |||
33 | #include <linux/types.h> | 33 | #include <linux/types.h> |
34 | #include <linux/param.h> | 34 | #include <linux/param.h> |
35 | #include <linux/rwsem.h> | 35 | #include <linux/rwsem.h> |
36 | #include <asm/semaphore.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/stddef.h> | ||
38 | #include <linux/string.h> | ||
37 | 39 | ||
38 | #include "et61x251_sensor.h" | 40 | #include "et61x251_sensor.h" |
39 | 41 | ||
@@ -51,6 +53,7 @@ | |||
51 | #define ET61X251_ALTERNATE_SETTING 13 | 53 | #define ET61X251_ALTERNATE_SETTING 13 |
52 | #define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS) | 54 | #define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS) |
53 | #define ET61X251_CTRL_TIMEOUT 100 | 55 | #define ET61X251_CTRL_TIMEOUT 100 |
56 | #define ET61X251_FRAME_TIMEOUT 2 | ||
54 | 57 | ||
55 | /*****************************************************************************/ | 58 | /*****************************************************************************/ |
56 | 59 | ||
@@ -127,15 +130,16 @@ struct et61x251_sysfs_attr { | |||
127 | 130 | ||
128 | struct et61x251_module_param { | 131 | struct et61x251_module_param { |
129 | u8 force_munmap; | 132 | u8 force_munmap; |
133 | u16 frame_timeout; | ||
130 | }; | 134 | }; |
131 | 135 | ||
132 | static DECLARE_MUTEX(et61x251_sysfs_lock); | 136 | static DEFINE_MUTEX(et61x251_sysfs_lock); |
133 | static DECLARE_RWSEM(et61x251_disconnect); | 137 | static DECLARE_RWSEM(et61x251_disconnect); |
134 | 138 | ||
135 | struct et61x251_device { | 139 | struct et61x251_device { |
136 | struct video_device* v4ldev; | 140 | struct video_device* v4ldev; |
137 | 141 | ||
138 | struct et61x251_sensor* sensor; | 142 | struct et61x251_sensor sensor; |
139 | 143 | ||
140 | struct usb_device* usbdev; | 144 | struct usb_device* usbdev; |
141 | struct urb* urb[ET61X251_URBS]; | 145 | struct urb* urb[ET61X251_URBS]; |
@@ -157,19 +161,28 @@ struct et61x251_device { | |||
157 | enum et61x251_dev_state state; | 161 | enum et61x251_dev_state state; |
158 | u8 users; | 162 | u8 users; |
159 | 163 | ||
160 | struct semaphore dev_sem, fileop_sem; | 164 | struct mutex dev_mutex, fileop_mutex; |
161 | spinlock_t queue_lock; | 165 | spinlock_t queue_lock; |
162 | wait_queue_head_t open, wait_frame, wait_stream; | 166 | wait_queue_head_t open, wait_frame, wait_stream; |
163 | }; | 167 | }; |
164 | 168 | ||
165 | /*****************************************************************************/ | 169 | /*****************************************************************************/ |
166 | 170 | ||
171 | struct et61x251_device* | ||
172 | et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) | ||
173 | { | ||
174 | if (usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id)) | ||
175 | return cam; | ||
176 | |||
177 | return NULL; | ||
178 | } | ||
179 | |||
180 | |||
167 | void | 181 | void |
168 | et61x251_attach_sensor(struct et61x251_device* cam, | 182 | et61x251_attach_sensor(struct et61x251_device* cam, |
169 | struct et61x251_sensor* sensor) | 183 | struct et61x251_sensor* sensor) |
170 | { | 184 | { |
171 | cam->sensor = sensor; | 185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); |
172 | cam->sensor->usbdev = cam->usbdev; | ||
173 | } | 186 | } |
174 | 187 | ||
175 | /*****************************************************************************/ | 188 | /*****************************************************************************/ |
@@ -212,7 +225,8 @@ do { \ | |||
212 | 225 | ||
213 | #undef PDBG | 226 | #undef PDBG |
214 | #define PDBG(fmt, args...) \ | 227 | #define PDBG(fmt, args...) \ |
215 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) | 228 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
229 | __FUNCTION__, __LINE__ , ## args) | ||
216 | 230 | ||
217 | #undef PDBGG | 231 | #undef PDBGG |
218 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |