aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-01-28 19:32:59 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:46 -0400
commit72134a6d5199c3f5c8efe914e49072bde95948b3 (patch)
treeea12a61c3972a7accbf787b62445e7daf6e372dd /drivers/media/video/bt8xx
parent4ef2ccc2611456667ea78c6f418ce87e1fa9fac5 (diff)
V4L/DVB (10559): bttv: Fix TDA9880 norm setting code
The code to set the norm for the TDA9880 analog demod was comparing btv->norm, an index into the bttv driver's norm array, to V4L2_STD_NTSC, which is a bit flag that's part of the V4L2 API. This doesn't work of course and results in the PAL path always being taken. What's more, it modified the bttv_tvcards[] entries for cards using the TDA9880. This is wrong because changing the norm on one card will also affect other cards of the same type. Writing to bttv_tvcards is also bad because it should be read-only or even devinitdata. Changing the norm would also cause the audio to become unmuted. Have the code get called for both norm setting and audio input setting (which where the gpios are set) to avoid needed to modify bttv_tvcards. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c37
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c13
-rw-r--r--drivers/media/video/bt8xx/bttv.h2
3 files changed, 30 insertions, 22 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 2df0ce2afe98..5c558e48e423 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -4084,27 +4084,26 @@ static void __devinit avermedia_eeprom(struct bttv *btv)
4084 btv->has_remote ? "yes" : "no"); 4084 btv->has_remote ? "yes" : "no");
4085} 4085}
4086 4086
4087/* used on Voodoo TV/FM (Voodoo 200), S0 wired to 0x10000 */ 4087/*
4088void bttv_tda9880_setnorm(struct bttv *btv, unsigned int norm) 4088 * For Voodoo TV/FM and Voodoo 200. These cards' tuners use a TDA9880
4089 * analog demod, which is not I2C controlled like the newer and more common
4090 * TDA9887 series. Instead is has two tri-state input pins, S0 and S1,
4091 * that control the IF for the video and audio. Apparently, bttv GPIO
4092 * 0x10000 is connected to S0. S0 low selects a 38.9 MHz VIF for B/G/D/K/I
4093 * (i.e., PAL) while high selects 45.75 MHz for M/N (i.e., NTSC).
4094 */
4095u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits)
4089{ 4096{
4090 /* fix up our card entry */ 4097
4091 if(norm==V4L2_STD_NTSC) { 4098 if (btv->audio == TVAUDIO_INPUT_TUNER) {
4092 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; 4099 if (bttv_tvnorms[btv->tvnorm].v4l2_id & V4L2_STD_MN)
4093 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; 4100 gpiobits |= 0x10000;
4094 bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; 4101 else
4095 bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x957fff; 4102 gpiobits &= ~0x10000;
4096 dprintk("bttv_tda9880_setnorm to NTSC\n");
4097 }
4098 else {
4099 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff;
4100 bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff;
4101 bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff;
4102 bttv_tvcards[BTTV_BOARD_VOODOOTV_200].gpiomute=0x947fff;
4103 dprintk("bttv_tda9880_setnorm to PAL\n");
4104 } 4103 }
4105 /* set GPIO according */ 4104
4106 gpio_bits(bttv_tvcards[btv->c.type].gpiomask, 4105 gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpiobits);
4107 bttv_tvcards[btv->c.type].gpiomux[btv->audio]); 4106 return gpiobits;
4108} 4107}
4109 4108
4110 4109
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 4ec476a9c0e4..89e0cd191531 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1180,7 +1180,16 @@ audio_mux(struct bttv *btv, int input, int mute)
1180 else 1180 else
1181 gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; 1181 gpio_val = bttv_tvcards[btv->c.type].gpiomux[input];
1182 1182
1183 gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val); 1183 switch (btv->c.type) {
1184 case BTTV_BOARD_VOODOOTV_FM:
1185 case BTTV_BOARD_VOODOOTV_200:
1186 gpio_val = bttv_tda9880_setnorm(btv, gpio_val);
1187 break;
1188
1189 default:
1190 gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val);
1191 }
1192
1184 if (bttv_gpio) 1193 if (bttv_gpio)
1185 bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]); 1194 bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]);
1186 if (in_interrupt()) 1195 if (in_interrupt())
@@ -1319,7 +1328,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
1319 switch (btv->c.type) { 1328 switch (btv->c.type) {
1320 case BTTV_BOARD_VOODOOTV_FM: 1329 case BTTV_BOARD_VOODOOTV_FM:
1321 case BTTV_BOARD_VOODOOTV_200: 1330 case BTTV_BOARD_VOODOOTV_200:
1322 bttv_tda9880_setnorm(btv,norm); 1331 bttv_tda9880_setnorm(btv, gpio_read());
1323 break; 1332 break;
1324 } 1333 }
1325 id = tvnorm->v4l2_id; 1334 id = tvnorm->v4l2_id;
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index b1986b94d29f..6bf2fa03a585 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -265,7 +265,7 @@ extern void bttv_init_card2(struct bttv *btv);
265 265
266/* card-specific funtions */ 266/* card-specific funtions */
267extern void tea5757_set_freq(struct bttv *btv, unsigned short freq); 267extern void tea5757_set_freq(struct bttv *btv, unsigned short freq);
268extern void bttv_tda9880_setnorm(struct bttv *btv, unsigned int norm); 268extern u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits);
269 269
270/* extra tweaks for some chipsets */ 270/* extra tweaks for some chipsets */
271extern void bttv_check_chipset(void); 271extern void bttv_check_chipset(void);