From 7ffda86bc612f5670c3461d8342ccb24d2ebc547 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 27 Sep 2007 23:19:04 -0700 Subject: bw-qcam: use data_reverse instead of manually poking the control register From: Brett Warden 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. Thanks Ray and Randy for your comments, and for pointing out that I needed to reset the port to forward mode! Signed-off-by: Brett T. Warden Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/bw-qcam.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/video/bw-qcam.c b/linux/drivers/media/video/bw-qcam.c index a175d7810..f6d5197da 100644 --- a/linux/drivers/media/video/bw-qcam.c +++ b/linux/drivers/media/video/bw-qcam.c @@ -107,6 +107,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); } @@ -347,10 +358,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 */ + } } -- cgit v1.2.3 From 83fb6c87a9c82a47fd57ffaed422eba87114dbb1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Sep 2007 10:55:54 -0300 Subject: compat: allow compililation with kernels with updated sound drivers From: Mauro Carvalho Chehab A few distro kernels, like Mandriva 2.6.22.9-desktop-1mdv are starting to be shipped with the newer alsa drivers. This patch changes the compat code for older kernels in a way that it will be compatible also with those distro kernels. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-alsa.c | 2 +- v4l/scripts/gentree.pl | 3 +++ v4l/scripts/make_config_compat.pl | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c index f441193eb..d858bdd5c 100644 --- a/linux/drivers/media/video/cx88/cx88-alsa.c +++ b/linux/drivers/media/video/cx88/cx88-alsa.c @@ -103,7 +103,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t; #define chip_t snd_cx88_card_t #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +#ifdef COMPAT_SND_CTL_BOOLEAN_MONO static int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl index cfff178b1..a10738648 100755 --- a/v4l/scripts/gentree.pl +++ b/v4l/scripts/gentree.pl @@ -62,9 +62,12 @@ my %defs = ( 'I2C_PEC' => 1, 'I2C_DF_DUMMY' => 0, 'CONFIG_XC3028' => 0, + 'HAVE_XC2028'=> 0, + 'HAVE_XC3028' => 0, 'I2C_CLASS_TV_ANALOG' => 1, 'I2C_CLASS_TV_DIGITAL' => 1, 'OLD_XMIT_LOCK' => 0, + 'COMPAT_SND_CTL_BOOLEAN_MONO' => 0, 'CONFIG_VIVI_SCATTER' => 0, 'CONFIG_BIGPHYS_AREA' => 0, 'BUZ_USE_HIMEM' => 1, diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl index be577d247..21dce0126 100644 --- a/v4l/scripts/make_config_compat.pl +++ b/v4l/scripts/make_config_compat.pl @@ -26,9 +26,29 @@ sub check_spin_lock() close INNET; } +sub check_snd_ctl_boolean_mono_info() +{ + my $file = "$kdir/include/sound/control.h"; + my $old_syntax = 1; + + open INNET, "<$file" or die "File not found: $file"; + while () { + if (m/snd_ctl_boolean_mono_info/) { + $old_syntax = 0; + last; + } + } + + if ($old_syntax) { + $out.= "\n#define COMPAT_SND_CTL_BOOLEAN_MONO 1\n"; + } + close INNET; +} + sub check_other_dependencies() { check_spin_lock(); + check_snd_ctl_boolean_mono_info(); } # Do the basic rules -- cgit v1.2.3