]> Pileus Git - ~andy/linux/blobdiff - drivers/media/video/tda8290.c
[PATCH] fix black/white-only svideo input in vpx3220 decoder
[~andy/linux] / drivers / media / video / tda8290.c
index f59d4601cc6311118f10774445173f7ec69d6c29..c65f0c7680a2606578a4024a65a3ba784a539bb2 100644 (file)
@@ -1,5 +1,4 @@
 /*
- * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $
  *
  * i2c tv tuner chip device driver
  * controls the philips tda8290+75 tuner chip combo.
@@ -9,6 +8,9 @@
 #include <linux/delay.h>
 #include <media/tuner.h>
 
+#define I2C_ADDR_TDA8290        0x4b
+#define I2C_ADDR_TDA8275        0x61
+
 /* ---------------------------------------------------------------------- */
 
 struct freq_entry {
@@ -75,10 +77,12 @@ static unsigned char i2c_init_tda8275[14] =         { 0x00, 0x00, 0x00, 0x00,
 static unsigned char i2c_set_VS[2] =           { 0x30, 0x6F };
 static unsigned char i2c_set_GP01_CF[2] =      { 0x20, 0x0B };
 static unsigned char i2c_tda8290_reset[2] =    { 0x00, 0x00 };
+static unsigned char i2c_tda8290_standby[2] =  { 0x00, 0x02 };
 static unsigned char i2c_gainset_off[2] =      { 0x28, 0x14 };
 static unsigned char i2c_gainset_on[2] =       { 0x28, 0x54 };
 static unsigned char i2c_agc3_00[2] =          { 0x80, 0x00 };
 static unsigned char i2c_agc2_BF[2] =          { 0x60, 0xBF };
+static unsigned char i2c_cb1_D0[2] =           { 0x30, 0xD0 };
 static unsigned char i2c_cb1_D2[2] =           { 0x30, 0xD2 };
 static unsigned char i2c_cb1_56[2] =           { 0x30, 0x56 };
 static unsigned char i2c_cb1_52[2] =           { 0x30, 0x52 };
@@ -117,6 +121,13 @@ static struct i2c_msg i2c_msg_epilog[] = {
        { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on },
 };
 
+static struct i2c_msg i2c_msg_standby[] = {
+       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge },
+       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D0), i2c_cb1_D0 },
+       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge },
+       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_standby), i2c_tda8290_standby },
+};
+
 static int tda8290_tune(struct i2c_client *c)
 {
        struct tuner *t = i2c_get_clientdata(c);
@@ -136,15 +147,12 @@ 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 freq;
        u32 N;
 
        if (t->mode == V4L2_TUNER_RADIO)
-               freq = t->freq / 1000;
-       else
-               freq = t->freq;
+               freq = freq / 1000;
 
        N = (((freq<<3)+ifc)&0x3fffc);
 
@@ -187,14 +195,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);
 }
 
@@ -208,6 +216,11 @@ static int has_signal(struct i2c_client *c)
        return (afc & 0x80)? 65535:0;
 }
 
+static void standby(struct i2c_client *c)
+{
+       i2c_transfer(c->adapter, i2c_msg_standby, ARRAY_SIZE(i2c_msg_standby));
+}
+
 int tda8290_init(struct i2c_client *c)
 {
        struct tuner *t = i2c_get_clientdata(c);
@@ -217,6 +230,7 @@ int tda8290_init(struct i2c_client *c)
        t->tv_freq    = set_tv_freq;
        t->radio_freq = set_radio_freq;
        t->has_signal = has_signal;
+       t->standby = standby;
 
        i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge));
        i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init));