X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fbw-qcam.c;h=b364adaae78d8e8262043a5e2c3734249ca01c51;hb=6db6ae2165863e26b7f41af54a8cf1ef9051a608;hp=0edd05ebcc3f05b80e1e18993350850ef28fedf8;hpb=9e19db5b6dda251b8d76c3a0069e63faca6be3f0;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 0edd05e..b364ada 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -82,11 +82,16 @@ OTHER DEALINGS IN THE SOFTWARE. static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */ static unsigned int yieldlines=4; /* Yield after this many during capture */ static int video_nr = -1; +static unsigned int force_init; /* Whether to probe aggressively */ module_param(maxpoll, int, 0); module_param(yieldlines, int, 0); module_param(video_nr, int, 0); +/* Set force_init=1 to avoid detection by polling status register and + * immediately attempt to initialize qcam */ +module_param(force_init, int, 0); + static inline int read_lpstatus(struct qcam_device *q) { return parport_read_status(q->pport); @@ -104,7 +109,7 @@ static inline void write_lpdata(struct qcam_device *q, int d) static inline void write_lpcontrol(struct qcam_device *q, int d) { - if(0x20 & d) { + if (d & 0x20) { /* Set bidirectional mode to reverse (data in) */ parport_data_reverse(q->pport); } else { @@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q) int count = 0; int i; + if (force_init) + return 1; + lastreg = reg = read_lpstatus(q) & 0xf0; for (i = 0; i < 500; i++) @@ -354,12 +362,12 @@ static int qc_detect(struct qcam_device *q) /* Be (even more) liberal in what you accept... */ -/* if (count > 30 && count < 200) */ - if (count > 20 && count < 400) - { + if (count > 20 && count < 400) { return 1; /* found */ } else { - printk(KERN_ERR "No Quickcam found on port %s\n", q->pport->name); + printk(KERN_ERR "No Quickcam found on port %s\n", + q->pport->name); + printk(KERN_DEBUG "Quickcam detection counter: %u\n", count); return 0; /* not found */ } } @@ -515,7 +523,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) int ret=1; unsigned int hi, lo; unsigned int hi2, lo2; - static int state = 0; + static int state; if (buffer == NULL) { @@ -890,7 +898,9 @@ static const struct file_operations qcam_fops = { .open = video_exclusive_open, .release = video_exclusive_release, .ioctl = qcam_ioctl, +#ifdef CONFIG_COMPAT .compat_ioctl = v4l_compat_ioctl32, +#endif .read = qcam_read, .llseek = no_llseek, }; @@ -899,13 +909,12 @@ static struct video_device qcam_template= .owner = THIS_MODULE, .name = "Connectix Quickcam", .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_QCAM_BW, .fops = &qcam_fops, }; #define MAX_CAMS 4 static struct qcam_device *qcams[MAX_CAMS]; -static unsigned int num_cams = 0; +static unsigned int num_cams; static int init_bwqcam(struct parport *port) {