2007-12-05 00:21:50

by Brett T. Warden

[permalink] [raw]
Subject: [PATCH] bw-qcam: adds parameter aggressive to skip passive detection and directly attempt initialization

---

diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 5842352..b74a9cb 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 aggressive; /* Whether to probe aggressively */

module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0);
module_param(video_nr, int, 0);

+/* Set aggressive=1 to avoid detection by polling status register and
+ * immediately attempt to initialize qcam */
+module_param(aggressive, int, 0);
+
static inline int read_lpstatus(struct qcam_device *q)
{
return parport_read_status(q->pport);
@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;

+ if (aggressive)
+ 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) {
return 1; /* found */
} else {
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 */
}
}


2007-12-05 00:51:27

by Alan

[permalink] [raw]
Subject: Re: [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.

On Tue, 4 Dec 2007 16:44:41 -0800
"Brett T. Warden" <[email protected]> wrote:

> Setting aggressive=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.

Someone still has a bw-qcam device ?

The status polling ought to be rock solid - what values do you see ?

2007-12-05 17:43:14

by Alan

[permalink] [raw]
Subject: Re: [PATCH] bw-qcam: adds parameter aggressive to skip passive detection and directly attempt initialization

On Tue, 4 Dec 2007 16:14:13 -0800
"Brett T. Warden" <[email protected]> wrote:

> ---
>
> diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
> index 5842352..b74a9cb 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 aggressive;

Acked-by: Alan Cox <[email protected]>

Although I would suggest that "aggressive" may not be the best term - I'm
not such of a good one however - skip_passive ?

2007-12-05 18:31:24

by Brett T. Warden

[permalink] [raw]
Subject: Re: [PATCH] bw-qcam: adds parameter aggressive to skip passive detection and directly attempt initialization

On Dec 5, 2007 9:37 AM, Alan Cox <[email protected]> wrote:

> Although I would suggest that "aggressive" may not be the best term - I'm
> not such of a good one however - skip_passive ?

How about force_init?

--
Brett Warden

2007-12-06 20:39:18

by Bill Davidsen

[permalink] [raw]
Subject: Re: [PATCH] bw-qcam: adds parameter aggressive to skip passive detection and directly attempt initialization

Brett Warden wrote:
> On Dec 5, 2007 9:37 AM, Alan Cox <[email protected]> wrote:
>
>> Although I would suggest that "aggressive" may not be the best term - I'm
>> not such of a good one however - skip_passive ?
>
> How about force_init?
>
Much more descriptive.


--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

2007-12-05 00:44:52

by Brett T. Warden

[permalink] [raw]
Subject: [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.

Setting aggressive=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: Brett T. Warden <[email protected]>
---
drivers/media/video/bw-qcam.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 5842352..b74a9cb 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 aggressive; /* Whether to probe aggressively */

module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0);
module_param(video_nr, int, 0);

+/* Set aggressive=1 to avoid detection by polling status register and
+ * immediately attempt to initialize qcam */
+module_param(aggressive, int, 0);
+
static inline int read_lpstatus(struct qcam_device *q)
{
return parport_read_status(q->pport);
@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;

+ if (aggressive)
+ 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) {
return 1; /* found */
} else {
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 */
}
}
--
1.5.2.5

2008-01-02 23:51:35

by Brett T. Warden

[permalink] [raw]
Subject: [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.

Setting aggressive=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: Brett T. Warden <[email protected]>
---
drivers/media/video/bw-qcam.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 5842352..b74a9cb 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 aggressive; /* Whether to probe aggressively */

module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0);
module_param(video_nr, int, 0);

+/* Set aggressive=1 to avoid detection by polling status register and
+ * immediately attempt to initialize qcam */
+module_param(aggressive, int, 0);
+
static inline int read_lpstatus(struct qcam_device *q)
{
return parport_read_status(q->pport);
@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;

+ if (aggressive)
+ 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) {
return 1; /* found */
} else {
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 */
}
}
--
1.5.3.7

2008-01-02 23:51:48

by Brett T. Warden

[permalink] [raw]
Subject: [PATCH] bw-qcam: Rename parameter 'aggressive' to 'force_init'

Changed new parameter name to 'force_init' for clarity, as per feedback.

Signed-off-by: Brett T. Warden <[email protected]>
---
drivers/media/video/bw-qcam.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index b74a9cb..0322653 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -82,15 +82,15 @@ 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 aggressive; /* Whether to probe aggressively */
+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 aggressive=1 to avoid detection by polling status register and
+/* Set force_init=1 to avoid detection by polling status register and
* immediately attempt to initialize qcam */
-module_param(aggressive, int, 0);
+module_param(force_init, int, 0);

static inline int read_lpstatus(struct qcam_device *q)
{
@@ -336,7 +336,7 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;

- if (aggressive)
+ if (force_init)
return 1;

lastreg = reg = read_lpstatus(q) & 0xf0;
--
1.5.3.7

2008-01-02 23:53:18

by Alan

[permalink] [raw]
Subject: Re: [PATCH] bw-qcam: Rename parameter 'aggressive' to 'force_init'

On Wed, 2 Jan 2008 15:51:25 -0800
"Brett T. Warden" <[email protected]> wrote:

> Changed new parameter name to 'force_init' for clarity, as per feedback.
>
> Signed-off-by: Brett T. Warden <[email protected]>

Acked-by: Alan Cox <[email protected]>