V4L/DVB (12794): tm6000: handle also PAL/SECAM resolutions
authorMauro Carvalho Chehab <mchehab@infradead.org>
Tue, 4 Sep 2007 00:51:45 +0000 (21:51 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:39:41 +0000 (00:39 -0300)
Fix the resolutions for 625 line video standards (european PAL/SECAM)

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/tm6000/tm6000-core.c
drivers/staging/tm6000/tm6000-video.c
drivers/staging/tm6000/tm6000.h

index 5e9325582bdeedd9ed4d05561475a6c35c6e772b..c650d3e926a3e8704a1d0073d318a9807e916282 100644 (file)
@@ -421,9 +421,24 @@ REG   PAL   PAL_M PAL_N SECAM NTSC  Comp. PAL  PAL_M PAL_N SECAM NTSC
 0x3f  0x00  0x00  0x00  0x00  0x00
 */
 
+
+void tm6000_get_std_res(struct tm6000_core *dev)
+{
+       /* Currently, those are the only supported resoltions */
+       if (dev->norm & V4L2_STD_525_60) {
+               dev->height=480;
+       } else {
+               dev->height=576;
+       }
+       dev->width=720;
+
+printk("tm6000: res= %dx%d\n",dev->width,dev->height);
+}
+
 int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm)
 {
        dev->norm=*norm;
+       tm6000_get_std_res(dev);
 
        /* HACK: Should use, instead, the common code!!! */
        if (*norm & V4L2_STD_PAL_M) {
index f96c7a77efb66223af5460f2bf6a6d0569228a89..3470a55a5796bd760579c1abf0d8ed2ebfe96b15 100644 (file)
@@ -125,7 +125,7 @@ static LIST_HEAD(tm6000_corelist);
    ------------------------------------------------------------------*/
 
 #define norm_maxw(a) 720
-#define norm_maxh(a) 480
+#define norm_maxh(a) 576
 
 //#define norm_minw(a) norm_maxw(a)
 #define norm_minw(a) norm_maxw(a)
@@ -758,15 +758,6 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
 
        BUG_ON(NULL == fh->fmt);
 
-       if (fh->width  < norm_minw(core) || fh->width  > norm_maxw(core) ||
-           fh->height < norm_minh(core) || fh->height > norm_maxh(core)) {
-               dprintk(dev, V4L2_DEBUG_QUEUE, "Window size (%dx%d) is out of "
-                               "supported range\n", fh->width, fh->height);
-               dprintk(dev, V4L2_DEBUG_QUEUE, "Valid range is from (%dx%d) to "
-                               "(%dx%d)\n", norm_minw(core), norm_minh(core),
-                               norm_maxw(core),norm_maxh(core));
-               return -EINVAL;
-       }
 
        /* FIXME: It assumes depth=2 */
        /* The only currently supported format is 16 bits/pixel */
@@ -993,17 +984,10 @@ static int vidioc_try_fmt_cap (struct file *file, void *priv,
                return -EINVAL;
        }
 
-       if (f->fmt.pix.width  < norm_minw(core))
-               f->fmt.pix.width = norm_minw(core);
-
-       if (f->fmt.pix.width  > norm_maxw(core))
-               f->fmt.pix.width = norm_maxw(core);
+       tm6000_get_std_res (dev);
 
-       if (f->fmt.pix.height < norm_minh(core))
-               f->fmt.pix.height = norm_minh(core);
-
-       if (f->fmt.pix.height > norm_maxh(core))
-               f->fmt.pix.height = norm_maxh(core);
+       f->fmt.pix.width  = dev->width;
+       f->fmt.pix.height = dev->height;
 
        f->fmt.pix.width &= ~0x01;
 
@@ -1385,8 +1369,11 @@ static int tm6000_open(struct inode *inode, struct file *file)
        dev->fourcc  = format[0].fourcc;
 
        fh->fmt      = format_by_fourcc(dev->fourcc);
-       fh->width    = norm_maxw();
-       fh->height   = norm_maxh();
+
+       tm6000_get_std_res (dev);
+
+       fh->width    = dev->width;
+       fh->height   = dev->height;
 
        dprintk(dev, V4L2_DEBUG_OPEN, "Open: fh=0x%08lx, dev=0x%08lx, "
                                                "dev->vidq=0x%08lx\n",
index 3556fa4c403de5d7c1c56fa927a6eb8131d6ddb4..479b4fb520dddd3d4fb606d0210f3e79acf4ea1e 100644 (file)
@@ -122,6 +122,7 @@ struct tm6000_core {
        int                             devno;          /* marks the number of this device */
 
        v4l2_std_id                     norm;           /* Current norm */
+       int                             width,height;   /* Selected resolution */
 
        enum tm6000_core_state          state;
 
@@ -204,6 +205,7 @@ int tm6000_init_after_firmware (struct tm6000_core *dev);
 
 int tm6000_init_analog_mode (struct tm6000_core *dev);
 int tm6000_init_digital_mode (struct tm6000_core *dev);
+void tm6000_get_std_res(struct tm6000_core *dev);
 int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm);
 int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate);