Commit f2242ee5 authored by Thierry MERLE's avatar Thierry MERLE Committed by Mauro Carvalho Chehab

V4L/DVB (4927): Enhancements on usbvision driver

Enhance the buffer management of this driver + some corrections
- linux list.h usage for buffer management
- VIDIOC_ENUMSTD/VIDIOC_G_STD/VIDIOC_S_STD simplification (use of
v4l2_video_std_construct)
- create_sysfs : remove of warnings for video_device_create_file return code
- make the driver compatible with 2.6.19 kernel version (remove
slave_send and slave_recv in usbvision-i2c, change ctrlUrb_complete
function prototype)
- deactivated v4l2_read because this code was not the priority but
working on it :)
Signed-off-by: default avatarThierry MERLE <thierry.merle@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 18d8a454
...@@ -205,8 +205,6 @@ static u32 usb_func(struct i2c_adapter *adap) ...@@ -205,8 +205,6 @@ static u32 usb_func(struct i2c_adapter *adap)
static struct i2c_algorithm i2c_usb_algo = { static struct i2c_algorithm i2c_usb_algo = {
.master_xfer = usb_xfer, .master_xfer = usb_xfer,
.smbus_xfer = NULL, .smbus_xfer = NULL,
.slave_send = NULL,
.slave_recv = NULL,
.algo_control = algo_control, .algo_control = algo_control,
.functionality = usb_func, .functionality = usb_func,
}; };
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
#define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 #define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023
#define USBVISION_NUM_HEADERMARKER 20 #define USBVISION_NUM_HEADERMARKER 20
#define USBVISION_NUMFRAMES 2 #define USBVISION_NUMFRAMES 3
#define USBVISION_NUMSBUF 2 #define USBVISION_NUMSBUF 2
#define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds #define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds
...@@ -225,6 +225,13 @@ enum FrameState { ...@@ -225,6 +225,13 @@ enum FrameState {
FrameState_Error, /* Something bad happened while processing */ FrameState_Error, /* Something bad happened while processing */
}; };
/* stream states */
enum StreamState {
Stream_Off,
Stream_Interrupt,
Stream_On,
};
enum IsocState { enum IsocState {
IsocState_InFrame, /* Isoc packet is member of frame */ IsocState_InFrame, /* Isoc packet is member of frame */
IsocState_NoFrame, /* Isoc packet is not member of any frame */ IsocState_NoFrame, /* Isoc packet is not member of any frame */
...@@ -272,19 +279,29 @@ struct usbvision_frame_header { ...@@ -272,19 +279,29 @@ struct usbvision_frame_header {
__u16 frameHeight; /* 10 - 11 after endian correction*/ __u16 frameHeight; /* 10 - 11 after endian correction*/
}; };
/* tvnorms */
struct usbvision_tvnorm {
char *name;
v4l2_std_id id;
/* mode for saa7113h */
int mode;
};
struct usbvision_frame { struct usbvision_frame {
char *data; /* Frame buffer */ char *data; /* Frame buffer */
struct usbvision_frame_header isocHeader; /* Header from stream */ struct usbvision_frame_header isocHeader; /* Header from stream */
int width; /* Width application is expecting */ int width; /* Width application is expecting */
int height; /* Height */ int height; /* Height */
int index; /* Frame index */
int frmwidth; /* Width the frame actually is */ int frmwidth; /* Width the frame actually is */
int frmheight; /* Height */ int frmheight; /* Height */
volatile int grabstate; /* State of grabbing */ volatile int grabstate; /* State of grabbing */
int scanstate; /* State of scanning */ int scanstate; /* State of scanning */
struct list_head frame;
int curline; /* Line of frame we're working on */ int curline; /* Line of frame we're working on */
long scanlength; /* uncompressed, raw data length of frame */ long scanlength; /* uncompressed, raw data length of frame */
...@@ -292,7 +309,6 @@ struct usbvision_frame { ...@@ -292,7 +309,6 @@ struct usbvision_frame {
struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/ struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/
int v4l2_linesize; /* bytes for one videoline*/ int v4l2_linesize; /* bytes for one videoline*/
struct timeval timestamp; struct timeval timestamp;
wait_queue_head_t wq; /* Processes waiting */
int sequence; // How many video frames we send to user int sequence; // How many video frames we send to user
}; };
...@@ -373,7 +389,7 @@ struct usb_usbvision { ...@@ -373,7 +389,7 @@ struct usb_usbvision {
int usbvision_used; /* Is this structure in use? */ int usbvision_used; /* Is this structure in use? */
int initialized; /* Had we already sent init sequence? */ int initialized; /* Had we already sent init sequence? */
int DevModel; /* What type of USBVISION device we got? */ int DevModel; /* What type of USBVISION device we got? */
int streaming; /* Are we streaming Isochronous? */ enum StreamState streaming; /* Are we streaming Isochronous? */
int last_error; /* What calamity struck us? */ int last_error; /* What calamity struck us? */
int curwidth; /* width of the frame the device is currently set to*/ int curwidth; /* width of the frame the device is currently set to*/
int curheight; /* height of the frame the device is currently set to*/ int curheight; /* height of the frame the device is currently set to*/
...@@ -382,7 +398,10 @@ struct usb_usbvision { ...@@ -382,7 +398,10 @@ struct usb_usbvision {
char *fbuf; /* Videodev buffer area for mmap*/ char *fbuf; /* Videodev buffer area for mmap*/
int max_frame_size; /* Bytes in one video frame */ int max_frame_size; /* Bytes in one video frame */
int fbuf_size; /* Videodev buffer size */ int fbuf_size; /* Videodev buffer size */
int curFrameNum; // number of current frame in frame buffer mode spinlock_t queue_lock; /* spinlock for protecting mods on inqueue and outqueue */
struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */
wait_queue_head_t wait_frame; /* Processes waiting */
wait_queue_head_t wait_stream; /* Processes waiting */
struct usbvision_frame *curFrame; // pointer to current frame, set by usbvision_find_header struct usbvision_frame *curFrame; // pointer to current frame, set by usbvision_find_header
struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer
int curSbufNum; // number of current receiving sbuf int curSbufNum; // number of current receiving sbuf
...@@ -406,7 +425,8 @@ struct usb_usbvision { ...@@ -406,7 +425,8 @@ struct usb_usbvision {
struct usbvision_v4l2_format_st palette; struct usbvision_v4l2_format_st palette;
struct v4l2_capability vcap; /* Video capabilities */ struct v4l2_capability vcap; /* Video capabilities */
struct v4l2_input input; /* May be used for tuner support */ unsigned int ctl_input; /* selected input */
struct usbvision_tvnorm *tvnorm; /* selected tv norm */
unsigned char video_endp; /* 0x82 for USBVISION devices based */ unsigned char video_endp; /* 0x82 for USBVISION devices based */
// Overlay stuff: // Overlay stuff:
...@@ -463,3 +483,10 @@ struct usb_usbvision { ...@@ -463,3 +483,10 @@ struct usb_usbvision {
#endif /* __LINUX_USBVISION_H */ #endif /* __LINUX_USBVISION_H */
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* ---------------------------------------------------------------------------
* Local variables:
* c-basic-offset: 8
* End:
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment