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

V4L/DVB (5644): Usbvision: video_ioctl2 conversion

The ioctl entry point, a big switch/case, is splitted in little 
functions. 

These functions are set as callbacks for the video_ioctl2 video4linux 
facility.

This improves the driver memory consumption and enables the v4l1 
compatibility as a side effect.
Signed-off-by: default avatarThierry MERLE <thierry.merle@free.fr>
Acked-by: default avatarDwaine P. Garden <dwainegarden@rogers.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent ea1f83ce
...@@ -1831,10 +1831,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, ...@@ -1831,10 +1831,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
frameRate = FRAMERATE_MAX; frameRate = FRAMERATE_MAX;
} }
if (usbvision->tvnorm->id & V4L2_STD_625_50) { if (usbvision->tvnormId & V4L2_STD_625_50) {
frameDrop = frameRate * 32 / 25 - 1; frameDrop = frameRate * 32 / 25 - 1;
} }
else if (usbvision->tvnorm->id & V4L2_STD_525_60) { else if (usbvision->tvnormId & V4L2_STD_525_60) {
frameDrop = frameRate * 32 / 30 - 1; frameDrop = frameRate * 32 / 30 - 1;
} }
...@@ -2067,7 +2067,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) ...@@ -2067,7 +2067,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
} }
if (usbvision->tvnorm->id & V4L2_STD_PAL) { if (usbvision->tvnormId & V4L2_STD_PAL) {
value[0] = 0xC0; value[0] = 0xC0;
value[1] = 0x02; //0x02C0 -> 704 Input video line length value[1] = 0x02; //0x02C0 -> 704 Input video line length
value[2] = 0x20; value[2] = 0x20;
...@@ -2076,7 +2076,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) ...@@ -2076,7 +2076,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
value[5] = 0x00; //0x0060 -> 96 Input video h offset value[5] = 0x00; //0x0060 -> 96 Input video h offset
value[6] = 0x16; value[6] = 0x16;
value[7] = 0x00; //0x0016 -> 22 Input video v offset value[7] = 0x00; //0x0016 -> 22 Input video v offset
} else if (usbvision->tvnorm->id & V4L2_STD_SECAM) { } else if (usbvision->tvnormId & V4L2_STD_SECAM) {
value[0] = 0xC0; value[0] = 0xC0;
value[1] = 0x02; //0x02C0 -> 704 Input video line length value[1] = 0x02; //0x02C0 -> 704 Input video line length
value[2] = 0x20; value[2] = 0x20;
......
...@@ -221,6 +221,8 @@ enum { ...@@ -221,6 +221,8 @@ enum {
#define I2C_USB_ADAP_MAX 16 #define I2C_USB_ADAP_MAX 16
#define USBVISION_NORMS (V4L2_STD_PAL | V4L2_STD_NTSC | V4L2_STD_SECAM | V4L2_STD_PAL_M)
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* usbvision video structures */ /* usbvision video structures */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
...@@ -301,14 +303,6 @@ struct usbvision_frame_header { ...@@ -301,14 +303,6 @@ 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 */
...@@ -441,7 +435,7 @@ struct usb_usbvision { ...@@ -441,7 +435,7 @@ struct usb_usbvision {
struct v4l2_capability vcap; /* Video capabilities */ struct v4l2_capability vcap; /* Video capabilities */
unsigned int ctl_input; /* selected input */ unsigned int ctl_input; /* selected input */
struct usbvision_tvnorm *tvnorm; /* selected tv norm */ v4l2_std_id tvnormId; /* selected tv norm */
unsigned char video_endp; /* 0x82 for USBVISION devices based */ unsigned char video_endp; /* 0x82 for USBVISION devices based */
// Decompression stuff: // Decompression stuff:
......
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