Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce36ceda authored by Mike Thomas's avatar Mike Thomas Committed by Greg Kroah-Hartman
Browse files

staging/easycap: Remove obsolete routines



The so-called bridger routine has proved unnecessary following general
improvements elsewhere.  The explain_() functions were a convenience
during early development, but are unnecessary and inappropriate now.

Signed-off-by: default avatarMike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 050afc92
Loading
Loading
Loading
Loading
+2 −34
Original line number Diff line number Diff line
@@ -42,12 +42,6 @@
#if (!defined(EASYCAP_H))
#define EASYCAP_H

#if defined(EASYCAP_DEBUG)
#if (9 < EASYCAP_DEBUG)
#error Debug levels 0 to 9 are okay.\
  To achieve higher levels, remove this trap manually from easycap.h
#endif
#endif /*EASYCAP_DEBUG*/
/*---------------------------------------------------------------------------*/
/*
 *  THESE ARE FOR MAINTENANCE ONLY - NORMALLY UNDEFINED:
@@ -56,21 +50,9 @@
#undef  PREFER_NTSC
#undef  EASYCAP_TESTCARD
#undef  EASYCAP_TESTTONE
#undef  LOCKFRAME
#undef  NOREADBACK
#undef  AUDIOTIME
/*---------------------------------------------------------------------------*/
/*
 *
 *  DEFINE   BRIDGER   TO ACTIVATE THE ROUTINE FOR BRIDGING VIDEOTAPE DROPOUTS.
 *
 *             *** UNDER DEVELOPMENT/TESTING - NOT READY YET!***
 *
 */
/*---------------------------------------------------------------------------*/
#undef  BRIDGER
/*---------------------------------------------------------------------------*/

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
@@ -135,7 +117,7 @@
#define USB_EASYCAP_VENDOR_ID	0x05e1
#define USB_EASYCAP_PRODUCT_ID	0x0408

#define EASYCAP_DRIVER_VERSION "0.8.21"
#define EASYCAP_DRIVER_VERSION "0.8.41"
#define EASYCAP_DRIVER_DESCRIPTION "easycapdc60"

#define USB_SKEL_MINOR_BASE     192
@@ -291,8 +273,6 @@ unsigned int audio_buffer_page_many;
__s16 oldaudio;
#endif /*UPSAMPLE*/

struct easycap_format easycap_format[1 + SETTINGS_MANY];

int ilk;
bool microphone;

@@ -307,10 +287,6 @@ struct usb_interface *pusb_interface;

struct kref kref;

struct mutex mutex_mmap_video[FRAME_BUFFER_MANY];
struct mutex mutex_timeval0;
struct mutex mutex_timeval1;

int queued[FRAME_BUFFER_MANY];
int done[FRAME_BUFFER_MANY];

@@ -347,8 +323,6 @@ int video_idle;
int    video_eof;
int    video_junk;

int    fudge;

struct data_buffer video_isoc_buffer[VIDEO_ISOC_BUFFER_MANY];
struct data_buffer \
	     field_buffer[FIELD_BUFFER_MANY][(FIELD_BUFFER_SIZE/PAGE_SIZE)];
@@ -489,11 +463,7 @@ int kill_video_urbs(struct easycap *);
int              field2frame(struct easycap *);
int              redaub(struct easycap *, void *, void *, \
						int, int, __u8, __u8, bool);
void             debrief(struct easycap *);
void             sayreadonly(struct easycap *);
void             easycap_testcard(struct easycap *, int);
int              explain_ioctl(__u32);
int              explain_cid(__u32);
int              fillin_formats(void);
int              adjust_standard(struct easycap *, v4l2_std_id);
int              adjust_format(struct easycap *, __u32, __u32, __u32, \
@@ -595,7 +565,7 @@ unsigned long long int remainder;

#if defined(EASYCAP_DEBUG)
#define JOT(n, format, args...) do { \
	if (n <= easycap_debug) { \
	if (n <= debug) { \
		printk(KERN_DEBUG "easycap: %s: " format, __func__, ##args); \
	} \
} while (0)
@@ -603,8 +573,6 @@ unsigned long long int remainder;
#define JOT(n, format, args...) do {} while (0)
#endif /*EASYCAP_DEBUG*/

#define POUT JOT(8, ":-(in file %s line %4i\n", __FILE__, __LINE__)

#define MICROSECONDS(X, Y) \
			((1000000*((long long int)(X.tv_sec - Y.tv_sec))) + \
					(long long int)(X.tv_usec - Y.tv_usec))
+2 −2
Original line number Diff line number Diff line
/*****************************************************************************
*                                                                            *
*  easycap_debug.h                                                           *
*  debug.h                                                           *
*                                                                            *
*****************************************************************************/
/*
@@ -24,4 +24,4 @@
 *
*/
/*****************************************************************************/
extern int easycap_debug;
extern int debug;
+40 −655

File changed.

Preview size limit exceeded, changes collapsed.

+0 −23
Original line number Diff line number Diff line
@@ -64,45 +64,22 @@ const struct stk1160config { int reg; int set; } stk1160config[256] = {

#if defined(PREFER_NTSC)

#undef  OLDMARGIN
#if defined(OLDMARGIN)
	{0x110, 0x0008},
#else
	{0x110, 0x0014},
#endif /*OLDMARGIN*/

	{0x111, 0x0000},
	{0x112, 0x0003},
	{0x113, 0x0000},

#if defined(OLDMARGIN)
	{0x114, 0x0508},
#else
	{0x114, 0x0514},
#endif /*OLDMARGIN*/

	{0x115, 0x0005},
	{0x116, 0x00F3},
	{0x117, 0x0000},

#else /* ! PREFER_NTSC*/

#if defined(OLDMARGIN)
	{0x110, 0x0008},
#else
	{0x110, 0x0014},
#endif /*OLDMARGIN*/

	{0x111, 0x0000},
	{0x112, 0x0020},
	{0x113, 0x0000},

#if defined(OLDMARGIN)
	{0x114, 0x0508},
#else
	{0x114, 0x0514},
#endif /*OLDMARGIN*/

	{0x115, 0x0005},
	{0x116, 0x0110},
	{0x117, 0x0001},
+6 −125
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@
#include "easycap.h"
#include "easycap_standard.h"

int easycap_debug;
module_param(easycap_debug, int, S_IRUGO | S_IWUSR);
int debug;
module_param(debug, int, S_IRUGO | S_IWUSR);

/*---------------------------------------------------------------------------*/
/*
@@ -314,8 +314,6 @@ peasycap->audio_eof = 0;

do_gettimeofday(&peasycap->timeval7);

peasycap->fudge = 0;

JOT(4, "finished initialization\n");
return 0;
}
@@ -855,15 +853,11 @@ if (NULL == peasycap) {
 */
/*---------------------------------------------------------------------------*/
miss = 0;
if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
	return -ERESTARTSYS;
while ((peasycap->field_read == peasycap->field_fill) || \
				(0 != (0xFF00 & peasycap->field_buffer\
					[peasycap->field_read][0].kount)) || \
				(0 != (0x00FF & peasycap->field_buffer\
					[peasycap->field_read][0].kount))) {
	mutex_unlock(&(peasycap->mutex_mmap_video[0]));

	if (mode)
		return -EAGAIN;

@@ -888,15 +882,11 @@ while ((peasycap->field_read == peasycap->field_fill) || \
	}
	if (peasycap->video_eof) {
		JOT(8, "%i=peasycap->video_eof\n", peasycap->video_eof);
		debrief(peasycap);
		kill_video_urbs(peasycap);
		return -EIO;
	}
miss++;
if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
	return -ERESTARTSYS;
}
mutex_unlock(&(peasycap->mutex_mmap_video[0]));
JOT(8, "first awakening on wq_video after %i waits\n", miss);

rc = field2frame(peasycap);
@@ -925,15 +915,11 @@ JOT(8, "bumped to: %i=peasycap->frame_fill\n", peasycap->frame_fill);
 */
/*---------------------------------------------------------------------------*/
miss = 0;
if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
	return -ERESTARTSYS;
while ((peasycap->field_read == peasycap->field_fill) || \
				(0 != (0xFF00 & peasycap->field_buffer\
					[peasycap->field_read][0].kount)) || \
				(0 == (0x00FF & peasycap->field_buffer\
					[peasycap->field_read][0].kount))) {
	mutex_unlock(&(peasycap->mutex_mmap_video[0]));

	if (mode)
		return -EAGAIN;

@@ -957,15 +943,11 @@ while ((peasycap->field_read == peasycap->field_fill) || \
	}
	if (peasycap->video_eof) {
		JOT(8, "%i=peasycap->video_eof\n", peasycap->video_eof);
		debrief(peasycap);
		kill_video_urbs(peasycap);
		return -EIO;
	}
miss++;
if (mutex_lock_interruptible(&(peasycap->mutex_mmap_video[0])))
	return -ERESTARTSYS;
}
mutex_unlock(&(peasycap->mutex_mmap_video[0]));
JOT(8, "second awakening on wq_video after %i waits\n", miss);

rc = field2frame(peasycap);
@@ -2233,41 +2215,6 @@ default: {
return 0;
}
/*****************************************************************************/
void
debrief(struct easycap *peasycap)
{
if ((struct usb_device *)NULL != peasycap->pusb_device) {
	check_stk(peasycap->pusb_device);
	check_saa(peasycap->pusb_device);
	sayreadonly(peasycap);
	SAY("%i=peasycap->field_fill\n", peasycap->field_fill);
	SAY("%i=peasycap->field_read\n", peasycap->field_read);
	SAY("%i=peasycap->frame_fill\n", peasycap->frame_fill);
	SAY("%i=peasycap->frame_read\n", peasycap->frame_read);
}
return;
}
/*****************************************************************************/
void
sayreadonly(struct easycap *peasycap)
{
static int done;
int got00, got1F, got60, got61, got62;

if ((!done) && ((struct usb_device *)NULL != peasycap->pusb_device)) {
	done = 1;
	got00 = read_saa(peasycap->pusb_device, 0x00);
	got1F = read_saa(peasycap->pusb_device, 0x1F);
	got60 = read_saa(peasycap->pusb_device, 0x60);
	got61 = read_saa(peasycap->pusb_device, 0x61);
	got62 = read_saa(peasycap->pusb_device, 0x62);
	SAY("0x%02X=reg0x00  0x%02X=reg0x1F\n", got00, got1F);
	SAY("0x%02X=reg0x60  0x%02X=reg0x61  0x%02X=reg0x62\n", \
							got60, got61, got62);
}
return;
}
/*****************************************************************************/
/*---------------------------------------------------------------------------*/
/*
 *  SEE CORBET ET AL. "LINUX DEVICE DRIVERS", 3rd EDITION, PAGES 430-434
@@ -2355,7 +2302,6 @@ if (NULL == peasycap) {
	SAY("ERROR: peasycap is NULL\n");
	return retcode;
}
mutex_lock(&(peasycap->mutex_mmap_video[0]));
/*---------------------------------------------------------------------------*/
pbuf = peasycap->frame_buffer[k][m].pgo;
if (NULL == pbuf) {
@@ -2370,7 +2316,6 @@ if (NULL == page) {
get_page(page);
/*---------------------------------------------------------------------------*/
finish:
mutex_unlock(&(peasycap->mutex_mmap_video[0]));
if (NULL == page) {
	SAY("ERROR:  page is NULL after get_page(page)\n");
} else {
@@ -2383,7 +2328,7 @@ return retcode;
/*---------------------------------------------------------------------------*/
/*
 *  ON COMPLETION OF A VIDEO URB ITS DATA IS COPIED TO THE FIELD BUFFERS
 *  PROVIDED peasycap->video_idle IS ZER0.  REGARDLESS OF THIS BEING TRUE,
 *  PROVIDED peasycap->video_idle IS ZERO.  REGARDLESS OF THIS BEING TRUE,
 *  IT IS RESUBMITTED PROVIDED peasycap->video_isoc_streaming IS NOT ZERO.
 *
 *  THIS FUNCTION IS AN INTERRUPT SERVICE ROUTINE AND MUST NOT SLEEP.
@@ -2400,7 +2345,7 @@ return retcode;
 *      0 != (kount & 0x8000)   => AT LEAST ONE URB COMPLETED WITH ERRORS
 *      0 != (kount & 0x4000)   => BUFFER HAS TOO MUCH DATA
 *      0 != (kount & 0x2000)   => BUFFER HAS NOT ENOUGH DATA
 *      0 != (kount & 0x0400)   => FIELD WAS SUBMITTED BY BRIDGER ROUTINE
 *      0 != (kount & 0x0400)   => RESERVED
 *      0 != (kount & 0x0200)   => FIELD BUFFER NOT YET CHECKED
 *      0 != (kount & 0x0100)   => BUFFER HAS TWO EXTRA BYTES - WHY?
 */
@@ -2417,10 +2362,6 @@ int videofieldamount;
unsigned int override;
int framestatus, framelength, frameactual, frameoffset;
__u8 *pu;
#if defined(BRIDGER)
struct timeval timeval;
long long usec;
#endif /*BRIDGER*/

if (NULL == purb) {
	SAY("ERROR: easycap_complete(): purb is NULL\n");
@@ -2864,55 +2805,6 @@ if (purb->status) {
	}
}
/*---------------------------------------------------------------------------*/
/*
 *
 *
 *             *** UNDER DEVELOPMENT/TESTING - NOT READY YET! ***
 *
 *
 *
 *  VIDEOTAPES MAY HAVE BEEN MANUALLY PAUSED AND RESTARTED DURING RECORDING.
 *  THIS CAUSES LOSS OF SYNC, CONFUSING DOWNSTREAM USERSPACE PROGRAMS WHICH
 *  MAY INTERPRET THE INTERRUPTION AS A SYMPTOM OF LATENCY.  TO OVERCOME THIS
 *  THE DRIVER BRIDGES THE HIATUS BY SENDING DUMMY VIDEO FRAMES AT ROUGHLY
 *  THE RIGHT TIME INTERVALS IN THE HOPE OF PERSUADING THE DOWNSTREAM USERSPACE
 *  PROGRAM TO RESUME NORMAL SERVICE WHEN THE INTERRUPTION IS OVER.
 */
/*---------------------------------------------------------------------------*/
#if defined(BRIDGER)
do_gettimeofday(&timeval);
if (peasycap->timeval7.tv_sec) {
	usec = 1000000*(timeval.tv_sec  - peasycap->timeval7.tv_sec) + \
			(timeval.tv_usec - peasycap->timeval7.tv_usec);
	if (usec > (peasycap->usec + peasycap->tolerate)) {
		JOT(8, "bridging hiatus\n");
		peasycap->video_junk = 0;
		peasycap->field_buffer[peasycap->field_fill][0].kount |= 0x0400;

		peasycap->field_read = (peasycap->field_fill)++;

		if (FIELD_BUFFER_MANY <= peasycap->field_fill) \
						peasycap->field_fill = 0;
		peasycap->field_page = 0;
		pfield_buffer = &peasycap->field_buffer\
				[peasycap->field_fill][peasycap->field_page];
		pfield_buffer->pto = pfield_buffer->pgo;

		JOT(8, "bumped to: %i=peasycap->field_fill  %i=parity\n", \
			peasycap->field_fill, 0x00FF & pfield_buffer->kount);
		JOT(8, "field buffer %i has %i bytes to be overwritten\n", \
			peasycap->field_read, videofieldamount);
		JOT(8, "wakeup call to wq_video, " \
			"%i=field_read %i=field_fill %i=parity\n", \
			peasycap->field_read, peasycap->field_fill, \
			0x00FF & \
			peasycap->field_buffer[peasycap->field_read][0].kount);
		wake_up_interruptible(&(peasycap->wq_video));
		do_gettimeofday(&peasycap->timeval7);
	}
}
#endif /*BRIDGER*/
/*---------------------------------------------------------------------------*/
/*
 *  RESUBMIT THIS URB, UNLESS A SEVERE PERSISTENT ERROR CONDITION EXISTS.
 *
@@ -3152,12 +3044,6 @@ if (0 == bInterfaceNumber) {
	init_waitqueue_head(&(peasycap->wq_video));
	init_waitqueue_head(&(peasycap->wq_audio));

	mutex_init(&(peasycap->mutex_timeval0));
	mutex_init(&(peasycap->mutex_timeval1));

	for (k = 0; k < FRAME_BUFFER_MANY; k++)
		mutex_init(&(peasycap->mutex_mmap_video[k]));

	peasycap->ilk = 0;
	peasycap->microphone = false;

@@ -3176,11 +3062,6 @@ if (0 == bInterfaceNumber) {
	peasycap->audio_isoc_buffer_size = -1;

	peasycap->frame_buffer_many = FRAME_BUFFER_MANY;

	if ((struct mutex *)NULL == &(peasycap->mutex_mmap_video[0])) {
		SAY("ERROR: &(peasycap->mutex_mmap_video[%i]) is NULL\n", 0);
		return -EFAULT;
	}
/*---------------------------------------------------------------------------*/
/*
 *  DYNAMICALLY FILL IN THE AVAILABLE FORMATS.
@@ -4308,7 +4189,7 @@ easycap_module_init(void)
int result;

SAY("========easycap=======\n");
JOT(4, "begins.  %i=debug\n", easycap_debug);
JOT(4, "begins.  %i=debug\n", debug);
SAY("version: " EASYCAP_DRIVER_VERSION "\n");
/*---------------------------------------------------------------------------*/
/*
@@ -4349,6 +4230,6 @@ MODULE_AUTHOR("R.M. Thomas <rmthomas@sciolus.org>");
MODULE_DESCRIPTION(EASYCAP_DRIVER_DESCRIPTION);
MODULE_VERSION(EASYCAP_DRIVER_VERSION);
#if defined(EASYCAP_DEBUG)
MODULE_PARM_DESC(easycap_debug, "debug: 0 (default), 1, 2,...");
MODULE_PARM_DESC(debug, "debug: 0 (default), 1, 2,...");
#endif /*EASYCAP_DEBUG*/
/*****************************************************************************/
Loading