Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c52344fdc49665a4eeef24236750b49637d6982f
Commit:     c52344fdc49665a4eeef24236750b49637d6982f
Parent:     a162abb06bda3f38750a208e85e27f419798aa79
Author:     Olivier DANET <odanet at caramail.com>
AuthorDate: Fri Jan 25 06:50:07 2008 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:05:19 2008 -0200

    V4L/DVB (7072): sets the MT2060 IF1 frequency according to EEPROM
    
    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.
    
    Signed-off-by: Olivier DANET <odanet at caramail.com>
    Signed-off-by: Patrick Boettcher <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/dvb-usb/dib0700_devices.c |   32 ++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c 
b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 36d29f9..ffecb6e 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -94,12 +94,28 @@ static int bristol_frontend_attach(struct dvb_usb_adapter 
*adap)
                (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == 
NULL ? -ENODEV : 0;
 }
 
+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);
-       return dvb_attach(mt2060_attach,adap->fe, tun_i2c, 
&bristol_mt2060_config[adap->id],
-               st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
+       s8 a;
+       int if1=1220;
+       if (adap->dev->udev->descriptor.idVendor  == USB_VID_HAUPPAUGE &&
+               adap->dev->udev->descriptor.idProduct == 
USB_PID_HAUPPAUGE_NOVA_T_500_2) {
+               if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
+       }
+       return dvb_attach(mt2060_attach,adap->fe, 
tun_i2c,&bristol_mt2060_config[adap->id],
+               if1) == NULL ? -ENODEV : 0;
 }
 
 /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */
@@ -628,16 +644,22 @@ static struct mt2060_config stk7700p_mt2060_config = {
 
 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
 {
+       struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;
        struct dib0700_state *st = adap->dev->priv;
        struct i2c_adapter *tun_i2c;
-
+       s8 a;
+       int if1=1220;
+       if (adap->dev->udev->descriptor.idVendor  == USB_VID_HAUPPAUGE &&
+               adap->dev->udev->descriptor.idProduct == 
USB_PID_HAUPPAUGE_NOVA_T_STICK) {
+               if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
+       }
        if (st->is_dib7000pc)
                tun_i2c = dib7000p_get_i2c_master(adap->fe, 
DIBX000_I2C_INTERFACE_TUNER, 1);
        else
                tun_i2c = dib7000m_get_i2c_master(adap->fe, 
DIBX000_I2C_INTERFACE_TUNER, 1);
 
        return dvb_attach(mt2060_attach, adap->fe, tun_i2c, 
&stk7700p_mt2060_config,
-               st->mt2060_if1[0]) == NULL ? -ENODEV : 0;
+               if1) == NULL ? -ENODEV : 0;
 }
 
 /* DIB7070 generic */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to