aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mxb.c
diff options
context:
space:
mode:
authorMichael Hunold <hunold@linuxtv.org>2005-07-27 14:46:00 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-27 19:26:17 -0400
commit9d2599d98e9cb511f326b2d1b353e462bc360774 (patch)
treecf7f6af005d331c4115a60c33729e2adeb622dc0 /drivers/media/video/mxb.c
parent29780bb7af61752924cf4814f2d8180747b38105 (diff)
[PATCH] v4l: fix tuning with MXB driver
I noticed that some past changes to the gerneric Video4Linux tuner module for analog tuners broke my "Multimedia eXtension Board" driver. The tuner driver was made aware of Video4Linux2 tuning ioctls, but my driver was not ported and still uses the Video4Linux1 ioctls. This does not work anymore as intendend, the tuning is currently broken. The attached patch fixes non-working tuning in MXB driver introduced by some recent generic tuner changes by replacing Video4Linux1 tuner ioctls with proper Video4Linux2 tuner ioctls. - fix non-working tuning in MXB driver introduced by some recent generic tuner changes by replacing Video4Linux1 tuner ioctls with proper Video4Linux2 tuner ioctls Signed-off-by: Michael Hunold <hunold@linuxtv.org> Cc: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/mxb.c')
-rw-r--r--drivers/media/video/mxb.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 486234d41b56..d04793fb80fc 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -142,8 +142,8 @@ struct mxb
142 142
143 int cur_mode; /* current audio mode (mono, stereo, ...) */ 143 int cur_mode; /* current audio mode (mono, stereo, ...) */
144 int cur_input; /* current input */ 144 int cur_input; /* current input */
145 int cur_freq; /* current frequency the tuner is tuned to */
146 int cur_mute; /* current mute status */ 145 int cur_mute; /* current mute status */
146 struct v4l2_frequency cur_freq; /* current frequency the tuner is tuned to */
147}; 147};
148 148
149static struct saa7146_extension extension; 149static struct saa7146_extension extension;
@@ -352,9 +352,15 @@ static int mxb_init_done(struct saa7146_dev* dev)
352 /* select a tuner type */ 352 /* select a tuner type */
353 tun_setup.mode_mask = T_ANALOG_TV; 353 tun_setup.mode_mask = T_ANALOG_TV;
354 tun_setup.addr = ADDR_UNSET; 354 tun_setup.addr = ADDR_UNSET;
355 tun_setup.type = 5; 355 tun_setup.type = TUNER_PHILIPS_PAL;
356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); 356 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
357 357 /* tune in some frequency on tuner */
358 mxb->cur_freq.tuner = 0;
359 mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
360 mxb->cur_freq.frequency = freq;
361 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY,
362 &mxb->cur_freq);
363
358 /* mute audio on tea6420s */ 364 /* mute audio on tea6420s */
359 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 365 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
360 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 366 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);
@@ -371,12 +377,8 @@ static int mxb_init_done(struct saa7146_dev* dev)
371 vm.out = 13; 377 vm.out = 13;
372 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 378 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);
373 379
374 /* tune in some frequency on tuner */
375 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &freq);
376
377 /* the rest for mxb */ 380 /* the rest for mxb */
378 mxb->cur_input = 0; 381 mxb->cur_input = 0;
379 mxb->cur_freq = freq;
380 mxb->cur_mute = 1; 382 mxb->cur_mute = 1;
381 383
382 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 384 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
@@ -819,18 +821,14 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
819 return -EINVAL; 821 return -EINVAL;
820 } 822 }
821 823
822 memset(f,0,sizeof(*f)); 824 *f = mxb->cur_freq;
823 f->type = V4L2_TUNER_ANALOG_TV;
824 f->frequency = mxb->cur_freq;
825 825
826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq)); 826 DEB_EE(("VIDIOC_G_FREQ: freq:0x%08x.\n", mxb->cur_freq.frequency));
827 return 0; 827 return 0;
828 } 828 }
829 case VIDIOC_S_FREQUENCY: 829 case VIDIOC_S_FREQUENCY:
830 { 830 {
831 struct v4l2_frequency *f = arg; 831 struct v4l2_frequency *f = arg;
832 int t_locked = 0;
833 int v_byte = 0;
834 832
835 if (0 != f->tuner) 833 if (0 != f->tuner)
836 return -EINVAL; 834 return -EINVAL;
@@ -843,20 +841,11 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
843 return -EINVAL; 841 return -EINVAL;
844 } 842 }
845 843
846 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n",f->frequency)); 844 mxb->cur_freq = *f;
847 845 DEB_EE(("VIDIOC_S_FREQUENCY: freq:0x%08x.\n", mxb->cur_freq.frequency));
848 mxb->cur_freq = f->frequency;
849 846
850 /* tune in desired frequency */ 847 /* tune in desired frequency */
851 mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &mxb->cur_freq); 848 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_FREQUENCY, &mxb->cur_freq);
852
853 /* check if pll of tuner & saa7111a is locked */
854// mxb->tuner->driver->command(mxb->tuner,TUNER_IS_LOCKED, &t_locked);
855 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_GET_STATUS, &v_byte);
856
857 /* not locked -- anything to do here ? */
858 if( 0 == t_locked || 0 == (v_byte & DECODER_STATUS_GOOD)) {
859 }
860 849
861 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ 850 /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */
862 spin_lock(&dev->slock); 851 spin_lock(&dev->slock);