Skip to content

Commit

Permalink
staging/easycap: Improve hardware initialization
Browse files Browse the repository at this point in the history
Sometimes at startup the video urbs consistently and persistently deliver
bad data, each video frame (not isoc frame) containing an excess of
precisely two bytes.  A brute-force cure implemented here is to
repeatedly reinitialize the registers of the SAA7113H chip and the
STK1160 USB bridge until good behaviour is obtained.

Signed-off-by: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mike Thomas authored and Greg Kroah-Hartman committed Nov 10, 2010
1 parent e68703c commit f36bc37
Show file tree
Hide file tree
Showing 5 changed files with 1,345 additions and 544 deletions.
47 changes: 36 additions & 11 deletions drivers/staging/easycap/easycap.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@
#if (!defined(EASYCAP_H))
#define EASYCAP_H

/*---------------------------------------------------------------------------*/
/*
* THESE ARE NORMALLY DEFINED
*/
/*---------------------------------------------------------------------------*/
#define PATIENCE 500
#undef PREFER_NTSC
#define PERSEVERE
/*---------------------------------------------------------------------------*/
/*
* THESE ARE FOR MAINTENANCE ONLY - NORMALLY UNDEFINED:
*/
/*---------------------------------------------------------------------------*/
#undef PREFER_NTSC
#undef EASYCAP_TESTCARD
#undef EASYCAP_TESTTONE
#undef NOREADBACK
Expand Down Expand Up @@ -122,7 +129,7 @@

#define USB_SKEL_MINOR_BASE 192
#define DONGLE_MANY 8

#define INPUT_MANY 6
/*---------------------------------------------------------------------------*/
/*
* DEFAULT LUMINANCE, CONTRAST, SATURATION AND HUE
Expand All @@ -146,6 +153,7 @@
#if (USB_2_0_MAXPACKETSIZE > PAGE_SIZE)
#error video_isoc_buffer[.] will not be big enough
#endif
#define VIDEO_JUNK_TOLERATE VIDEO_ISOC_BUFFER_MANY
/*---------------------------------------------------------------------------*/
/*
* VIDEO BUFFERS
Expand Down Expand Up @@ -238,6 +246,7 @@ struct list_head list_head;
void *pgo;
void *pto;
__u16 kount;
__u16 input;
};
/*---------------------------------------------------------------------------*/
struct data_urb {
Expand All @@ -256,6 +265,22 @@ __u16 mask;
char name[128];
struct v4l2_format v4l2_format;
};
struct inputset {
int input;
int input_ok;
int standard_offset;
int standard_offset_ok;
int format_offset;
int format_offset_ok;
int brightness;
int brightness_ok;
int contrast;
int contrast_ok;
int saturation;
int saturation_ok;
int hue;
int hue_ok;
};
/*---------------------------------------------------------------------------*/
/*
* easycap.ilk == 0 => CVBS+S-VIDEO HARDWARE, AUDIO wMaxPacketSize=256
Expand All @@ -274,7 +299,7 @@ struct v4l2_device v4l2_device;
#endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/
#endif /*EASYCAP_IS_VIDEODEV_CLIENT*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/

int status;
unsigned int audio_pages_per_fragment;
unsigned int audio_bytes_per_fragment;
unsigned int audio_buffer_page_many;
Expand Down Expand Up @@ -302,7 +327,9 @@ int input;
int polled;
int standard_offset;
int format_offset;
struct inputset inputset[INPUT_MANY];

bool ntsc;
int fps;
int usec;
int tolerate;
Expand Down Expand Up @@ -480,6 +507,8 @@ int redaub(struct easycap *, void *, void *, \
int, int, __u8, __u8, bool);
void easycap_testcard(struct easycap *, int);
int fillin_formats(void);
int reset(struct easycap *);
int newinput(struct easycap *, int);
int adjust_standard(struct easycap *, v4l2_std_id);
int adjust_format(struct easycap *, __u32, __u32, __u32, \
int, bool);
Expand Down Expand Up @@ -517,11 +546,11 @@ int wakeup_device(struct usb_device *);
int confirm_resolution(struct usb_device *);
int confirm_stream(struct usb_device *);

int setup_stk(struct usb_device *);
int setup_saa(struct usb_device *);
int setup_stk(struct usb_device *, bool);
int setup_saa(struct usb_device *, bool);
int setup_vt(struct usb_device *);
int check_stk(struct usb_device *);
int check_saa(struct usb_device *);
int check_stk(struct usb_device *, bool);
int check_saa(struct usb_device *, bool);
int ready_saa(struct usb_device *);
int merit_saa(struct usb_device *);
int check_vt(struct usb_device *);
Expand All @@ -539,10 +568,6 @@ int stop_100(struct usb_device *);
int write_300(struct usb_device *);
int read_vt(struct usb_device *, __u16);
int write_vt(struct usb_device *, __u16, __u16);

int set2to78(struct usb_device *);
int set2to93(struct usb_device *);

int regset(struct usb_device *, __u16, __u16);
int regget(struct usb_device *, __u16, void *);
int isdongle(struct easycap *);
Expand Down
Loading

0 comments on commit f36bc37

Please sign in to comment.