V4L/DVB (10506): saa7134: move tuner init code to saa7134-cards
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 8 Feb 2009 11:50:50 +0000 (08:50 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:42 +0000 (12:42 -0300)
On certain devices, before opening a tuner, we need to open the tuner
gate via i2c.

This patch just moves the tuner probing code to the same place where
such i2c commands are handled, to make easier to fix this trouble on
later patches.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c

index 42684d16204059b7d9df6cc4b8d9d1447554de8b..99450cbd42bd84115119dfdc39f6bf83ef260852 100644 (file)
@@ -6197,6 +6197,30 @@ int saa7134_board_init2(struct saa7134_dev *dev)
        unsigned char buf;
        int board;
 
+       /* initialize hardware #2 */
+       if (TUNER_ABSENT != dev->tuner_type) {
+               int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
+
+               /* Note: radio tuner address is always filled in,
+                  so we do not need to probe for a radio tuner device. */
+               if (dev->radio_type != UNSET)
+                       v4l2_i2c_new_subdev(&dev->i2c_adap,
+                               "tuner", "tuner", dev->radio_addr);
+               if (has_demod)
+                       v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
+                               "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
+               if (dev->tuner_addr == ADDR_UNSET) {
+                       enum v4l2_i2c_tuner_type type =
+                               has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
+
+                       v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
+                               "tuner", v4l2_i2c_tuner_addrs(type));
+               } else {
+                       v4l2_i2c_new_subdev(&dev->i2c_adap,
+                               "tuner", "tuner", dev->tuner_addr);
+               }
+       }
+
        switch (dev->board) {
        case SAA7134_BOARD_BMK_MPEX_NOTUNER:
        case SAA7134_BOARD_BMK_MPEX_TUNER:
index b0f886e27c607729519692f83e0b578bb72ebdd4..6a1738dccda70865db589556d62cbead81fb1951 100644 (file)
@@ -973,30 +973,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        /* wait a bit, register i2c bus */
        msleep(100);
        saa7134_i2c_register(dev);
-
-       /* initialize hardware #2 */
-       if (TUNER_ABSENT != dev->tuner_type) {
-               int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
-
-               /* Note: radio tuner address is always filled in,
-                  so we do not need to probe for a radio tuner device. */
-               if (dev->radio_type != UNSET)
-                       v4l2_i2c_new_subdev(&dev->i2c_adap,
-                               "tuner", "tuner", dev->radio_addr);
-               if (has_demod)
-                       v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
-                               "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
-               if (dev->tuner_addr == ADDR_UNSET) {
-                       enum v4l2_i2c_tuner_type type =
-                               has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
-
-                       v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
-                               "tuner", v4l2_i2c_tuner_addrs(type));
-               } else {
-                       v4l2_i2c_new_subdev(&dev->i2c_adap,
-                               "tuner", "tuner", dev->tuner_addr);
-               }
-       }
        saa7134_board_init2(dev);
 
        saa7134_hwinit2(dev);