aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-07-03 14:08:10 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-03 14:11:14 -0400
commit333408f21590d50397f3004e3f87070fa8f52c51 (patch)
treef4abdf3abef05c3403a337bbae0e317963a83937 /drivers
parent872aad45d6174570dd2e1defc3efee50f2cfcc72 (diff)
V4L/DVB (5808): Bttv: fix v4l1 breaking the driver
If one uses a V4L *one* application, such as vlc or mplayer's v4l driver, as the first user after the driver is loaded, the driver wedges itself and will never capture properly. Even if one uses a V4L2 application later, it still won't work. If one uses a V4L *two* application first, such as tvtime or mplayer's v4l2 driver, then the driver will be ok. One can then run a V4L1 application, and it will work. It turns out the problem is with norm changing and the crop support that was added in 2.6.21. The driver defaults to PAL, and keeps the last norm it was set too across opens. If one changes the norm via V4L1, the cropping parameters are not reset like they should be, and they'll remain broken across device opens. This patch removes the direct setting of btv->tvnorm in the V4L1 ioctl VIDIOCSCHAN handler. The norm is set via the existing call to set_input(), which calls set_tvnorm(), which will reset the cropping values now that it is able to detect the norm change. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 1c38723d3169..b1fedb0f6431 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1331,7 +1331,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
1331 1331
1332/* Call with btv->lock down. */ 1332/* Call with btv->lock down. */
1333static void 1333static void
1334set_input(struct bttv *btv, unsigned int input) 1334set_input(struct bttv *btv, unsigned int input, unsigned int norm)
1335{ 1335{
1336 unsigned long flags; 1336 unsigned long flags;
1337 1337
@@ -1350,7 +1350,7 @@ set_input(struct bttv *btv, unsigned int input)
1350 } 1350 }
1351 audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? 1351 audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ?
1352 TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); 1352 TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN));
1353 set_tvnorm(btv,btv->tvnorm); 1353 set_tvnorm(btv, norm);
1354 i2c_vidiocschan(btv); 1354 i2c_vidiocschan(btv);
1355} 1355}
1356 1356
@@ -1441,7 +1441,7 @@ static void bttv_reinit_bt848(struct bttv *btv)
1441 1441
1442 init_bt848(btv); 1442 init_bt848(btv);
1443 btv->pll.pll_current = -1; 1443 btv->pll.pll_current = -1;
1444 set_input(btv,btv->input); 1444 set_input(btv, btv->input, btv->tvnorm);
1445} 1445}
1446 1446
1447static int get_control(struct bttv *btv, struct v4l2_control *c) 1447static int get_control(struct bttv *btv, struct v4l2_control *c)
@@ -2011,8 +2011,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
2011 return 0; 2011 return 0;
2012 } 2012 }
2013 2013
2014 btv->tvnorm = v->norm; 2014 set_input(btv, v->channel, v->norm);
2015 set_input(btv,v->channel);
2016 mutex_unlock(&btv->lock); 2015 mutex_unlock(&btv->lock);
2017 return 0; 2016 return 0;
2018 } 2017 }
@@ -2148,7 +2147,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
2148 if (*i > bttv_tvcards[btv->c.type].video_inputs) 2147 if (*i > bttv_tvcards[btv->c.type].video_inputs)
2149 return -EINVAL; 2148 return -EINVAL;
2150 mutex_lock(&btv->lock); 2149 mutex_lock(&btv->lock);
2151 set_input(btv,*i); 2150 set_input(btv, *i, btv->tvnorm);
2152 mutex_unlock(&btv->lock); 2151 mutex_unlock(&btv->lock);
2153 return 0; 2152 return 0;
2154 } 2153 }
@@ -4780,7 +4779,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
4780 bt848_hue(btv,32768); 4779 bt848_hue(btv,32768);
4781 bt848_sat(btv,32768); 4780 bt848_sat(btv,32768);
4782 audio_mute(btv, 1); 4781 audio_mute(btv, 1);
4783 set_input(btv,0); 4782 set_input(btv, 0, btv->tvnorm);
4784 bttv_crop_reset(&btv->crop[0], btv->tvnorm); 4783 bttv_crop_reset(&btv->crop[0], btv->tvnorm);
4785 btv->crop[1] = btv->crop[0]; /* current = default */ 4784 btv->crop[1] = btv->crop[0]; /* current = default */
4786 disclaim_vbi_lines(btv); 4785 disclaim_vbi_lines(btv);