Re: Re: [PATCH] Tuner calibration for some Nova-T devices

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

 



El Miércoles, 20 de Diciembre de 2006, Patrick Boettcher escribió:
> Hi Olivier,
>
> On Fri, 15 Dec 2006, treza@xxxxxxxx wrote:
> > Here is a patch for Hauppage Nova-T-Stick and Nova-T-500 users.
> > It sets the MT2060 IF1 frequency according to the
> > calibration values stored in the EEPROM.
> >
> > It is supposed to enhance the signal quality, but, hey,
> > there is no guarantee.
> > Feedbacks would be much appreciated, to know whether it
> > deserves being applied.
> >
> > For those who have a MT2060 based device, very low signal
> > levels and feel _very_ lucky,
> > they can also activate MT2060_SPURCHECK in the mt2060_priv.h
> > file. At worst case it will change nothing.
> >
> > Patrick, the (dib0700_state.mt2060_if1 field in dib0700.h
> > becomes useless with this patch, is it right or shall I move
> > the code to the "frontend_attach" functions ?)
> >
> > Signed-off-by: Olivier DANET <odanet@xxxxxxxxxxxx>
>
> Thank you very much for taking a look at that.
>
> I inserted the mt2060_if1-field in the state, because I thought about
> adding a complete eeprom-parser...
>
> I'm wondering also if the eeprom-address for the if1-offset is always the
> same for each design. How did you find 0x48 and 0x49? Normally the
> addresses are dynamic, depending on the strings before (afaik).
>
> Furthermore the bristol-card has two mt2060-if1-offsets - one for each
> path.
>
> The best would be, but it will take some time, to write the eeprom-parser
> to always find the correct offset....
>
> Would you have the time to do have a look at that?
>
> thanks again,
> Patrick.
>

In the NOVA-T 500 the if1 offsets are the two last valid values of the epprom. 
The rest are filled with 0xff, except byte 127. This patch work for me.

Jose Alberto



diff -r b238e85abb88 linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Wed Feb 28 01:06:50 2007 -0200
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Wed Feb 28 21:39:24 2007 +0100
@@ -88,12 +88,37 @@ static int bristol_frontend_attach(struc
 		(10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
 }
 
+static int eeprom_read(struct i2c_adapter *adap, u8 adrs, u8 *pval)
+{
+        struct i2c_msg msg[2] = {
+                { .addr = 0x50, .flags = 0,        .buf = &adrs, .len = 1 },
+                { .addr = 0x50, .flags = I2C_M_RD, .buf = pval,  .len = 1 },
+        };
+        if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;
+        return 0;
+}
+
 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
 {
-	struct dib0700_state *st = adap->dev->priv;
+	struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
 	struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
+	int if1=1220;
+	s8 a;
+	int i;
+	if (adap->dev->udev->descriptor.idVendor  == USB_VID_HAUPPAUGE &&
+		adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_500_2) {
+		i = 126;
+		do {
+			eeprom_read(prim_i2c, i, &a);
+			i--;
+		} while ((u8)a == 0xff);
+		if (adap->id == 0)
+			eeprom_read(prim_i2c, i, &a);
+		if1 = 1220 + a;
+ 
+	}
 	return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id],
-		st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
+		if1) == NULL ? -ENODEV : 0;
 }
 
 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
_______________________________________________
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