staging/easycap: add first level indetnation for easycap_low.c

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Tomas Winkler 2011-02-10 14:55:22 +02:00 committed by Greg Kroah-Hartman
parent 1b3909e5c5
commit 72075789ea
1 changed files with 605 additions and 625 deletions

View File

@ -326,8 +326,7 @@ static int regset(struct usb_device *pusb_device, u16 index, u16 value)
/*****************************************************************************/
/****************************************************************************/
int
confirm_resolution(struct usb_device *p)
int confirm_resolution(struct usb_device *p)
{
u8 get0, get1, get2, get3, get4, get5, get6, get7;
@ -367,8 +366,7 @@ JOT(8, "....cf VGA_640x480: "
return 0;
}
/****************************************************************************/
int
confirm_stream(struct usb_device *p)
int confirm_stream(struct usb_device *p)
{
u16 get2;
u8 igot;
@ -383,8 +381,7 @@ else
return 0;
}
/****************************************************************************/
int
setup_stk(struct usb_device *p, bool ntsc)
int setup_stk(struct usb_device *p, bool ntsc)
{
int i0;
@ -393,12 +390,14 @@ if (NULL == p)
i0 = 0;
if (true == ntsc) {
while (0xFFF != stk1160configNTSC[i0].reg) {
SET(p, stk1160configNTSC[i0].reg, stk1160configNTSC[i0].set);
SET(p, stk1160configNTSC[i0].reg,
stk1160configNTSC[i0].set);
i0++;
}
} else {
while (0xFFF != stk1160configPAL[i0].reg) {
SET(p, stk1160configPAL[i0].reg, stk1160configPAL[i0].set);
SET(p, stk1160configPAL[i0].reg,
stk1160configPAL[i0].set);
i0++;
}
}
@ -408,8 +407,7 @@ write_300(p);
return 0;
}
/****************************************************************************/
int
setup_saa(struct usb_device *p, bool ntsc)
int setup_saa(struct usb_device *p, bool ntsc)
{
int i0, ir;
@ -432,8 +430,7 @@ if (true == ntsc) {
return 0;
}
/****************************************************************************/
int
write_000(struct usb_device *p, u16 set2, u16 set0)
int write_000(struct usb_device *p, u16 set2, u16 set0)
{
u8 igot0, igot2;
@ -446,8 +443,7 @@ SET(p, 0x0000, set0);
return 0;
}
/****************************************************************************/
int
write_saa(struct usb_device *p, u16 reg0, u16 set0)
int write_saa(struct usb_device *p, u16 reg0, u16 set0)
{
if (NULL == p)
return -ENODEV;
@ -505,8 +501,7 @@ return 0;
* REGISTER 504: TARGET ADDRESS ON VT1612A
*/
/*--------------------------------------------------------------------------*/
int
read_vt(struct usb_device *p, u16 reg0)
int read_vt(struct usb_device *p, u16 reg0)
{
u8 igot;
u16 got502, got503;
@ -519,7 +514,8 @@ SET(p, 0x0500, 0x008B);
GET(p, 0x0502, &igot); got502 = (0xFF & igot);
GET(p, 0x0503, &igot); got503 = (0xFF & igot);
JOT(16, "read_vt(., 0x%04X): has 0x%04X\n", reg0, ((got503 << 8) | got502));
JOT(16, "read_vt(., 0x%04X): has 0x%04X\n",
reg0, ((got503 << 8) | got502));
return (got503 << 8) | got502;
}
@ -529,8 +525,7 @@ return (got503 << 8) | got502;
* THESE APPEAR TO HAVE NO EFFECT ON EITHER VIDEO OR AUDIO.
*/
/*--------------------------------------------------------------------------*/
int
write_300(struct usb_device *p)
int write_300(struct usb_device *p)
{
if (NULL == p)
return -ENODEV;
@ -549,8 +544,7 @@ return 0;
* REGISTER 0x0F, WHICH IS INVOLVED IN CHROMINANCE AUTOMATIC GAIN CONTROL.
*/
/*--------------------------------------------------------------------------*/
int
check_saa(struct usb_device *p, bool ntsc)
int check_saa(struct usb_device *p, bool ntsc)
{
int i0, ir, rc;
@ -599,8 +593,7 @@ else
return 0;
}
/****************************************************************************/
int
merit_saa(struct usb_device *p)
int merit_saa(struct usb_device *p)
{
int rc;
@ -613,8 +606,7 @@ else
return 0;
}
/****************************************************************************/
int
ready_saa(struct usb_device *p)
int ready_saa(struct usb_device *p)
{
int j, rc, rate;
const int max = 5, marktime = PATIENCE/5;
@ -667,8 +659,7 @@ return 0;
* REGISTER 0x100: ACCEPT ALSO (0x80 | stk1160config....[.].set)
*/
/*--------------------------------------------------------------------------*/
int
check_stk(struct usb_device *p, bool ntsc)
int check_stk(struct usb_device *p, bool ntsc)
{
int i0, ir;
@ -686,10 +677,8 @@ if (true == ntsc) {
ir = read_stk(p, stk1160configNTSC[i0].reg);
if (0x100 == stk1160configNTSC[i0].reg) {
if ((ir != (0xFF & stk1160configNTSC[i0].set)) &&
(ir != (0x80 | (0xFF &
stk1160configNTSC[i0].set))) &&
(0xFFFF !=
stk1160configNTSC[i0].set)) {
(ir != (0x80 | (0xFF & stk1160configNTSC[i0].set))) &&
(0xFFFF != stk1160configNTSC[i0].set)) {
SAY("STK register 0x%03X has 0x%02X, "
"expected 0x%02X\n",
stk1160configNTSC[i0].reg,
@ -741,8 +730,7 @@ if (true == ntsc) {
return 0;
}
/****************************************************************************/
int
read_saa(struct usb_device *p, u16 reg0)
int read_saa(struct usb_device *p, u16 reg0)
{
u8 igot;
@ -757,8 +745,7 @@ GET(p, 0x0209, &igot);
return igot;
}
/****************************************************************************/
int
read_stk(struct usb_device *p, u32 reg0)
int read_stk(struct usb_device *p, u32 reg0)
{
u8 igot;
@ -799,8 +786,8 @@ switch (input) {
case 0:
case 1: {
if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input);
}
SET(p, 0x0000, 0x0098);
SET(p, 0x0002, 0x0078);
@ -808,8 +795,8 @@ case 1: {
}
case 2: {
if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input);
}
SET(p, 0x0000, 0x0090);
SET(p, 0x0002, 0x0078);
@ -817,8 +804,8 @@ case 2: {
}
case 3: {
if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x02 "
" for input %i\n", input);
}
SET(p, 0x0000, 0x0088);
SET(p, 0x0002, 0x0078);
@ -826,8 +813,8 @@ case 3: {
}
case 4: {
if (0 != write_saa(p, 0x02, 0x80)) {
SAY("ERROR: failed to set SAA register 0x02 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x02 "
"for input %i\n", input);
}
SET(p, 0x0000, 0x0080);
SET(p, 0x0002, 0x0078);
@ -865,12 +852,12 @@ case 5: {
}
}
if (0 != write_saa(p, 0x04, 0x00)) {
SAY("ERROR: failed to set SAA register 0x04 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x04 "
"for input %i\n", input);
}
if (0 != write_saa(p, 0x09, 0x80)) {
SAY("ERROR: failed to set SAA register 0x09 for input %i\n",
input);
SAY("ERROR: failed to set SAA register 0x09 "
"for input %i\n", input);
}
SET(p, 0x0002, 0x0093);
break;
@ -890,8 +877,7 @@ start_100(p);
return 0;
}
/****************************************************************************/
int
set_resolution(struct usb_device *p,
int set_resolution(struct usb_device *p,
u16 set0, u16 set1, u16 set2, u16 set3)
{
u16 u0x0111, u0x0113, u0x0115, u0x0117;
@ -915,8 +901,7 @@ SET(p, 0x0117, u0x0117);
return 0;
}
/****************************************************************************/
int
start_100(struct usb_device *p)
int start_100(struct usb_device *p)
{
u16 get116, get117, get0;
u8 igot116, igot117, igot;
@ -940,8 +925,7 @@ SET(p, 0x0117, get117);
return 0;
}
/****************************************************************************/
int
stop_100(struct usb_device *p)
int stop_100(struct usb_device *p)
{
u16 get0;
u8 igot;
@ -959,8 +943,7 @@ return 0;
* FUNCTION wait_i2c() RETURNS 0 ON SUCCESS
*/
/*--------------------------------------------------------------------------*/
int
wait_i2c(struct usb_device *p)
int wait_i2c(struct usb_device *p)
{
u16 get0;
u8 igot;
@ -989,14 +972,13 @@ return -1;
}
/****************************************************************************/
/*****************************************************************************/
int
wakeup_device(struct usb_device *pusb_device)
int wakeup_device(struct usb_device *pusb_device)
{
if (!pusb_device)
return -ENODEV;
return usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
(u8)USB_REQ_SET_FEATURE,
(u8)(USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE),
USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP,
(u16)0,
(void *) NULL,
@ -1019,8 +1001,9 @@ int rc, id1, id2;
*/
/*---------------------------------------------------------------------------*/
const u8 request = 0x01;
const u8 requesttype =
(u8)(USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE);
const u8 requesttype = USB_DIR_OUT |
USB_TYPE_CLASS |
USB_RECIP_INTERFACE;
const u16 value_unmute = 0x0200;
const u16 index = 0x0301;
const u16 length = 1;
@ -1098,8 +1081,7 @@ check_vt(pusb_device);
return 0;
}
/*****************************************************************************/
int
check_vt(struct usb_device *pusb_device)
int check_vt(struct usb_device *pusb_device)
{
int igot;
@ -1170,8 +1152,7 @@ return 0;
* 31 12.0 22.5 34.5
*/
/*---------------------------------------------------------------------------*/
int
audio_gainset(struct usb_device *pusb_device, s8 loud)
int audio_gainset(struct usb_device *pusb_device, s8 loud)
{
int igot;
u8 tmp;
@ -1239,8 +1220,7 @@ write_vt(pusb_device, 0x0002, 0x0000);
return 0;
}
/*****************************************************************************/
int
audio_gainget(struct usb_device *pusb_device)
int audio_gainget(struct usb_device *pusb_device)
{
int igot;