]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
V4L/DVB (12300): bttv: fix regression: tvaudio must be loaded before tuner
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 20 Jul 2009 11:14:17 +0000 (08:14 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 Jul 2009 17:03:31 +0000 (14:03 -0300)
Both tvaudio and the tuner share i2c address 0x42. The tvaudio module can
check whether it really is a tda9840, but the tuner can't. So the tvaudio
module must be loaded before the tuner module. This was also the case for
2.6.29, but the order was swapped in 2.6.30.

Thanks to Krzysztof Grygiencz for reporting and testing this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/bt8xx/bttv-cards.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/bt8xx/bttv.h

index fdb4adff3d287dd41b0777f9843321cf0c8682ea..ca6558c394be0c97484bc5f67093c9e3962bfe24 100644 (file)
@@ -3324,8 +3324,6 @@ void __devinit bttv_init_card1(struct bttv *btv)
 /* initialization part two -- after registering i2c bus */
 void __devinit bttv_init_card2(struct bttv *btv)
 {
-       int addr=ADDR_UNSET;
-
        btv->tuner_type = UNSET;
 
        if (BTTV_BOARD_UNKNOWN == btv->c.type) {
@@ -3470,9 +3468,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
        btv->pll.pll_current = -1;
 
        /* tuner configuration (from card list / autodetect / insmod option) */
-       if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
-               addr = bttv_tvcards[btv->c.type].tuner_addr;
-
        if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
                if (UNSET == btv->tuner_type)
                        btv->tuner_type = bttv_tvcards[btv->c.type].tuner_type;
@@ -3496,40 +3491,6 @@ void __devinit bttv_init_card2(struct bttv *btv)
        if (UNSET == btv->tuner_type)
                btv->tuner_type = TUNER_ABSENT;
 
-       if (btv->tuner_type != TUNER_ABSENT) {
-               struct tuner_setup tun_setup;
-
-               /* Load tuner module before issuing tuner config call! */
-               if (bttv_tvcards[btv->c.type].has_radio)
-                       v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                               &btv->c.i2c_adap, "tuner", "tuner",
-                               v4l2_i2c_tuner_addrs(ADDRS_RADIO));
-               v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                               &btv->c.i2c_adap, "tuner", "tuner",
-                               v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
-               v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                               &btv->c.i2c_adap, "tuner", "tuner",
-                               v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD));
-
-               tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
-               tun_setup.type = btv->tuner_type;
-               tun_setup.addr = addr;
-
-               if (bttv_tvcards[btv->c.type].has_radio)
-                       tun_setup.mode_mask |= T_RADIO;
-
-               bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
-       }
-
-       if (btv->tda9887_conf) {
-               struct v4l2_priv_tun_config tda9887_cfg;
-
-               tda9887_cfg.tuner = TUNER_TDA9887;
-               tda9887_cfg.priv = &btv->tda9887_conf;
-
-               bttv_call_all(btv, tuner, s_config, &tda9887_cfg);
-       }
-
        btv->dig = bttv_tvcards[btv->c.type].has_dig_in ?
                   bttv_tvcards[btv->c.type].video_inputs - 1 : UNSET;
        btv->svhs = bttv_tvcards[btv->c.type].svhs == NO_SVHS ?
@@ -3540,15 +3501,15 @@ void __devinit bttv_init_card2(struct bttv *btv)
                btv->has_remote = remote[btv->c.nr];
 
        if (bttv_tvcards[btv->c.type].has_radio)
-               btv->has_radio=1;
+               btv->has_radio = 1;
        if (bttv_tvcards[btv->c.type].has_remote)
-               btv->has_remote=1;
+               btv->has_remote = 1;
        if (!bttv_tvcards[btv->c.type].no_gpioirq)
-               btv->gpioirq=1;
+               btv->gpioirq = 1;
        if (bttv_tvcards[btv->c.type].volume_gpio)
-               btv->volume_gpio=bttv_tvcards[btv->c.type].volume_gpio;
+               btv->volume_gpio = bttv_tvcards[btv->c.type].volume_gpio;
        if (bttv_tvcards[btv->c.type].audio_mode_gpio)
-               btv->audio_mode_gpio=bttv_tvcards[btv->c.type].audio_mode_gpio;
+               btv->audio_mode_gpio = bttv_tvcards[btv->c.type].audio_mode_gpio;
 
        if (btv->tuner_type == TUNER_ABSENT)
                return;  /* no tuner or related drivers to load */
@@ -3666,6 +3627,49 @@ no_audio:
 }
 
 
+/* initialize the tuner */
+void __devinit bttv_init_tuner(struct bttv *btv)
+{
+       int addr = ADDR_UNSET;
+
+       if (ADDR_UNSET != bttv_tvcards[btv->c.type].tuner_addr)
+               addr = bttv_tvcards[btv->c.type].tuner_addr;
+
+       if (btv->tuner_type != TUNER_ABSENT) {
+               struct tuner_setup tun_setup;
+
+               /* Load tuner module before issuing tuner config call! */
+               if (bttv_tvcards[btv->c.type].has_radio)
+                       v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                               &btv->c.i2c_adap, "tuner", "tuner",
+                               v4l2_i2c_tuner_addrs(ADDRS_RADIO));
+               v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                               &btv->c.i2c_adap, "tuner", "tuner",
+                               v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
+               v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                               &btv->c.i2c_adap, "tuner", "tuner",
+                               v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD));
+
+               tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV;
+               tun_setup.type = btv->tuner_type;
+               tun_setup.addr = addr;
+
+               if (bttv_tvcards[btv->c.type].has_radio)
+                       tun_setup.mode_mask |= T_RADIO;
+
+               bttv_call_all(btv, tuner, s_type_addr, &tun_setup);
+       }
+
+       if (btv->tda9887_conf) {
+               struct v4l2_priv_tun_config tda9887_cfg;
+
+               tda9887_cfg.tuner = TUNER_TDA9887;
+               tda9887_cfg.priv = &btv->tda9887_conf;
+
+               bttv_call_all(btv, tuner, s_config, &tda9887_cfg);
+       }
+}
+
 /* ----------------------------------------------------------------------- */
 
 static void modtec_eeprom(struct bttv *btv)
index d147d29bb0d33144cf875bfe2a06044d7754f832..8cc6dd28d6a7a1ca4109064d6d98994d280003a2 100644 (file)
@@ -4419,6 +4419,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
 
        /* some card-specific stuff (needs working i2c) */
        bttv_init_card2(btv);
+       bttv_init_tuner(btv);
        init_irqreg(btv);
 
        /* register video4linux + input */
index 3d36daf206f37a3c05f3b8466d6a3e2c237de5be..3ec2402c6b4a188ef54260b1f3012bc977d18ee9 100644 (file)
@@ -283,6 +283,7 @@ extern struct tvcard bttv_tvcards[];
 extern void bttv_idcard(struct bttv *btv);
 extern void bttv_init_card1(struct bttv *btv);
 extern void bttv_init_card2(struct bttv *btv);
+extern void bttv_init_tuner(struct bttv *btv);
 
 /* card-specific funtions */
 extern void tea5757_set_freq(struct bttv *btv, unsigned short freq);