mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Brett Warden" <brett.warden@gmail.com>
To: "Ray Lee" <ray-lk@madrabbit.org>,
	"Randy Dunlap" <randy.dunlap@oracle.com>
Cc: linux-kernel@vger.kernel.org, trivial@kernel.org
Subject: Re: [PATCH] bw-qcam: use data_reverse instead of manually poking the control register
Date: Thu, 27 Sep 2007 12:28:31 -0700	[thread overview]
Message-ID: <a372714f0709271228r7de8a4a0p4c5d75e939513f08@mail.gmail.com> (raw)
In-Reply-To: <a372714f0709261443p25e99e4at39f4a09c850fb621@mail.gmail.com>

Fixes use of parport_write_control() to match the newer interface that
requires explicit parport_data_reverse() and parport_data_forward()
calls. This eliminates the following error message and restores the
original intended behavior:

parport0 (bw-qcam): use data_reverse for this!

Also increases threshold in qc_detect() from 300 to 400, as my camera
often results in a count of approx 330. Added a kernel error message
to indicate detection failure.

Signed-off-by: Brett T. Warden <brett.warden@gmail.com>

---

Thanks Ray and Randy for your comments, and for pointing out that I
needed to reset the port to forward mode!

diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 7d47cbe..961e377 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -104,6 +104,17 @@ 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) {
+               /* Set bidirectional mode to reverse (data in) */
+               parport_data_reverse(q->pport);
+       } else {
+               /* Set bidirectional mode to forward (data out) */
+               parport_data_forward(q->pport);
+       }
+
+       /* Now issue the regular port command, but strip out the
+        * direction flag */
+       d &= ~0x20;
        parport_write_control(q->pport, d);
 }

@@ -344,10 +355,13 @@ 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 < 300)
+       if (count > 20 && count < 400)
+       {
                return 1;       /* found */
-       else
+       } else {
+               printk(KERN_ERR "No Quickcam found on port %s\n",
q->pport->name);
                return 0;       /* not found */
+       }
 }





-- 
Brett Warden

  reply	other threads:[~2007-09-27 19:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26 19:12 Brett Warden
2007-09-26 19:43 ` Ray Lee
2007-09-26 20:06   ` Brett Warden
2007-09-26 21:00     ` Ray Lee
2007-09-26 21:43       ` Brett Warden
2007-09-27 19:28         ` Brett Warden [this message]
2007-09-27 21:29           ` Alan Cox
2007-09-26 21:00 ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a372714f0709271228r7de8a4a0p4c5d75e939513f08@mail.gmail.com \
    --to=brett.warden@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=ray-lk@madrabbit.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®