]> err.no Git - linux-2.6/blobdiff - drivers/media/video/tda8290.c
merge 2.6.13-rc4 with ACPI's to-linus tree
[linux-2.6] / drivers / media / video / tda8290.c
index b27cc348d95ce40f3076150868c25e14415c220d..a8b6a8df5109d86eb8bd705c801bd0b17ca69e7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $
+ * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $
  *
  * i2c tv tuner chip device driver
  * controls the philips tda8290+75 tuner chip combo.
@@ -69,7 +69,7 @@ static __u8 get_freq_entry( struct freq_entry* table, __u16 freq)
 static unsigned char i2c_enable_bridge[2] =    { 0x21, 0xC0 };
 static unsigned char i2c_disable_bridge[2] =   { 0x21, 0x80 };
 static unsigned char i2c_init_tda8275[14] =    { 0x00, 0x00, 0x00, 0x00,
-                                                 0x7C, 0x04, 0xA3, 0x3F,
+                                                 0xfC, 0x04, 0xA3, 0x3F,
                                                  0x2A, 0x04, 0xFF, 0x00,
                                                  0x00, 0x40 };
 static unsigned char i2c_set_VS[2] =           { 0x30, 0x6F };
@@ -136,18 +136,23 @@ static int tda8290_tune(struct i2c_client *c)
        return 0;
 }
 
-static void set_frequency(struct tuner *t, u16 ifc)
+static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq)
 {
-       u32 N = (((t->freq<<3)+ifc)&0x3fffc);
+       u32 N;
 
-       N = N >> get_freq_entry(div_table, t->freq);
+       if (t->mode == V4L2_TUNER_RADIO)
+               freq = freq / 1000;
+
+       N = (((freq<<3)+ifc)&0x3fffc);
+
+       N = N >> get_freq_entry(div_table, freq);
        t->i2c_set_freq[0] = 0;
        t->i2c_set_freq[1] = (unsigned char)(N>>8);
        t->i2c_set_freq[2] = (unsigned char) N;
        t->i2c_set_freq[3] = 0x40;
        t->i2c_set_freq[4] = 0x52;
-       t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq);
-       t->i2c_set_freq[6] = get_freq_entry(agc_table,  t->freq);
+       t->i2c_set_freq[5] = get_freq_entry(band_table, freq);
+       t->i2c_set_freq[6] = get_freq_entry(agc_table,  freq);
        t->i2c_set_freq[7] = 0x8f;
 }
 
@@ -179,14 +184,14 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
        struct tuner *t = i2c_get_clientdata(c);
 
        set_audio(t);
-       set_frequency(t, 864);
+       set_frequency(t, 864, freq);
        tda8290_tune(c);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
 {
        struct tuner *t = i2c_get_clientdata(c);
-       set_frequency(t, 704);
+       set_frequency(t, 704, freq);
        tda8290_tune(c);
 }