Skip to content

Commit

Permalink
[PATCH] USB: SN9C10x driver updates
Browse files Browse the repository at this point in the history
SN9C10x 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 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>
  • Loading branch information
Luca Risolia authored and Greg Kroah-Hartman committed Mar 20, 2006
1 parent 7039f42 commit 2ffab02
Show file tree
Hide file tree
Showing 10 changed files with 416 additions and 107 deletions.
11 changes: 11 additions & 0 deletions Documentation/usb/sn9c102.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ Description: Force the application to unmap previously mapped buffer memory
1 = force memory unmapping (save memory)
Default: 0
-------------------------------------------------------------------------------
Name: frame_timeout
Type: uint array (min = 0, max = 64)
Syntax: <n[,...]>
Description: Timeout for a video frame in seconds. This parameter is
specific for each detected camera. This parameter can be
changed at runtime thanks to the /sys filesystem interface.
Default: 2
-------------------------------------------------------------------------------
Name: debug
Type: ushort
Syntax: <n>
Expand Down Expand Up @@ -321,6 +329,7 @@ Vendor ID Product ID
--------- ----------
0x0c45 0x6001
0x0c45 0x6005
0x0c45 0x6007
0x0c45 0x6009
0x0c45 0x600d
0x0c45 0x6024
Expand Down Expand Up @@ -370,6 +379,7 @@ HV7131D Hynix Semiconductor, Inc.
MI-0343 Micron Technology, Inc.
OV7630 OmniVision Technologies, Inc.
PAS106B PixArt Imaging, Inc.
PAS202BCA PixArt Imaging, Inc.
PAS202BCB PixArt Imaging, Inc.
TAS5110C1B Taiwan Advanced Sensor Corporation
TAS5130D1B Taiwan Advanced Sensor Corporation
Expand Down Expand Up @@ -493,6 +503,7 @@ Many thanks to following persons for their contribute (listed in alphabetical
order):

- Luca Capello for the donation of a webcam;
- Philippe Coval for having helped testing the PAS202BCA image sensor;
- Joao Rodrigo Fuzaro, Joao Limirio, Claudio Filho and Caio Begotti for the
donation of a webcam;
- Jon Hollstrom for the donation of a webcam;
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/media/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# Makefile for USB Media drivers
#

sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o
sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \
sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \
sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \
sn9c102_tas5130d1b.o
et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o
zc0301-objs := zc0301_core.o zc0301_pas202bcb.o

Expand Down
23 changes: 18 additions & 5 deletions drivers/usb/media/sn9c102.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#include <linux/param.h>
#include <linux/rwsem.h>
#include <linux/mutex.h>
#include <asm/semaphore.h>
#include <linux/string.h>
#include <linux/stddef.h>

#include "sn9c102_sensor.h"

Expand All @@ -51,6 +52,7 @@
#define SN9C102_ALTERNATE_SETTING 8
#define SN9C102_URB_TIMEOUT msecs_to_jiffies(2 * SN9C102_ISO_PACKETS)
#define SN9C102_CTRL_TIMEOUT 300
#define SN9C102_FRAME_TIMEOUT 2

/*****************************************************************************/

Expand Down Expand Up @@ -108,6 +110,7 @@ struct sn9c102_sysfs_attr {

struct sn9c102_module_param {
u8 force_munmap;
u16 frame_timeout;
};

static DEFINE_MUTEX(sn9c102_sysfs_lock);
Expand All @@ -117,7 +120,7 @@ struct sn9c102_device {
struct video_device* v4ldev;

enum sn9c102_bridge bridge;
struct sn9c102_sensor* sensor;
struct sn9c102_sensor sensor;

struct usb_device* usbdev;
struct urb* urb[SN9C102_URBS];
Expand Down Expand Up @@ -149,12 +152,21 @@ struct sn9c102_device {

/*****************************************************************************/

struct sn9c102_device*
sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id)
{
if (usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id))
return cam;

return NULL;
}


void
sn9c102_attach_sensor(struct sn9c102_device* cam,
struct sn9c102_sensor* sensor)
{
cam->sensor = sensor;
cam->sensor->usbdev = cam->usbdev;
memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor));
}

/*****************************************************************************/
Expand Down Expand Up @@ -197,7 +209,8 @@ do { \

#undef PDBG
#define PDBG(fmt, args...) \
dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args)
dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \
__FUNCTION__, __LINE__ , ## args)

#undef PDBGG
#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */
Expand Down
Loading

0 comments on commit 2ffab02

Please sign in to comment.