Re: Anubis Electronics "Lifeview"(0x10fd:0x1513) (was: msi digivox mini ii)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 02 Mar 2007 23:06:15 +0100
Pierre Willenbrock <pierre@xxxxxxxxxxxxxxxxxxxx> wrote:

> Michael Krufky schrieb:
> > Pierre Willenbrock wrote:
> >> Hi list,
> >>
> >> I am owner of a "MSI DIGIVOX mini-II". I got it to work using the
> >> attached patch and firmware. The patch and firmware are the result
> >> of analyzing some usb logs from windows.
> >>
> >> The patch breaks all users of tda10046, as i don't understand how
> >> that chip is supposed to work. The same goes for my driver
> >> implementation of the Philips 8275a.
> >>
> >> So this mess needs to be fixed before it can go into the
> >> repository.
> >>
> >> The patch is against a fresh hg checkout from
> >> http://linuxtv.org/hg/v4l-dvb at 2007-02-22 21:00 UTC.
> >>
> >> Regards,
> >>   Pierre
> > 
> > Pierre-
> > 
> > I am very happy to hear that you got this device working...
> > Interestingly enough, we have already created a new tda827x dvb fe
> > module, which might be better for your device...  This new tda827x
> > module has not yet been merged into the master v4l-dvb repository,
> > but it will be soon.  Could you try to use the code located in:
> > 
> > http://linuxtv.org/hg/~hhackmann/v4l-dvb
> > 
> > The tda827x module will be able to detect the difference between
> > the tda8275 and the tda8275a ...  You do not have to fill the
> > callback functions in the config struct -- that is really meant as
> > a hack for some required GPIO handling in the saa7134-dvb driver
> > for input switching.
> > 
> > If you can generate a new patch against the repository above, it
> > would make it _much_ easier to integrate your patch into the
> > sources.   After you get that done, we can work out the tda1004x
> > differences.
> > 
> > You might also want to speak to aett and friedrich, regulars of the
> > #linuxtv irc chat room on irc.freenode.net ... aet is the author of
> > the m920x driver, and friedrich has the same device that you have.
> > They have been working on it, but haven't yet gotten successful
> > results.
> > 
> > Good work!  Hopefully we can clean this up after you generate a new
> > patch using the tda827x module from hhackmann's repository.
> > 
> > Regards,
> > 
> > Mike Krufky
> > 
> 
> Hi Mike and Hartmut,
> 
> this time, the patch does not change tda827x.c at all. I fiddled with
> the PHY2 value in tda1004x.c and found it to be related to the
> IF(there seems to be some factor between the IF and PHY2 introduced
> somewhere else). This leaves some differences in tda1004x.c. I don't
> know what to do with these, so i would be glad to get any hints.


Updated patch. I'm fine with these m920x changes.

-- 
Aapo Tahkola
diff -r 2541388e71f4 linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sat Mar 03 02:56:04 2007 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sat Mar 03 03:01:00 2007 +0200
@@ -37,6 +37,7 @@
 #define USB_VID_ULTIMA_ELECTRONIC		0x05d8
 #define USB_VID_UNIWILL				0x1584
 #define USB_VID_WIDEVIEW			0x14aa
+#define USB_VID_ANUBIS_ELECTRONIC		0x10fd
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD			0xa333
@@ -140,6 +141,7 @@
 #define USB_PID_GENPIX_8PSK_COLD			0x0200
 #define USB_PID_GENPIX_8PSK_WARM			0x0201
 #define USB_PID_SIGMATEK_DVB_110			0x6610
+#define USB_PID_ANUBIS_ELECTRONIC_MSI_DIGI_VOX_MINI_II  0x1513
 
 
 #endif
diff -r 2541388e71f4 linux/drivers/media/dvb/dvb-usb/m920x.c
--- a/linux/drivers/media/dvb/dvb-usb/m920x.c	Sat Mar 03 02:56:04 2007 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.c	Sat Mar 03 03:06:23 2007 +0200
@@ -14,6 +14,8 @@
 #include "mt352.h"
 #include "mt352_priv.h"
 #include "qt1010.h"
+#include "tda1004x.h"
+#include "tda827x.h"
 
 /* debug */
 static int dvb_usb_m920x_debug;
@@ -47,12 +49,16 @@ static inline int m920x_read(struct usb_
 	ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			      request, USB_TYPE_VENDOR | USB_DIR_IN,
 			      value, index, data, size, 2000);
-	if (ret < 0)
-		return ret;
-
-	if (ret != size)
+	if (ret < 0) {
+		printk(KERN_INFO "m920x_read = error: %d\n", ret);
+		return ret;
+	}
+
+	if (ret != size) {
+		deb("m920x_read = no data\n");
 		return -EIO;
-
+	}
+	
 	return 0;
 }
 
@@ -64,6 +70,7 @@ static inline int m920x_write(struct usb
 	ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			      request, USB_TYPE_VENDOR | USB_DIR_OUT,
 			      value, index, NULL, 0, 2000);
+
 	return ret;
 }
 
@@ -317,6 +324,7 @@ static int m920x_firmware_download(struc
 			i += size;
 		}
 		if (i != fw->size) {
+			deb("bad firmware file!\n");
 			ret = -EINVAL;
 			goto done;
 		}
@@ -402,8 +410,65 @@ static int megasky_qt1010_tuner_attach(s
 	return 0;
 }
 
+static struct tda1004x_config digivox_tda10046_config = {
+        /* the demodulator's i2c address */
+	.demod_address = 0x08,
+
+        /* does the "inversion" need inverted? */
+        .invert = 0,
+
+        /* Does the OCLK signal need inverted? */
+        .invert_oclk = 0,
+
+        /* Xtal frequency, 4 or 16MHz*/
+        .xtal_freq = TDA10046_XTAL_16M,
+
+        /* IF frequency */
+        .if_freq = TDA10046_FREQ_045,/*currently doing our own*/
+
+        /* AGC configuration */
+/*        .agc_config = TDA10046_AGC_DIGIVOX,*/
+
+	/* setting of GPIO1 and 3 */
+/*	.gpio_config;*/
+
+	/* slave address and configuration of the tuner */
+/*	.tuner_address;*/
+/*	.tuner_config;*/
+/*	.antenna_switch;*/
+
+	/* if the board uses another I2c Bridge (tda8290), its address */
+/*	.i2c_gate;*/
+
+        /* request firmware for device */
+        /* set this to NULL if the card has a firmware EEPROM */
+        .request_firmware = NULL,/*uses firmware EEPROM - TODO: invalid revision*/
+};
+
+static int digivox_tda10046_frontend_attach(struct dvb_usb_adapter *adap)
+{
+	deb("digivox_tda10046_frontend_attach!\n");
+
+	if ((adap->fe = dvb_attach(tda10046_attach, &digivox_tda10046_config, &adap->dev->i2c_adap)) == NULL)
+		return -EIO;
+
+	return 0;
+}
+
+static struct tda827x_config digivox_tda8275_config = {
+};
+
+static int digivox_tda8275_tuner_attach(struct dvb_usb_adapter *adap)
+{
+	if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap,
+		       &digivox_tda8275_config) == NULL)
+		return -ENODEV;
+	return 0;
+}
+
 /* DVB USB Driver stuff */
 static struct dvb_usb_device_properties megasky_properties;
+static struct dvb_usb_device_properties digivox_properties;
 
 static int m920x_probe(struct usb_interface *intf,
 		       const struct usb_device_id *id)
@@ -413,12 +478,15 @@ static int m920x_probe(struct usb_interf
 	int ret;
 
 	deb("Probed!\n");
-	
+
 	if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0)
 		goto found;
-		
-	return ret;
-	
+
+	if ((ret = dvb_usb_device_init(intf, &digivox_properties, THIS_MODULE, &d)) == 0)
+		goto found;
+
+	return ret;
+
 	found:
 
 	alt = usb_altnum_to_altsetting(intf, 1);
@@ -489,6 +557,55 @@ static struct dvb_usb_device_properties 
 		{   "MSI Mega Sky 580 DVB-T USB2.0",
 			{ &m920x_table[0], NULL },
 			{ NULL },
+		}
+	}
+};
+
+static struct dvb_usb_device_properties digivox_properties = {
+	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+	.usb_ctrl = DEVICE_SPECIFIC,
+	.firmware = "dvb-usb-digivox-02.fw",
+	.download_firmware = m920x_firmware_download,
+
+/*	.rc_interval      = 100,
+	.rc_key_map       = digivox_rc_keys,
+	.rc_key_map_size  = ARRAY_SIZE(digivox_rc_keys),
+	.rc_query         = m920x_rc_query,*/
+
+	.size_of_priv     = sizeof(struct m920x_state),
+
+	.identify_state   = m920x_identify_state,
+	.num_adapters = 1,
+	.adapter = {{
+		.caps = DVB_USB_ADAP_HAS_PID_FILTER |
+		DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+
+		.pid_filter_count = 8,
+		.pid_filter       = m920x_pid_filter,
+		.pid_filter_ctrl  = m920x_pid_filter_ctrl,
+
+		.frontend_attach  = digivox_tda10046_frontend_attach,
+		.tuner_attach     = digivox_tda8275_tuner_attach,
+
+		.stream = {
+			.type = USB_BULK,
+			.count = 8,
+			.endpoint = 0x81,
+			.u = {
+				.bulk = {
+					.buffersize = 0x4000,
+				}
+			}
+		},
+	}},
+	.i2c_algo         = &m920x_i2c_algo,
+
+	.num_device_descs = 1,
+	.devices = {
+		{   "MSI DIGI VOX mini II DVB-T USB2.0",
+			{ &m920x_table[1], NULL },
+			{ NULL },
 		},
 	}
 };
diff -r 2541388e71f4 linux/drivers/media/dvb/frontends/tda1004x.c
--- a/linux/drivers/media/dvb/frontends/tda1004x.c	Sat Mar 03 02:56:04 2007 +0200
+++ b/linux/drivers/media/dvb/frontends/tda1004x.c	Sat Mar 03 03:01:17 2007 +0200
@@ -256,6 +256,17 @@ static int tda10046h_set_bandwidth(struc
 static int tda10046h_set_bandwidth(struct tda1004x_state *state,
 				   fe_bandwidth_t bandwidth)
 {
+#if 1
+	static u8 digivox_vhf[] = { 0x79, 0x16, 0x1c, 0x21, 0xc2 };
+	static u8 digivox_uhf[] = { 0x5b, 0x02, 0xd0, 0x2d, 0x03 };
+
+	tda1004x_write_buf(state, TDA10046H_TIME_WREF1, digivox_uhf,
+			   sizeof(digivox_uhf));
+/*for vhf: 0x09, 0xd9 with if=4.5MHz, uhf: 0x0b, 0xb2 with if=4.75MHz*/
+/*0x0c,0x4f with if=5.0MHz(retrieved by trial and error)*/
+	tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_MSB, 0x0c);
+	tda1004x_write_byteI(state, TDA10046H_FREQ_PHY2_LSB, 0x4f);
+#else
 	static u8 bandwidth_6mhz_53M[] = { 0x7b, 0x2e, 0x11, 0xf0, 0xd2 };
 	static u8 bandwidth_7mhz_53M[] = { 0x6a, 0x02, 0x6a, 0x43, 0x9f };
 	static u8 bandwidth_8mhz_53M[] = { 0x5c, 0x32, 0xc2, 0x96, 0x6d };
@@ -313,6 +324,7 @@ static int tda10046h_set_bandwidth(struc
 	default:
 		return -EINVAL;
 	}
+#endif
 
 	return 0;
 }
@@ -359,8 +371,10 @@ static int tda1004x_check_upload_ok(stru
 	u8 data1, data2;
 	unsigned long timeout;
 
+	dprintk("%s\n", __FUNCTION__);
+
 	if (state->demod_type == TDA1004X_DEMOD_TDA10046) {
-		timeout = jiffies + 2 * HZ;
+		timeout = jiffies + 4 * HZ;
 		while(!(tda1004x_read_byte(state, TDA1004X_STATUS_CD) & 0x20)) {
 			if (time_after(jiffies, timeout)) {
 				printk(KERN_ERR "tda1004x: timeout waiting for DSP ready\n");
@@ -437,6 +451,11 @@ static void tda10046_init_plls(struct dv
 		tda10046_clk53m = 1;
 
 	tda1004x_write_byteI(state, TDA10046H_CONFPLL1, 0xf0);
+#if 1
+	printk(KERN_INFO "tda1004x: setting up plls for 52MHz sampling clock\n");
+	tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x07); // PLL M = 7
+#endif
+#if 0
 	if(tda10046_clk53m) {
 		printk(KERN_INFO "tda1004x: setting up plls for 53MHz sampling clock\n");
 		tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x08); // PLL M = 8
@@ -444,6 +463,7 @@ static void tda10046_init_plls(struct dv
 		printk(KERN_INFO "tda1004x: setting up plls for 48MHz sampling clock\n");
 		tda1004x_write_byteI(state, TDA10046H_CONFPLL2, 0x03); // PLL M = 3
 	}
+#endif
 	if (state->config->xtal_freq == TDA10046_XTAL_4M ) {
 		dprintk("%s: setting up PLLs for a 4 MHz Xtal\n", __FUNCTION__);
 		tda1004x_write_byteI(state, TDA10046H_CONFPLL3, 0); // PLL P = N = 0
@@ -632,6 +652,12 @@ static int tda10046_init(struct dvb_fron
 			return -EIO;
 	}
 
+/*from windows driver*/
+	tda1004x_write_byteI(state, TDA1004X_CONFC4, 0x00);
+	tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE2, 0x2f);
+	tda1004x_write_byteI(state, TDA10046H_GPIO_OUT_SEL, 0xcf);
+/*from windows driver*/
+
 	// tda setup
 	tda1004x_write_mask(state, TDA1004X_CONFC4, 0x20, 0); // disable DSP watchdog timer
 	tda1004x_write_byteI(state, TDA1004X_AUTO, 0x87);    // 100 ppm crystal, select HP stream
@@ -656,9 +682,19 @@ static int tda10046_init(struct dvb_fron
 		tda1004x_write_byteI(state, TDA10046H_AGC_RENORM, 0x08); // Gain Renormalize
 		tda1004x_write_mask(state, TDA10046H_CONF_POLARITY, 0xf0, 0x60);  // set AGC polarities
 		break;
-	}
+	case TDA10046_AGC_DIGIVOX:
+		tda1004x_write_byteI(state, TDA10046H_AGC_CONF, 0x0a); // AGC setup
+		tda1004x_write_byteI(state, TDA10046H_AGC_THR, 0x70); // set AGC threshold
+		tda1004x_write_byteI(state, TDA10046H_CONF_POLARITY, 0x24); // set AGC polarities
+		break;
+	}
+#if 1
+	tda1004x_write_byteI(state, TDA1004X_CONFADC2, 0x34);
+	tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0xa1); 
+#else
 	tda1004x_write_byteI(state, TDA1004X_CONFADC2, 0x38);
 	tda1004x_write_byteI(state, TDA10046H_CONF_TRISTATE1, 0x79); // Turn IF AGC output on
+#endif
 	tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MIN, 0);	  // }
 	tda1004x_write_byteI(state, TDA10046H_AGC_TUN_MAX, 0xff); // } AGC min/max values
 	tda1004x_write_byteI(state, TDA10046H_AGC_IF_MIN, 0);	  // }
diff -r 2541388e71f4 linux/drivers/media/dvb/frontends/tda1004x.h
--- a/linux/drivers/media/dvb/frontends/tda1004x.h	Sat Mar 03 02:56:04 2007 +0200
+++ b/linux/drivers/media/dvb/frontends/tda1004x.h	Sat Mar 03 03:01:17 2007 +0200
@@ -36,6 +36,7 @@ enum tda10046_agc {
 	TDA10046_AGC_IFO_AUTO_NEG,	/* IF AGC only, automatic, negtive */
 	TDA10046_AGC_IFO_AUTO_POS,	/* IF AGC only, automatic, positive */
 	TDA10046_AGC_TDA827X,		/* IF AGC only, special setup for tda827x */
+	TDA10046_AGC_DIGIVOX,           /* setup for msi digivox mini ii*/
 };
 
 /* Many (hybrid) boards use GPIO 1 and 3
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux