V4L/DVB (6272): V4L: properly fix support for capturing interlaced video in saa7134
authorMaxim Levitsky <maximlevitsky@gmail.com>
Thu, 27 Sep 2007 23:44:39 +0000 (20:44 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 10 Oct 2007 03:02:59 +0000 (00:02 -0300)
By "capturing interlaced video" I mean that card ensures that top field
is really top and vice versa (I think it takes the filed ID from signal)
Properly turn on/off that support depending on signal state

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h

index 7f5df32ed0e88053f0654a3a3f3f56cde019e94d..fae0bfe7939f98c12d3ecae46622f1981c25c19e 100644 (file)
@@ -594,8 +594,10 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
                        print_irqstatus(dev,loop,report,status);
 
 
-               if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */)
-                       saa7134_irq_video_intl(dev);
+               if ((report & SAA7134_IRQ_REPORT_RDCAP) ||
+                       (report & SAA7134_IRQ_REPORT_INTL))
+                               saa7134_irq_video_signalchange(dev);
+
 
                if ((report & SAA7134_IRQ_REPORT_DONE_RA0) &&
                    (status & 0x60) == 0)
@@ -1081,7 +1083,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        mutex_unlock(&devlist_lock);
 
        /* check for signal */
-       saa7134_irq_video_intl(dev);
+       saa7134_irq_video_signalchange(dev);
 
        if (saa7134_dmasound_init && !dev->dmasound.priv_data) {
                saa7134_dmasound_init(dev);
index 24d579723b5558df6e25e6f3c287c772adfc30a7..7c97ac15e665192f436d907f2498ab27f799675d 100644 (file)
@@ -40,7 +40,7 @@
 
 static unsigned int video_debug   = 0;
 static unsigned int gbuffers      = 8;
-static unsigned int noninterlaced = 1;
+static unsigned int noninterlaced = 0;
 static unsigned int gbufsize      = 720*576*4;
 static unsigned int gbufsize_max  = 720*576*4;
 static char secam[] = "--";
@@ -2454,7 +2454,7 @@ int saa7134_video_init2(struct saa7134_dev *dev)
        return 0;
 }
 
-void saa7134_irq_video_intl(struct saa7134_dev *dev)
+void saa7134_irq_video_signalchange(struct saa7134_dev *dev)
 {
        static const char *st[] = {
                "(no signal)", "NTSC", "PAL", "SECAM" };
@@ -2466,24 +2466,28 @@ void saa7134_irq_video_intl(struct saa7134_dev *dev)
                (st1 & 0x40) ? "not locked" : "locked",
                (st2 & 0x40) ? "no"         : "yes",
                st[st1 & 0x03]);
-       dev->nosignal = (st1 & 0x40) || (st2 & 0x40);
+       dev->nosignal = (st1 & 0x40) || (st2 & 0x40)  || !(st2 & 0x1);
 
        if (dev->nosignal) {
                /* no video signal -> mute audio */
                if (dev->ctl_automute)
                        dev->automute = 1;
                saa7134_tvaudio_setmute(dev);
-               saa_setb(SAA7134_SYNC_CTRL, 0x20);
        } else {
                /* wake up tvaudio audio carrier scan thread */
                saa7134_tvaudio_do_scan(dev);
-               if (!noninterlaced)
-                       saa_clearb(SAA7134_SYNC_CTRL, 0x20);
        }
+
+       if ((st2 & 0x80) && !noninterlaced && !dev->nosignal)
+               saa_clearb(SAA7134_SYNC_CTRL, 0x20);
+       else
+               saa_setb(SAA7134_SYNC_CTRL, 0x20);
+
        if (dev->mops && dev->mops->signal_change)
                dev->mops->signal_change(dev);
 }
 
+
 void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status)
 {
        enum v4l2_field field;
index 5b1f22606558be6f152d406a63c083edc83670e0..745b750cd3feea16f258d2c2dc70a7919b967c61 100644 (file)
@@ -639,7 +639,7 @@ int saa7134_common_ioctl(struct saa7134_dev *dev,
 
 int saa7134_video_init1(struct saa7134_dev *dev);
 int saa7134_video_init2(struct saa7134_dev *dev);
-void saa7134_irq_video_intl(struct saa7134_dev *dev);
+void saa7134_irq_video_signalchange(struct saa7134_dev *dev);
 void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);