]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/tuner-xc2028.c
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
[linux-2.6-omap-h63xx.git] / drivers / media / video / tuner-xc2028.c
index d367f205c98a7fac83263ca9a4fc7dcebc29f16b..50cf876f020f40659929821f5c560fb58b5b8cbf 100644 (file)
@@ -395,6 +395,7 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
 {
        struct xc2028_data *priv = fe->tuner_priv;
        int                 i, best_i = -1, best_nr_matches = 0;
+       unsigned int        ign_firm_type_mask = 0;
 
        tuner_dbg("%s called, want type=", __FUNCTION__);
        if (debug) {
@@ -412,16 +413,18 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
 
        if (type & BASE)
                type &= BASE_TYPES;
-       else if (type & SCODE)
+       else if (type & SCODE) {
                type &= SCODE_TYPES;
-       else if (type & DTV_TYPES)
+               ign_firm_type_mask = HAS_IF;
+       } else if (type & DTV_TYPES)
                type &= DTV_TYPES;
        else if (type & STD_SPECIFIC_TYPES)
                type &= STD_SPECIFIC_TYPES;
 
        /* Seek for exact match */
        for (i = 0; i < priv->firm_size; i++) {
-               if ((type == priv->firm[i].type) && (*id == priv->firm[i].id))
+               if ((type == (priv->firm[i].type & ~ign_firm_type_mask)) &&
+                   (*id == priv->firm[i].id))
                        goto found;
        }
 
@@ -430,7 +433,7 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
                v4l2_std_id match_mask;
                int nr_matches;
 
-               if (type != priv->firm[i].type)
+               if (type != (priv->firm[i].type & ~ign_firm_type_mask))
                        continue;
 
                match_mask = *id & priv->firm[i].id;
@@ -660,7 +663,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
                        return rc;
        }
 
-       if (priv->ctrl.mts)
+       if (priv->ctrl.mts && !(type & FM))
                type |= MTS;
 
 retry:
@@ -751,6 +754,9 @@ skip_std_specific:
                goto check_device;
        }
 
+       if (new_fw.type & FM)
+               goto check_device;
+
        /* Load SCODE firmware, if exists */
        tuner_dbg("Trying to load scode %d\n", new_fw.scode_nr);
 
@@ -873,7 +879,9 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
         */
        if (new_mode == T_ANALOG_TV) {
                rc = send_seq(priv, {0x00, 0x00});
-       } else if (!(priv->cur_fw.type & ATSC)) {
+       } else if (priv->cur_fw.type & ATSC) {
+               offset = 1750000;
+       } else {
                offset = 2750000;
                /*
                 * We must adjust the offset by 500kHz in two cases in order
@@ -1138,7 +1146,8 @@ static const struct dvb_tuner_ops xc2028_dvb_tuner_ops = {
 
 };
 
-void *xc2028_attach(struct dvb_frontend *fe, struct xc2028_config *cfg)
+struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
+                                  struct xc2028_config *cfg)
 {
        struct xc2028_data *priv;
        void               *video_dev;