]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
V4L/DVB (7651): tuner-xc2028: Several fixes to SCODE
authorMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 21 Apr 2008 09:58:48 +0000 (06:58 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:09:44 +0000 (14:09 -0300)
This patch fixes several issues on SCODE:

1) The extracting tool weren't generating the proper tags for SCODE. This
   has almost no effect, since those tags shouldn't be used;

2) DIBCOM52 were using a wrong IF. It should be 5200, instead of 5700;

3) seek_firmware were wanting an exact match for firmware type. This is
   wrong. As result, no SCODE firmware were loaded;

4) A few files were including the wrong file for seeking demod firmwares;

5) XC3028_FE_DEFAULT can be used, if user doesn't want to load a firmware.
   However, this weren't documentated. This feature require more testing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Documentation/video4linux/extract_xc3028.pl
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/tuner-xc2028-types.h
drivers/media/video/tuner-xc2028.c
drivers/media/video/tuner-xc2028.h

index cced8ac5c543b462c7cbc329c5ddac921bb05774..2cb816047fc128bb67323c00ffcd982fe5d174fc 100644 (file)
@@ -686,11 +686,11 @@ sub main_firmware($$$$)
        write_hunk(812664, 192);
 
        #
-       # Firmware 58, type: SCODE FW  HAS IF (0x60000000), IF = 4.50 MHz id: NTSC/M Jp (0000000000002000), size: 192
+       # Firmware 58, type: SCODE FW  MTS LCD NOGD MONO IF HAS IF (0x6002b004), IF = 4.50 MHz id: NTSC PAL/M PAL/N (000000000000b700), size: 192
        #
 
-       write_le32(0x60000000);                 # Type
-       write_le64(0x00000000, 0x00002000);     # ID
+       write_le32(0x6002b004);                 # Type
+       write_le64(0x00000000, 0x0000b700);     # ID
        write_le16(4500);                       # IF
        write_le32(192);                        # Size
        write_hunk(807672, 192);
@@ -706,10 +706,10 @@ sub main_firmware($$$$)
        write_hunk(807864, 192);
 
        #
-       # Firmware 60, type: SCODE FW  DTV78 ZARLINK456 HAS IF (0x62000100), IF = 4.76 MHz id: (0000000000000000), size: 192
+       # Firmware 60, type: SCODE FW  DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 HAS IF (0x620003e0), IF = 4.76 MHz id: (0000000000000000), size: 192
        #
 
-       write_le32(0x62000100);                 # Type
+       write_le32(0x620003e0);                 # Type
        write_le64(0x00000000, 0x00000000);     # ID
        write_le16(4760);                       # IF
        write_le32(192);                        # Size
@@ -726,30 +726,30 @@ sub main_firmware($$$$)
        write_hunk(811512, 192);
 
        #
-       # Firmware 62, type: SCODE FW  DTV7 ZARLINK456 HAS IF (0x62000080), IF = 5.26 MHz id: (0000000000000000), size: 192
+       # Firmware 62, type: SCODE FW  HAS IF (0x60000000), IF = 5.26 MHz id: (0000000000000000), size: 192
        #
 
-       write_le32(0x62000080);                 # Type
+       write_le32(0x60000000);                 # Type
        write_le64(0x00000000, 0x00000000);     # ID
        write_le16(5260);                       # IF
        write_le32(192);                        # Size
        write_hunk(810552, 192);
 
        #
-       # Firmware 63, type: SCODE FW  MONO HAS IF (0x60008000), IF = 5.32 MHz id: PAL/BG NICAM/B (0000000800000007), size: 192
+       # Firmware 63, type: SCODE FW  MONO HAS IF (0x60008000), IF = 5.32 MHz id: PAL/BG A2 NICAM (0000000f00000007), size: 192
        #
 
        write_le32(0x60008000);                 # Type
-       write_le64(0x00000008, 0x00000007);     # ID
+       write_le64(0x0000000f, 0x00000007);     # ID
        write_le16(5320);                       # IF
        write_le32(192);                        # Size
        write_hunk(810744, 192);
 
        #
-       # Firmware 64, type: SCODE FW  DTV8 CHINA HAS IF (0x64000200), IF = 5.40 MHz id: (0000000000000000), size: 192
+       # Firmware 64, type: SCODE FW  DTV7 DTV78 DTV8 DIBCOM52 CHINA HAS IF (0x65000380), IF = 5.40 MHz id: (0000000000000000), size: 192
        #
 
-       write_le32(0x64000200);                 # Type
+       write_le32(0x65000380);                 # Type
        write_le64(0x00000000, 0x00000000);     # ID
        write_le16(5400);                       # IF
        write_le32(192);                        # Size
@@ -766,50 +766,50 @@ sub main_firmware($$$$)
        write_hunk(809592, 192);
 
        #
-       # Firmware 66, type: SCODE FW  HAS IF (0x60000000), IF = 5.64 MHz id: PAL/BG A2/B (0000000200000007), size: 192
+       # Firmware 66, type: SCODE FW  HAS IF (0x60000000), IF = 5.64 MHz id: PAL/BG A2 (0000000300000007), size: 192
        #
 
        write_le32(0x60000000);                 # Type
-       write_le64(0x00000002, 0x00000007);     # ID
+       write_le64(0x00000003, 0x00000007);     # ID
        write_le16(5640);                       # IF
        write_le32(192);                        # Size
        write_hunk(808440, 192);
 
        #
-       # Firmware 67, type: SCODE FW  HAS IF (0x60000000), IF = 5.74 MHz id: PAL/BG NICAM/B (0000000800000007), size: 192
+       # Firmware 67, type: SCODE FW  HAS IF (0x60000000), IF = 5.74 MHz id: PAL/BG NICAM (0000000c00000007), size: 192
        #
 
        write_le32(0x60000000);                 # Type
-       write_le64(0x00000008, 0x00000007);     # ID
+       write_le64(0x0000000c, 0x00000007);     # ID
        write_le16(5740);                       # IF
        write_le32(192);                        # Size
        write_hunk(808632, 192);
 
        #
-       # Firmware 68, type: SCODE FW  DTV7 DIBCOM52 HAS IF (0x61000080), IF = 5.90 MHz id: (0000000000000000), size: 192
+       # Firmware 68, type: SCODE FW  HAS IF (0x60000000), IF = 5.90 MHz id: (0000000000000000), size: 192
        #
 
-       write_le32(0x61000080);                 # Type
+       write_le32(0x60000000);                 # Type
        write_le64(0x00000000, 0x00000000);     # ID
        write_le16(5900);                       # IF
        write_le32(192);                        # Size
        write_hunk(810360, 192);
 
        #
-       # Firmware 69, type: SCODE FW  MONO HAS IF (0x60008000), IF = 6.00 MHz id: PAL/I (0000000000000010), size: 192
+       # Firmware 69, type: SCODE FW  MONO HAS IF (0x60008000), IF = 6.00 MHz id: PAL/DK PAL/I SECAM/K3 SECAM/L SECAM/Lc NICAM (0000000c04c000f0), size: 192
        #
 
        write_le32(0x60008000);                 # Type
-       write_le64(0x00000000, 0x00000010);     # ID
+       write_le64(0x0000000c, 0x04c000f0);     # ID
        write_le16(6000);                       # IF
        write_le32(192);                        # Size
        write_hunk(808824, 192);
 
        #
-       # Firmware 70, type: SCODE FW  DTV6 QAM F6MHZ HAS IF (0x68000060), IF = 6.20 MHz id: (0000000000000000), size: 192
+       # Firmware 70, type: SCODE FW  DTV6 QAM ATSC LG60 F6MHZ HAS IF (0x68050060), IF = 6.20 MHz id: (0000000000000000), size: 192
        #
 
-       write_le32(0x68000060);                 # Type
+       write_le32(0x68050060);                 # Type
        write_le64(0x00000000, 0x00000000);     # ID
        write_le16(6200);                       # IF
        write_le32(192);                        # Size
@@ -846,11 +846,11 @@ sub main_firmware($$$$)
        write_hunk(809208, 192);
 
        #
-       # Firmware 74, type: SCODE FW  MONO HAS IF (0x60008000), IF = 6.50 MHz id: SECAM/K3 (0000000004000000), size: 192
+       # Firmware 74, type: SCODE FW  MONO HAS IF (0x60008000), IF = 6.50 MHz id: PAL/DK SECAM/K3 SECAM/L NICAM (0000000c044000e0), size: 192
        #
 
        write_le32(0x60008000);                 # Type
-       write_le64(0x00000000, 0x04000000);     # ID
+       write_le64(0x0000000c, 0x044000e0);     # ID
        write_le16(6500);                       # IF
        write_le32(192);                        # Size
        write_hunk(811128, 192);
index c4b00660c65fcc2b3526125d76fe123b167a76b1..720fcd1c3c1d75caad387932f9bc56329c42ff47 100644 (file)
@@ -33,7 +33,6 @@
 #include "mt352_priv.h"
 #include "zl10353.h"
 #include "tuner-xc2028.h"
-#include "tuner-xc2028-types.h"
 #include "tuner-simple.h"
 
 /* debug */
@@ -521,7 +520,7 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
        static struct xc2028_ctrl ctl = {
                .fname       = "xc3028-dvico-au-01.fw",
                .max_len     = 64,
-               .scode_table = ZARLINK456,
+               .scode_table = XC3028_FE_ZARLINK456,
        };
 
        fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
index a1086c8b66eeaede79c3ed2cb9d073c2ea2569a0..1b9a85e43d443f56b4d7923eb972b9b4361c2100 100644 (file)
@@ -39,7 +39,6 @@
 #include "tda10048.h"
 #include "dvb-pll.h"
 #include "tuner-xc2028.h"
-#include "tuner-xc2028-types.h"
 #include "tuner-simple.h"
 
 static unsigned int debug;
@@ -320,7 +319,7 @@ static int dvb_register(struct cx23885_tsport *port)
                        static struct xc2028_ctrl ctl = {
                                .fname       = "xc3028-v27.fw",
                                .max_len     = 64,
-                               .scode_table = OREN538,
+                               .scode_table = XC3028_FE_OREN538,
                        };
 
                        fe = dvb_attach(xc2028_attach,
index fda7334d934b64a00797fad99e20fc207e0cf89f..f1251b844e0823c48128b27fd03b437be611e578 100644 (file)
@@ -45,7 +45,6 @@
 #include "nxt200x.h"
 #include "cx24123.h"
 #include "isl6421.h"
-#include "tuner-xc2028-types.h"
 #include "tuner-simple.h"
 #include "tda9887.h"
 
@@ -813,7 +812,7 @@ static int dvb_register(struct cx8802_dev *dev)
                        static struct xc2028_ctrl ctl = {
                                .fname       = "xc3028-v27.fw",
                                .max_len     = 64,
-                               .scode_table = OREN538,
+                               .scode_table = XC3028_FE_OREN538,
                        };
 
                        fe = dvb_attach(xc2028_attach,
index d0057fbf0ec72e9569a92b30121961663e371e3a..17633c316c282dad321c2b405b26bba463467a36 100644 (file)
@@ -1,6 +1,9 @@
 /* tuner-xc2028_types
  *
- * Copyright (c) 2007 Mauro Carvalho Chehab (mchehab@infradead.org)
+ * This file includes internal tipes to be used inside tuner-xc2028.
+ * Shouldn't be included outside tuner-xc2028
+ *
+ * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org)
  * This code is placed under the terms of the GNU General Public License v2
  */
 
 /* This flag identifies that the scode table has a new format */
 #define HAS_IF         (1 << 30)
 
-#define SCODE_TYPES    (MTS|DTV6|QAM|DTV7|DTV78|DTV8|LCD|NOGD|MONO|ATSC|IF| \
-                        LG60|ATI638|OREN538|OREN36|TOYOTA388|TOYOTA794|     \
-                        DIBCOM52|ZARLINK456|CHINA|F6MHZ|SCODE)
+#define SCODE_TYPES SCODE
+
 
-/* Newer types to be moved to videodev2.h */
+/* Newer types not defined on videodev2.h.
+   The original idea were to move all those types to videodev2.h, but
+   it seemed overkill, since, with the exception of SECAM/K3, the other
+   types seem to be autodetected.
+   It is not clear where secam/k3 is used, nor we have a feedback of this
+   working or being autodetected by the standard secam firmware.
+ */
 
 #define V4L2_STD_SECAM_K3      (0x04000000)
 
index 9dd688ec3cff4051d89d33d3af5a4a5c4e84630d..0e580bcd0e09d27864f9f8873a5aa8a580cd30a8 100644 (file)
@@ -1,6 +1,6 @@
 /* tuner-xc2028
  *
- * Copyright (c) 2007 Mauro Carvalho Chehab (mchehab@infradead.org)
+ * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org)
  *
  * Copyright (c) 2007 Michel Ludwig (michel.ludwig@gmail.com)
  *       - frontend interface
@@ -404,7 +404,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;
+       unsigned int        type_mask = 0;
 
        tuner_dbg("%s called, want type=", __func__);
        if (debug) {
@@ -421,18 +421,23 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
                *id = V4L2_STD_PAL;
 
        if (type & BASE)
-               type &= BASE_TYPES;
+               type_mask = BASE_TYPES;
        else if (type & SCODE) {
                type &= SCODE_TYPES;
-               ign_firm_type_mask = HAS_IF;
+               type_mask = SCODE_TYPES & ~HAS_IF;
        } else if (type & DTV_TYPES)
-               type &= DTV_TYPES;
+               type_mask = DTV_TYPES;
        else if (type & STD_SPECIFIC_TYPES)
-               type &= STD_SPECIFIC_TYPES;
+               type_mask = STD_SPECIFIC_TYPES;
+
+       type &= type_mask;
+
+       if (!type & SCODE)
+               type_mask = ~0;
 
        /* Seek for exact match */
        for (i = 0; i < priv->firm_size; i++) {
-               if ((type == (priv->firm[i].type & ~ign_firm_type_mask)) &&
+               if ((type == (priv->firm[i].type & type_mask)) &&
                    (*id == priv->firm[i].id))
                        goto found;
        }
@@ -442,7 +447,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 & ~ign_firm_type_mask))
+               if (type != (priv->firm[i].type & type_mask))
                        continue;
 
                match_mask = *id & priv->firm[i].id;
index 612e490634d03ac741a5a0b85faa30bbec295efd..fc2f132a5541279e9c1b6089535dd42fd21fbb69 100644 (file)
@@ -1,6 +1,6 @@
 /* tuner-xc2028
  *
- * Copyright (c) 2007 Mauro Carvalho Chehab (mchehab@infradead.org)
+ * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org)
  * This code is placed under the terms of the GNU General Public License v2
  */
 
@@ -12,7 +12,7 @@
 #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
 
 /*      Dmoduler               IF (kHz) */
-#define        XC3028_FE_DEFAULT       0
+#define        XC3028_FE_DEFAULT       0               /* Don't load SCODE */
 #define XC3028_FE_LG60         6000
 #define        XC3028_FE_ATI638        6380
 #define        XC3028_FE_OREN538       5380