DPosh m9206 USB DVB-T stick with MT2060

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

 



     Some time ago I had a brief correspondence on here with Antii
about adding support for the MT2060 tuner to the DPosh driver( there's
recently been a load of these on sale in several places for 10 GBP
ish). I had a go at hacking something together, which although
definitely poorly written, did appear to work. However, my signal at
home is currently just not quite good enough to test it properly, so I
let the matter rest for the moment.
     Then I was contacted by a guy who'd bought the same stick & been
following my posts - he tried it & is definitely receiving TV
stations(with plenty of room for improvement), so it seems that its
worth going further with it.
      I've attached a diff of m920x.c -  I'd like some help with a)the
correct mechanism for detecting which tuner chip is present (i.e.
QT1010/MT2060) , b) what to tweak to improve output quality & c)
whether my whole approach is wrong or what?- I have no experience of
driver programming or C, though I know a little about C++ app
development. Hugh (the guy with another DPosh stick) will be able to
test any changes as will I (if I can improve my Freeview signal).
Regards Andrew Websdale
--- ../v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/m920x.c	2008-09-24 23:36:47.000000000 +0100
+++ linux/drivers/media/dvb/dvb-usb/m920x.c	2008-07-04 23:17:19.000000000 +0100
@@ -10,7 +10,7 @@
  */
 
 #include "m920x.h"
-
+#include "mt2060.h"
 #include "mt352.h"
 #include "mt352_priv.h"
 #include "qt1010.h"
@@ -20,6 +20,7 @@
 
 /* debug */
 static int dvb_usb_m920x_debug;
+static bool bdposh_warm = false;
 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
 
@@ -477,6 +478,10 @@
 	.i2c_address = 0x62
 };
 
+static struct mt2060_config m920x_mt2060_config = {
+	.i2c_address = 0x60          
+};
+
 /* Callbacks for DVB USB */
 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap)
 {
@@ -544,6 +549,19 @@
 	return 0;
 }
 
+static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap)
+{
+	u16 if1;
+	
+	deb("%s\n",__func__);
+	
+	if1 = 1220;
+	
+	if (dvb_attach(mt2060_attach, adap->fe, &adap->dev->i2c_adap, &m920x_mt2060_config, if1) == NULL)
+		return -ENODEV;
+
+	return 0;
+}
 /* device-specific initialization */
 static struct m920x_inits megasky_rc_init [] = {
 	{ M9206_RC_INIT2, 0xa8 },
@@ -604,7 +622,8 @@
 static struct dvb_usb_device_properties megasky_properties;
 static struct dvb_usb_device_properties digivox_mini_ii_properties;
 static struct dvb_usb_device_properties tvwalkertwin_properties;
-static struct dvb_usb_device_properties dposh_properties;
+static struct dvb_usb_device_properties dposh_properties;//qt1010
+static struct dvb_usb_device_properties dposh_mt_properties;//for mt2060
 
 static int m920x_probe(struct usb_interface *intf,
 		       const struct usb_device_id *id)
@@ -642,13 +661,25 @@
 			rc_init_seq = tvwalkertwin_rc_init;
 			goto found;
 		}
-
-		ret = dvb_usb_device_init(intf, &dposh_properties,
+		
+		ret = dvb_usb_device_init(intf, &dposh_mt_properties,
 					  THIS_MODULE, &d, adapter_nr);
 		if (ret == 0) {
 			/* Remote controller not supported yet. */
+			bdposh_warm = true;			
 			goto found;
 		}
+		
+		if (bdposh_warm != true){ 		
+			ret = dvb_usb_device_init(intf, &dposh_properties,
+					  THIS_MODULE, &d, adapter_nr);
+			if (ret == 0) {
+			/* Remote controller not supported yet. */
+				goto found;
+			}
+		}
+
+
 
 		return ret;
 	} else {
@@ -886,14 +917,59 @@
 
 	.num_device_descs = 1,
 	.devices = {
-		 {   .name = "Dposh DVB-T USB2.0",
+		 {   .name = "Dposh(qt1010 tuner) DVB-T USB2.0",
+		     .cold_ids = { &m920x_table[4], NULL },
+		     .warm_ids = { &m920x_table[5], NULL },
+		 },
+	 }
+};
+
+
+static struct dvb_usb_device_properties dposh_mt_properties = {
+	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+	.usb_ctrl = DEVICE_SPECIFIC,
+	.firmware = "dvb-usb-dposh-01.fw",
+	.download_firmware = m920x_firmware_download,
+
+	.size_of_priv     = sizeof(struct m920x_state),
+
+	.identify_state   = m920x_identify_state,
+	.num_adapters = 1,
+	.adapter = {{
+
+		.frontend_attach  = m920x_mt352_frontend_attach,
+		.tuner_attach     = m920x_mt2060_tuner_attach,
+
+		.stream = {
+			.type = USB_BULK,
+			.count = 7,
+			.endpoint = 0x81,
+			.u = {
+				 .bulk = {
+					 .buffersize = 512,
+				 }
+			}
+		},
+	}},
+	.i2c_algo         = &m920x_i2c_algo,
+
+	.num_device_descs = 1,
+	.devices = {
+		 {   .name = "Dposh(mt2060 tuner) DVB-T USB2.0",
 		     .cold_ids = { &m920x_table[4], NULL },
 		     .warm_ids = { &m920x_table[5], NULL },
 		 },
 	 }
+
+
 };
 
+
 static struct usb_driver m920x_driver = {
+#if LINUX_VERSION_CODE <=  KERNEL_VERSION(2,6,15)
+	.owner		= THIS_MODULE,
+#endif
 	.name		= "dvb_usb_m920x",
 	.probe		= m920x_probe,
 	.disconnect	= dvb_usb_device_exit,
_______________________________________________
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