Hi Hans,

There has been plenty of code changes happened to the userspace-tuner
project. I have made the necessary modifications to your xceive enabled
ivtv driver to bring it up to date with regards to those changes.
I also moved the userspace tuner initialization stuff near to the
part that initializes the "plain" tuners.

The attached patch applies against your v4l-dvb-xc tree at:

http://linuxtv.org/hg/~hverkuil/v4l-dvb-xc

To compile the patched driver, you will also have to replace
tuner-stub.h with the latest version from Markus' userspace-tuner repo:

http://mcentral.de/hg/~mrec/userspace-tuner


Zoltan







xceive tuner: adapt to the changes from userspace-tuner

diff -r 505edf61b7b2 linux/drivers/media/video/ivtv/ivtv-driver.c
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c	Fri Aug 24 17:10:41 2007 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c	Fri Aug 24 20:09:22 2007 +0200
@@ -830,19 +830,11 @@ static void ivtv_load_and_init_modules(s
 	if (hw & IVTV_HW_TUNER) {
 		if (itv->options.tuner == TUNER_XCEIVE_XC3028) {
 #ifdef HAVE_XC2028
-			struct tuner_config config;
-
-			memset(&config, 0, sizeof(config));
-			config.tunerid = 1;
-			config.clientid = -1;
-			itv->tunerid = tuner_register_client(&itv->i2c_adap,
-				ivtv_reset_tuner_gpio, itv, &config);
+			ivtv_request_module(itv, "tuner-stub");
 #else
 			IVTV_INFO("Xceive tuner not yet supported, only composite and S-Video inputs will be available\n");
-			itv->tunerid = 1;
-#endif
-		}
-		else {
+#endif
+		} else {
 			ivtv_request_module(itv, "tuner");
 		}
 	}
@@ -1149,7 +1141,24 @@ static int __devinit ivtv_probe(struct p
 	if (itv->options.radio > 0)
 		itv->v4l2_cap |= V4L2_CAP_RADIO;
 
-	if (itv->options.tuner > -1 && itv->tunerid == 0) {
+#ifdef HAVE_XC2028
+	if (itv->options.tuner == TUNER_XCEIVE_XC3028) {
+
+		struct tuner_config config;
+
+		memset(&config, 0, sizeof(config));
+		memset(&itv->tops, 0, sizeof(struct tuner_object));
+		config.tunerid = tuner_translateid(itv->options.tuner);
+		config.vendorid = itv->dev->subsystem_vendor;
+		config.productid = itv->dev->subsystem_device; 
+		tuner_bridge_attach(&itv->i2c_adap, ivtv_reset_tuner_gpio, 
+			itv, &config, &itv->tops);
+		if(!TUNER_CLIENT_ID(itv->tops))
+			IVTV_ERR("tuner_bridge_attach() failed!\n");
+	} else if (itv->options.tuner > -1) {
+#else
+	if (itv->options.tuner > -1 && itv->options.tuner != TUNER_XCEIVE_XC3028) {
+#endif
 		struct tuner_setup setup;
 
 		setup.addr = ADDR_UNSET;
@@ -1340,7 +1349,10 @@ static void ivtv_remove(struct pci_dev *
 	release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
 	if (itv->has_cx23415)
 		release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
-
+#ifdef HAVE_XC2028
+	if (TUNER_CLIENT_ID(itv->tops))
+		tuner_bridge_detach(itv->tops);
+#endif
 	pci_disable_device(itv->dev);
 
 	IVTV_INFO("Removed %s, card #%d\n", itv->card_name, itv->num);
diff -r 505edf61b7b2 linux/drivers/media/video/ivtv/ivtv-driver.h
--- a/linux/drivers/media/video/ivtv/ivtv-driver.h	Fri Aug 24 17:10:41 2007 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.h	Fri Aug 24 17:10:45 2007 +0200
@@ -70,6 +70,9 @@
 
 #if 1
 #define HAVE_XC2028 1
+#endif
+#ifdef HAVE_XC2028
+#include "tuner-stub.h"
 #endif
 
 #define IVTV_ENCODER_OFFSET	0x00000000
@@ -712,8 +715,9 @@ struct ivtv {
 	u8 nof_audio_inputs;	/* number of audio inputs */
 	u32 v4l2_cap;		/* V4L2 capabilities of card */
 	u32 hw_flags; 		/* Hardware description of the board */
-	int tunerid;		/* Userspace tuner ID for experimental Xceive tuner support */
-
+	/* Tuner object for experimental userspace Xceive tuner support */
+	struct tuner_object tops;
+	 
 	/* controlling Video decoder function */
 	int (*video_dec_func)(struct ivtv *, unsigned int, void *);
 
diff -r 505edf61b7b2 linux/drivers/media/video/ivtv/ivtv-i2c.c
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.c	Fri Aug 24 17:10:41 2007 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c	Fri Aug 24 17:10:45 2007 +0200
@@ -708,9 +708,9 @@ void ivtv_call_i2c_clients(struct ivtv *
 		return;
 	}
 	i2c_clients_command(&itv->i2c_adap, cmd, arg);
-	if (itv->tunerid) {
+	if (TUNER_CLIENT_ID(itv->tops)) {
 #ifdef HAVE_XC2028
-		tuner_v4l_cmd(itv->tunerid, cmd, arg);
+		itv->tops.tuner_v4l_cmd(TUNER_CLIENT_ID(itv->tops), cmd, arg);
 #endif
 	}
 	if (itv->hw_flags & IVTV_HW_GPIO)





_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to