Merge x86-64 update from Andi
[cascardo/linux.git] / drivers / media / video / tuner-core.c
index b9f1acf..e58abdf 100644 (file)
@@ -222,9 +222,9 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
 {
        struct tuner *t = i2c_get_clientdata(c);
 
-       if ((tun_setup->addr == ADDR_UNSET &&
+       if ( t->type == UNSET && ((tun_setup->addr == ADDR_UNSET &&
                (t->mode_mask & tun_setup->mode_mask)) ||
-               tun_setup->addr == c->addr) {
+               tun_setup->addr == c->addr)) {
                        set_type(c, tun_setup->type, tun_setup->mode_mask);
        }
 }
@@ -251,7 +251,7 @@ static inline int check_mode(struct tuner *t, char *cmd)
 
 static char pal[] = "-";
 module_param_string(pal, pal, sizeof(pal), 0644);
-static char secam[] = "-";
+static char secam[] = "--";
 module_param_string(secam, secam, sizeof(secam), 0644);
 
 /* get more precise norm info from insmod option */
@@ -307,8 +307,13 @@ static int tuner_fixup_std(struct tuner *t)
                        break;
                case 'l':
                case 'L':
-                       tuner_dbg ("insmod fixup: SECAM => SECAM-L\n");
-                       t->std = V4L2_STD_SECAM_L;
+                       if ((secam[1]=='C')||(secam[1]=='c')) {
+                               tuner_dbg ("insmod fixup: SECAM => SECAM-L'\n");
+                               t->std = V4L2_STD_SECAM_LC;
+                       } else {
+                               tuner_dbg ("insmod fixup: SECAM => SECAM-L\n");
+                               t->std = V4L2_STD_SECAM_L;
+                       }
                        break;
                case '-':
                        /* default parameter, do nothing */
@@ -348,23 +353,33 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
        t->audmode = V4L2_TUNER_MODE_STEREO;
        t->mode_mask = T_UNINITIALIZED;
 
-
-       tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
-
        if (show_i2c) {
                unsigned char buffer[16];
                int i,rc;
 
                memset(buffer, 0, sizeof(buffer));
                rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
-               printk("tuner-%04x I2C RECV = ",addr);
+               tuner_info("I2C RECV = ");
                for (i=0;i<rc;i++)
                        printk("%02x ",buffer[i]);
                printk("\n");
        }
        /* TEA5767 autodetection code - only for addr = 0xc0 */
        if (!no_autodetect) {
-               if (addr == 0x60) {
+               switch (addr) {
+               case 0x42:
+               case 0x43:
+               case 0x4a:
+               case 0x4b:
+                       /* If chip is not tda8290, don't register.
+                          since it can be tda9887*/
+                       if (tda8290_probe(&t->i2c) != 0) {
+                               tuner_dbg("chip at addr %x is not a tda8290\n", addr);
+                               kfree(t);
+                               return 0;
+                       }
+                       break;
+               case 0x60:
                        if (tea5767_autodetection(&t->i2c) != EINVAL) {
                                t->type = TUNER_TEA5767;
                                t->mode_mask = T_RADIO;
@@ -372,10 +387,9 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
                                t->freq = 87.5 * 16; /* Sets freq to FM range */
                                default_mode_mask &= ~T_RADIO;
 
-                               i2c_attach_client (&t->i2c);
-                               set_type(&t->i2c,t->type, t->mode_mask);
-                               return 0;
+                               goto register_client;
                        }
+                       break;
                }
        }
 
@@ -388,6 +402,8 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
        }
 
        /* Should be just before return */
+register_client:
+       tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
        i2c_attach_client (&t->i2c);
        set_type (&t->i2c,t->type, t->mode_mask);
        return 0;
@@ -486,8 +502,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        break;
                }
        case AUDC_CONFIG_PINNACLE:
-               if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
-                       return 0;
                switch (*iarg) {
                case 2:
                        tuner_dbg("pinnacle pal\n");