The patch number 12301 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <[email protected]>

------

From: Mauro Carvalho Chehab  <[email protected]>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-bttv


Signed-off-by: Mauro Carvalho Chehab <[email protected]>


---

 linux/drivers/media/video/bt8xx/bttv-cards.c  |  284 +++++++++---------
 linux/drivers/media/video/bt8xx/bttv-driver.c |    1 
 linux/drivers/media/video/bt8xx/bttv.h        |    1 
 3 files changed, 146 insertions(+), 140 deletions(-)

diff -r ec4ea62dbde4 -r b53e8f8496af 
linux/drivers/media/video/bt8xx/bttv-cards.c
--- a/linux/drivers/media/video/bt8xx/bttv-cards.c      Mon Jul 20 21:36:49 
2009 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv-cards.c      Mon Jul 20 21:38:10 
2009 -0300
@@ -3362,8 +3362,6 @@ void __devinit bttv_init_card1(struct bt
 /* 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) {
@@ -3508,9 +3506,6 @@ void __devinit bttv_init_card2(struct bt
        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;
@@ -3533,6 +3528,150 @@ void __devinit bttv_init_card2(struct bt
 
        if (UNSET == btv->tuner_type)
                btv->tuner_type = TUNER_ABSENT;
+
+       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 ?
+                   UNSET : bttv_tvcards[btv->c.type].svhs;
+       if (svhs[btv->c.nr] != UNSET)
+               btv->svhs = svhs[btv->c.nr];
+       if (remote[btv->c.nr] != UNSET)
+               btv->has_remote = remote[btv->c.nr];
+
+       if (bttv_tvcards[btv->c.type].has_radio)
+               btv->has_radio = 1;
+       if (bttv_tvcards[btv->c.type].has_remote)
+               btv->has_remote = 1;
+       if (!bttv_tvcards[btv->c.type].no_gpioirq)
+               btv->gpioirq = 1;
+       if (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;
+
+       if (btv->tuner_type == TUNER_ABSENT)
+               return;  /* no tuner or related drivers to load */
+
+       if (btv->has_saa6588 || saa6588[btv->c.nr]) {
+               /* Probe for RDS receiver chip */
+               static const unsigned short addrs[] = {
+                       0x20 >> 1,
+                       0x22 >> 1,
+                       I2C_CLIENT_END
+               };
+               struct v4l2_subdev *sd;
+
+               sd = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                       &btv->c.i2c_adap, "saa6588", "saa6588", addrs);
+               btv->has_saa6588 = (sd != NULL);
+       }
+
+       /* try to detect audio/fader chips */
+
+       /* First check if the user specified the audio chip via a module
+          option. */
+
+       switch (audiodev[btv->c.nr]) {
+       case -1:
+               return; /* do not load any audio module */
+
+       case 0: /* autodetect */
+               break;
+
+       case 1: {
+               /* The user specified that we should probe for msp3400 */
+               static const unsigned short addrs[] = {
+                       I2C_ADDR_MSP3400 >> 1,
+                       I2C_ADDR_MSP3400_ALT >> 1,
+                       I2C_CLIENT_END
+               };
+
+               btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                       &btv->c.i2c_adap, "msp3400", "msp3400", addrs);
+               if (btv->sd_msp34xx)
+                       return;
+               goto no_audio;
+       }
+
+       case 2: {
+               /* The user specified that we should probe for tda7432 */
+               static const unsigned short addrs[] = {
+                       I2C_ADDR_TDA7432 >> 1,
+                       I2C_CLIENT_END
+               };
+
+               if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                               &btv->c.i2c_adap, "tda7432", "tda7432", addrs))
+                       return;
+               goto no_audio;
+       }
+
+       case 3: {
+               /* The user specified that we should probe for tvaudio */
+               btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                       &btv->c.i2c_adap, "tvaudio", "tvaudio", 
tvaudio_addrs());
+               if (btv->sd_tvaudio)
+                       return;
+               goto no_audio;
+       }
+
+       default:
+               printk(KERN_WARNING "bttv%d: unknown audiodev value!\n",
+                       btv->c.nr);
+               return;
+       }
+
+       /* There were no overrides, so now we try to discover this through the
+          card definition */
+
+       /* probe for msp3400 first: this driver can detect whether or not
+          it really is a msp3400, so it will return NULL when the device
+          found is really something else (e.g. a tea6300). */
+       if (!bttv_tvcards[btv->c.type].no_msp34xx) {
+               btv->sd_msp34xx = 
v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev,
+                       &btv->c.i2c_adap, "msp3400", "msp3400",
+                       I2C_ADDR_MSP3400 >> 1);
+       } else if (bttv_tvcards[btv->c.type].msp34xx_alt) {
+               btv->sd_msp34xx = 
v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev,
+                       &btv->c.i2c_adap, "msp3400", "msp3400",
+                       I2C_ADDR_MSP3400_ALT >> 1);
+       }
+
+       /* If we found a msp34xx, then we're done. */
+       if (btv->sd_msp34xx)
+               return;
+
+       /* it might also be a tda7432. */
+       if (!bttv_tvcards[btv->c.type].no_tda7432) {
+               static const unsigned short addrs[] = {
+                       I2C_ADDR_TDA7432 >> 1,
+                       I2C_CLIENT_END
+               };
+
+               if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+                               &btv->c.i2c_adap, "tda7432", "tda7432", addrs))
+                       return;
+       }
+
+       /* Now see if we can find one of the tvaudio devices. */
+       btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
+               &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs());
+       if (btv->sd_tvaudio)
+               return;
+
+no_audio:
+       printk(KERN_WARNING "bttv%d: audio absent, no audio device found!\n",
+                       btv->c.nr);
+}
+
+
+/* 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;
@@ -3567,142 +3706,7 @@ void __devinit bttv_init_card2(struct bt
 
                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 ?
-                   UNSET : bttv_tvcards[btv->c.type].svhs;
-       if (svhs[btv->c.nr] != UNSET)
-               btv->svhs = svhs[btv->c.nr];
-       if (remote[btv->c.nr] != UNSET)
-               btv->has_remote = remote[btv->c.nr];
-
-       if (bttv_tvcards[btv->c.type].has_radio)
-               btv->has_radio=1;
-       if (bttv_tvcards[btv->c.type].has_remote)
-               btv->has_remote=1;
-       if (!bttv_tvcards[btv->c.type].no_gpioirq)
-               btv->gpioirq=1;
-       if (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;
-
-       if (btv->tuner_type == TUNER_ABSENT)
-               return;  /* no tuner or related drivers to load */
-
-       if (btv->has_saa6588 || saa6588[btv->c.nr]) {
-               /* Probe for RDS receiver chip */
-               static const unsigned short addrs[] = {
-                       0x20 >> 1,
-                       0x22 >> 1,
-                       I2C_CLIENT_END
-               };
-               struct v4l2_subdev *sd;
-
-               sd = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                       &btv->c.i2c_adap, "saa6588", "saa6588", addrs);
-               btv->has_saa6588 = (sd != NULL);
-       }
-
-       /* try to detect audio/fader chips */
-
-       /* First check if the user specified the audio chip via a module
-          option. */
-
-       switch (audiodev[btv->c.nr]) {
-       case -1:
-               return; /* do not load any audio module */
-
-       case 0: /* autodetect */
-               break;
-
-       case 1: {
-               /* The user specified that we should probe for msp3400 */
-               static const unsigned short addrs[] = {
-                       I2C_ADDR_MSP3400 >> 1,
-                       I2C_ADDR_MSP3400_ALT >> 1,
-                       I2C_CLIENT_END
-               };
-
-               btv->sd_msp34xx = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                       &btv->c.i2c_adap, "msp3400", "msp3400", addrs);
-               if (btv->sd_msp34xx)
-                       return;
-               goto no_audio;
-       }
-
-       case 2: {
-               /* The user specified that we should probe for tda7432 */
-               static const unsigned short addrs[] = {
-                       I2C_ADDR_TDA7432 >> 1,
-                       I2C_CLIENT_END
-               };
-
-               if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                               &btv->c.i2c_adap, "tda7432", "tda7432", addrs))
-                       return;
-               goto no_audio;
-       }
-
-       case 3: {
-               /* The user specified that we should probe for tvaudio */
-               btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                       &btv->c.i2c_adap, "tvaudio", "tvaudio", 
tvaudio_addrs());
-               if (btv->sd_tvaudio)
-                       return;
-               goto no_audio;
-       }
-
-       default:
-               printk(KERN_WARNING "bttv%d: unknown audiodev value!\n",
-                       btv->c.nr);
-               return;
-       }
-
-       /* There were no overrides, so now we try to discover this through the
-          card definition */
-
-       /* probe for msp3400 first: this driver can detect whether or not
-          it really is a msp3400, so it will return NULL when the device
-          found is really something else (e.g. a tea6300). */
-       if (!bttv_tvcards[btv->c.type].no_msp34xx) {
-               btv->sd_msp34xx = 
v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev,
-                       &btv->c.i2c_adap, "msp3400", "msp3400",
-                       I2C_ADDR_MSP3400 >> 1);
-       } else if (bttv_tvcards[btv->c.type].msp34xx_alt) {
-               btv->sd_msp34xx = 
v4l2_i2c_new_probed_subdev_addr(&btv->c.v4l2_dev,
-                       &btv->c.i2c_adap, "msp3400", "msp3400",
-                       I2C_ADDR_MSP3400_ALT >> 1);
-       }
-
-       /* If we found a msp34xx, then we're done. */
-       if (btv->sd_msp34xx)
-               return;
-
-       /* it might also be a tda7432. */
-       if (!bttv_tvcards[btv->c.type].no_tda7432) {
-               static const unsigned short addrs[] = {
-                       I2C_ADDR_TDA7432 >> 1,
-                       I2C_CLIENT_END
-               };
-
-               if (v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-                               &btv->c.i2c_adap, "tda7432", "tda7432", addrs))
-                       return;
-       }
-
-       /* Now see if we can find one of the tvaudio devices. */
-       btv->sd_tvaudio = v4l2_i2c_new_probed_subdev(&btv->c.v4l2_dev,
-               &btv->c.i2c_adap, "tvaudio", "tvaudio", tvaudio_addrs());
-       if (btv->sd_tvaudio)
-               return;
-
-no_audio:
-       printk(KERN_WARNING "bttv%d: audio absent, no audio device found!\n",
-                       btv->c.nr);
 }
-
 
 /* ----------------------------------------------------------------------- */
 
diff -r ec4ea62dbde4 -r b53e8f8496af 
linux/drivers/media/video/bt8xx/bttv-driver.c
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c     Mon Jul 20 21:36:49 
2009 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c     Mon Jul 20 21:38:10 
2009 -0300
@@ -4457,6 +4457,7 @@ static int __devinit bttv_probe(struct p
 
        /* some card-specific stuff (needs working i2c) */
        bttv_init_card2(btv);
+       bttv_init_tuner(btv);
        init_irqreg(btv);
 
        /* register video4linux + input */
diff -r ec4ea62dbde4 -r b53e8f8496af linux/drivers/media/video/bt8xx/bttv.h
--- a/linux/drivers/media/video/bt8xx/bttv.h    Mon Jul 20 21:36:49 2009 -0300
+++ b/linux/drivers/media/video/bt8xx/bttv.h    Mon Jul 20 21:38:10 2009 -0300
@@ -284,6 +284,7 @@ extern void bttv_idcard(struct bttv *btv
 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);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/b53e8f8496af577c52fba861cce28fa4bab1aadb

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to