public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Dvico Dual 4 card not working.
@ 2008-04-01  2:31 Nicholas Magers
  2008-04-01 15:41 ` Ben Caldwell
  0 siblings, 1 reply; 5+ messages in thread
From: Nicholas Magers @ 2008-04-01  2:31 UTC (permalink / raw)
  To: Ben Caldwell, video4linux-list; +Cc: alan

I'll be interested in the result.

 

From: Ben Caldwell [mailto:benny.caldwell@gmail.com] 
Sent: Tuesday, 1 April 2008 12:54 PM
To: video4linux-list@redhat.com
Cc: alan@redhat.com; Nicholas Magers
Subject: Re: Dvico Dual 4 card not working.

 

	---------- Forwarded message ----------
	From: Alan Cox <alan@redhat.com>
	To: Nicholas Magers <Nicholas.Magers@lands.nsw.gov.au>
	Date: Mon, 31 Mar 2008 05:32:05 -0400
	Subject: Re: Dvico Dual 4 card not working.
	On Mon, Mar 31, 2008 at 02:22:15PM +1100, Nicholas Magers wrote:
	> Dual 4 card no longer works. I use it with Mythtv. It seems
when I
	> updated my Nvidia graphics driver from Livna it had an effect.
I am at
	
	Nvidia driver reports should go to Nvidia, only they have the
source code
	so only they can help you

I have recently posted a similar problem with the dvico dual digital 4
card on a Fedora 8 mythtv box. I don't think that this problem is due to
the nvidia driver.

My tuner card was working fine until I updated the to the latest v4l
source from the hg repository a week or two back and made new kernel
modules, I included traces in my post which can be seen in the list
archives at the end of march.

I reverted to a previous kernel that still has the kernel modules made
from an earlier version of the v4l source and everything works fine
again. I am not going to try compiling new modules for the working
kernel as it could leave me with no way at all to use my tuner card.

 

So tonight I will try building modules for my latest kernel (from Fedora
updates) from an older version of the v4l source and report back to this
list with the results.

 

- Ben Caldwell


***************************************************************
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. 

Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department of  Lands.

This email message has been swept by MIMEsweeper for the presence of computer viruses.
***************************************************************

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dvico Dual 4 card not working.
  2008-04-01  2:31 Dvico Dual 4 card not working Nicholas Magers
@ 2008-04-01 15:41 ` Ben Caldwell
  2008-04-01 20:19   ` Michael Krufky
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Caldwell @ 2008-04-01 15:41 UTC (permalink / raw)
  To: Nicholas Magers; +Cc: alan, video4linux-list

On Tue, Apr 1, 2008 at 10:31 AM, Nicholas Magers <
Nicholas.Magers@lands.nsw.gov.au> wrote:

>  I'll be interested in the result.
>

After much plodding through changesets I have something to report. It seems
that the the dvico dual digital 4 card is broken in changesets after
d4df22377e83 (11 days ago).
It is interesting to note that the next change (the one that breaks it) is
"Removes video_dev from tuner-xc3028 config struct" - the dvico dual digital
4 has an xc3028.

So to get it working:
*hg update -r d4df22377e83
make clean
make rminstall
make release
make
make install*

Then reboot. One other interesting thing I have found is that sometimes
after compiling new modules I actually have to turn the PC off then on again
(rather than just a reboot) to get everything working properly.

- Ben
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dvico Dual 4 card not working.
  2008-04-01 15:41 ` Ben Caldwell
@ 2008-04-01 20:19   ` Michael Krufky
  2008-04-02 12:46     ` [linux-dvb] " Thomas Schuering
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Krufky @ 2008-04-01 20:19 UTC (permalink / raw)
  To: Ben Caldwell; +Cc: alan, Nicholas Magers, LInux DVB, video4linux-list

[-- Attachment #1: Type: text/plain, Size: 2435 bytes --]

On Tue, Apr 1, 2008 at 11:41 AM, Ben Caldwell <benny.caldwell@gmail.com> wrote:
> On Tue, Apr 1, 2008 at 10:31 AM, Nicholas Magers <
>  After much plodding through changesets I have something to report. It seems
>  that the the dvico dual digital 4 card is broken in changesets after
>  d4df22377e83 (11 days ago).
>  It is interesting to note that the next change (the one that breaks it) is
>  "Removes video_dev from tuner-xc3028 config struct" - the dvico dual digital
>  4 has an xc3028.
>
>  So to get it working:
>  *hg update -r d4df22377e83
>  make clean
>  make rminstall
>  make release
>  make
>  make install*
>
>  Then reboot. One other interesting thing I have found is that sometimes
>  after compiling new modules I actually have to turn the PC off then on again
>  (rather than just a reboot) to get everything working properly.
>
>  - Ben


Can you try using the v4l-dvb master branch hg repository on
linuxtv.org again, after applying the attached patch (see below)

It is clear what went wrong on the Dual Digital 4 --

Mauro did some changes recently that use a "magic number" (yuck) to
differentiate between devices and manage multiple instances of the
xc2028 driver on a hybrid design.

He used i2c_adapter->algo_data to generate this "magic number" ,
which, IMHO is a very bad idea, especially since some digital-only
devices do not even define algo_data.  On the other hand,
i2c_adap->algo_data is a reasonable structure to use for the
"video_dev" pointer in the tuner_callback function, *if* it is
defined.

The patch in the link above uses the 'hybrid_tuner_request_state"
method to manage multiple instances of the device driver on a hybrid
design.  This uses a *much* safer method, using the i2c_adapter ID
along with the device i2c address to identify unique instances.  For
the "video_dev" pointer, the patch also uses a safer method:  If the
dvb_adapter device is defined, use fe->dvb->priv, otherwise, fall back
to Mauro's previous method of using i2c_adap->algo_data.

Please note:  This patch is intended for testing purposes only --
there is a remaining issue in this patch, where it doesn't destroy
some memory properly when tuner instances are destroyed.  I'll be
happy to fix that remaining issue after I receive some reports that
the larger issue is actually remedied by this patch.

Please let me know if this fixes the problem, and I'll produce a new
patch afterwards.

Regards,

Mike Krufky

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xc-instance.patch --]
[-- Type: text/x-diff; name=xc-instance.patch, Size: 3767 bytes --]

diff -r 0776e4801991 linux/drivers/media/video/tuner-xc2028.c
--- a/linux/drivers/media/video/tuner-xc2028.c	Fri Mar 28 14:52:44 2008 -0300
+++ b/linux/drivers/media/video/tuner-xc2028.c	Tue Apr 01 15:57:38 2008 -0400
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(firmware_name, "Firmwar
 MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the "
 				"default firmware name\n");
 
-static LIST_HEAD(xc2028_list);
+static LIST_HEAD(hybrid_tuner_instance_list);
 static DEFINE_MUTEX(xc2028_list_mutex);
 
 /* struct for storing firmware table */
@@ -79,12 +79,11 @@ struct firmware_properties {
 };
 
 struct xc2028_data {
-	struct list_head        xc2028_list;
+	struct list_head        hybrid_tuner_instance_list;
 	struct tuner_i2c_props  i2c_props;
 	int                     (*tuner_callback) (void *dev,
 						   int command, int arg);
 	void			*video_dev;
-	int			count;
 	__u32			frequency;
 
 	struct firmware_description *firm;
@@ -1095,19 +1094,12 @@ static int xc2028_dvb_release(struct dvb
 
 	mutex_lock(&xc2028_list_mutex);
 
-	priv->count--;
-
-	if (!priv->count) {
-		list_del(&priv->xc2028_list);
-
-		kfree(priv->ctrl.fname);
-
-		free_firmware(priv);
-		kfree(priv);
-		fe->tuner_priv = NULL;
-	}
+	if (priv)
+		hybrid_tuner_release_state(priv);
 
 	mutex_unlock(&xc2028_list_mutex);
+
+	fe->tuner_priv = NULL;
 
 	return 0;
 }
@@ -1179,7 +1171,7 @@ struct dvb_frontend *xc2028_attach(struc
 				   struct xc2028_config *cfg)
 {
 	struct xc2028_data *priv;
-	void               *video_dev;
+	int instance;
 
 	if (debug)
 		printk(KERN_DEBUG "xc2028: Xcv2028/3028 init called!\n");
@@ -1192,48 +1184,40 @@ struct dvb_frontend *xc2028_attach(struc
 		return NULL;
 	}
 
-	video_dev = cfg->i2c_adap->algo_data;
-
-	if (debug)
-		printk(KERN_DEBUG "xc2028: video_dev =%p\n", video_dev);
-
 	mutex_lock(&xc2028_list_mutex);
 
-	list_for_each_entry(priv, &xc2028_list, xc2028_list) {
-		if (&priv->i2c_props.adap->dev == &cfg->i2c_adap->dev) {
-			video_dev = NULL;
-			if (debug)
-				printk(KERN_DEBUG "xc2028: reusing device\n");
-
-			break;
-		}
-	}
-
-	if (video_dev) {
-		priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-		if (priv == NULL) {
-			mutex_unlock(&xc2028_list_mutex);
-			return NULL;
-		}
-
-		priv->i2c_props.addr = cfg->i2c_addr;
-		priv->i2c_props.adap = cfg->i2c_adap;
-		priv->i2c_props.name = "xc2028";
-
-		priv->video_dev = video_dev;
+	instance = hybrid_tuner_request_state(struct xc2028_data, priv,
+					      hybrid_tuner_instance_list,
+					      cfg->i2c_adap, cfg->i2c_addr,
+					      "xc2028");
+	switch (instance) {
+	case 0:
+		/* memory allocation failure */
+		goto fail;
+		break;
+	case 1:
+		/* new tuner instance */
 		priv->tuner_callback = cfg->callback;
 		priv->ctrl.max_len = 13;
 
 		mutex_init(&priv->lock);
 
-		list_add_tail(&priv->xc2028_list, &xc2028_list);
-	}
-
-	fe->tuner_priv = priv;
-	priv->count++;
-
-	if (debug)
-		printk(KERN_DEBUG "xc2028: usage count is %i\n", priv->count);
+		/* analog side (tuner-core) uses i2c_adap->algo_data.
+		 * digital side is not guaranteed to have algo_data defined.
+		 *
+		 * digital side will always have fe->dvb defined.
+		 * analog side (tuner-core) doesn't (yet) define fe->dvb.
+		 */
+		priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ?
+				   fe->dvb->priv : cfg->i2c_adap->algo_data;
+
+		fe->tuner_priv = priv;
+		break;
+	case 2:
+		/* existing tuner instance */
+		fe->tuner_priv = priv;
+		break;
+	}
 
 	memcpy(&fe->ops.tuner_ops, &xc2028_dvb_tuner_ops,
 	       sizeof(xc2028_dvb_tuner_ops));
@@ -1246,6 +1230,11 @@ struct dvb_frontend *xc2028_attach(struc
 	mutex_unlock(&xc2028_list_mutex);
 
 	return fe;
+fail:
+	mutex_unlock(&xc2028_list_mutex);
+
+	xc2028_dvb_release(fe);
+	return NULL;
 }
 
 EXPORT_SYMBOL(xc2028_attach);

[-- Attachment #3: Type: text/plain, Size: 164 bytes --]

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-dvb] Dvico Dual 4 card not working.
  2008-04-01 20:19   ` Michael Krufky
@ 2008-04-02 12:46     ` Thomas Schuering
  2008-04-02 15:20       ` Ben Caldwell
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Schuering @ 2008-04-02 12:46 UTC (permalink / raw)
  To: Michael Krufky
  Cc: alan, video4linux-list, Nicholas Magers, LInux DVB, Ben Caldwell

Hi Mike,

On Tue, Apr 01, 2008 at 04:19:45PM -0400, Michael Krufky wrote:
> 
> Can you try using the v4l-dvb master branch hg repository on
> linuxtv.org again, after applying the attached patch (see below)

Let's see:
mv v4l-dvb v4l-dvb.old
hg clone http://linuxtv.org/hg/v4l-dvb/
cd v4l-dvb
patch -p1 < xc-instance.patch
make
make install
sync
shutdown -r


> Please let me know if this fixes the problem, and I'll produce a new
> patch afterwards.

I don't know what problem you're refering to - the machine comes up
successfully, but you can't use the card.

I used 'scan' for testing what gives an entry in /var/log/kern.log:
xc2028 0-0061: Loading 3 firmware images from xc3028-dvico-au-01.fw, type: DViCO DualDig4/Nano2 (Australia), ver 2.7

Then the process 'kdvb-fe-0' eats up 100% CPU-time,
the keyboard is dead. The machine hangs.

Hope this helps.


Regards, Thomas

os: Ubuntu 7.10
Linux tronn 2.6.22-14-generic #1 SMP Tue Feb 12 02:46:46 UTC 2008 x86_64 GNU/Linux
DViCO DualDig4 rev. 1.0

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [linux-dvb] Dvico Dual 4 card not working.
  2008-04-02 12:46     ` [linux-dvb] " Thomas Schuering
@ 2008-04-02 15:20       ` Ben Caldwell
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Caldwell @ 2008-04-02 15:20 UTC (permalink / raw)
  To: Thomas Schuering
  Cc: alan, LInux DVB, Nicholas Magers, Michael Krufky,
	video4linux-list

On Wed, Apr 2, 2008 at 8:46 PM, Thomas Schuering <linux-dvb@ts4.de> wrote:


> Then the process 'kdvb-fe-0' eats up 100% CPU-time,
> the keyboard is dead. The machine hangs.
>

Hi Mike,

I have the same problem as Thomas.

I applied your patch and recompiled. My machine starts up and finds the
cards ok. From the system log at this point:

*xc2028 1-0061: Loading 3 firmware images from xc3028-dvico-au-01.fw, type:
DViCO DualDig4/Nano2 (Australia), ver 2.7

*This is better than the current mercurial tip which leaves call traces in
the log just from finding the card, so you've definitely fixed something
there.*

*The problem comes when I start up my mythtv backend which accesses the
card, it failed and this was in the log:
*
BUG: soft lockup - CPU#0 stuck for 11s! [kdvb-fe-0:3131]
CPU 0:
Modules linked in: coretemp hwmon rfcomm l2cap bluetooth autofs4 sunrpc
nf_conntrack_ipv4 ipt_REJECT iptable_filter ip_tables nf_conntrack_ipv6
xt_state nf_conntrack xt_tcpudp ip6t_ipv6header ip6t_REJECT ip6table_filter
ip6_tables x_tables cpufreq_ondemand acpi_cpufreq dm_mirror dm_multipath
dm_mod ipv6 tuner_xc2028(U) zl10353(U) snd_hda_intel snd_seq_dummy
snd_seq_oss snd_seq_midi_event snd_seq dvb_usb_cxusb(U) snd_seq_device
snd_pcm_oss arc4 snd_mixer_oss ecb blkcipher snd_pcm dvb_usb(U) nvidia(P)(U)
dvb_core(U) ath5k firewire_ohci firewire_core snd_timer snd_page_alloc
mac80211 snd_hwdep snd parport_pc parport crc_itu_t lirc_mod_mce(U) cfg80211
lirc_dev(U) iTCO_wdt iTCO_vendor_support serio_raw i2c_i801 pcspkr e1000
soundcore i2c_core sg sr_mod cdrom button pata_marvell ahci libata sd_mod
scsi_mod ext3 jbd mbcache uhci_hcd ohci_hcd ehci_hcd
Pid: 3131, comm: kdvb-fe-0 Tainted: P        2.6.24.3-50.fc8 #1
RIP: 0010:[<ffffffff81269781>]  [<ffffffff81269781>] _spin_lock+0x7/0xf
RSP: 0018:ffff81002a0bbb78  EFLAGS: 00000286
RAX: 00000000ffffffff RBX: ffff81003e58d748 RCX: ffff81002a0bbc7f
RDX: ffff81002a0bbfd8 RSI: 0000000000000122 RDI: ffff81003e58d74c
RBP: ffffffff8102bea6 R08: 0000000000000001 R09: 0000000000000000
R10: ffff81002a0bbc20 R11: 0000000000000002 R12: ffffffff8138ffd0
R13: ffffffff8104922a R14: ffff81002a0bbb20 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffffffff813cb000(0000) knlGS:0000000000000000
CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
CR2: 0000003b1889afa0 CR3: 0000000000201000 CR4: 00000000000006a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400

Call Trace:
 [<ffffffff81268872>] __mutex_lock_interruptible_slowpath+0x1d/0xc7
 [<ffffffff81082cf5>] zone_statistics+0x3f/0x60
 [<ffffffff88a72ae9>] :dvb_usb:dvb_usb_generic_rw+0x6c/0x228
 [<ffffffff88ab81b2>] :dvb_usb_cxusb:cxusb_ctrl_msg+0x88/0x96
 [<ffffffff8101b582>] smp_call_function_mask+0x66/0x78
 [<ffffffff88ab8330>] :dvb_usb_cxusb:cxusb_bluebird_gpio_rw+0x39/0x72
 [<ffffffff88ab8e36>] :dvb_usb_cxusb:cxusb_bluebird_gpio_pulse+0x41/0x4f
 [<ffffffff88ab918e>]
:dvb_usb_cxusb:dvico_bluebird_xc2028_callback+0x3f/0x91
 [<ffffffff88b4f794>] :tuner_xc2028:generic_set_freq+0x89e/0x156a
 [<ffffffff88b4942c>] :zl10353:zl10353_single_write+0x4d/0x75
 [<ffffffff88b49a0f>] :zl10353:zl10353_set_parameters+0x3b9/0x45c
 [<ffffffff8103f3c0>] try_to_del_timer_sync+0x51/0x5a
 [<ffffffff881ee84d>] :dvb_core:dvb_frontend_swzigzag_autotune+0x189/0x1b1
 [<ffffffff881ef0db>] :dvb_core:dvb_frontend_swzigzag+0x1b8/0x21c
 [<ffffffff810492a4>] finish_wait+0x32/0x5d
 [<ffffffff881eff22>] :dvb_core:dvb_frontend_thread+0x28f/0x351
 [<ffffffff81049221>] autoremove_wake_function+0x0/0x2e
 [<ffffffff881efc93>] :dvb_core:dvb_frontend_thread+0x0/0x351
 [<ffffffff810490f2>] kthread+0x47/0x75
 [<ffffffff8100cca8>] child_rip+0xa/0x12
 [<ffffffff8101ced7>] lapic_next_event+0x0/0xa
 [<ffffffff810490ab>] kthread+0x0/0x75
 [<ffffffff8100cc9e>] child_rip+0x0/0x12

*Hope that helps,

Ben
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-02 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01  2:31 Dvico Dual 4 card not working Nicholas Magers
2008-04-01 15:41 ` Ben Caldwell
2008-04-01 20:19   ` Michael Krufky
2008-04-02 12:46     ` [linux-dvb] " Thomas Schuering
2008-04-02 15:20       ` Ben Caldwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox