Commit d685a483 authored by Brett T. Warden's avatar Brett T. Warden Committed by Mauro Carvalho Chehab

V4L/DVB (7013): bw-qcam: add module parameter 'force_init' to skip polite...

V4L/DVB (7013): bw-qcam: add module parameter 'force_init' to skip polite auto-detection prior to direct initialization

Setting force_init=1 bypasses the friendly auto-detection by polling the
status register, and instead attempts to initialize the qcam directly.  Not
friendly to other parallel devices, but much more reliable than the
auto-detection.
Signed-off-by: default avatarBrett T. Warden <brett.warden@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent a19602f2
...@@ -82,11 +82,16 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -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 maxpoll=250; /* Maximum busy-loop count for qcam I/O */
static unsigned int yieldlines=4; /* Yield after this many during capture */ static unsigned int yieldlines=4; /* Yield after this many during capture */
static int video_nr = -1; static int video_nr = -1;
static unsigned int force_init; /* Whether to probe aggressively */
module_param(maxpoll, int, 0); module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0); module_param(yieldlines, int, 0);
module_param(video_nr, 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) static inline int read_lpstatus(struct qcam_device *q)
{ {
return parport_read_status(q->pport); return parport_read_status(q->pport);
...@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q) ...@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0; int count = 0;
int i; int i;
if (force_init)
return 1;
lastreg = reg = read_lpstatus(q) & 0xf0; lastreg = reg = read_lpstatus(q) & 0xf0;
for (i = 0; i < 500; i++) for (i = 0; i < 500; i++)
...@@ -354,12 +362,12 @@ static int qc_detect(struct qcam_device *q) ...@@ -354,12 +362,12 @@ static int qc_detect(struct qcam_device *q)
/* Be (even more) liberal in what you accept... */ /* 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 */ return 1; /* found */
} else { } else {
printk(KERN_ERR "No Quickcam found on port %s\n", printk(KERN_ERR "No Quickcam found on port %s\n",
q->pport->name); q->pport->name);
printk(KERN_DEBUG "Quickcam detection counter: %u\n", count);
return 0; /* not found */ return 0; /* not found */
} }
} }
......
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