]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] tw5864: crop picture width to 704
authorAndrey Utkin <andrey.utkin@corp.bluecherry.net>
Thu, 22 Sep 2016 00:04:20 +0000 (21:04 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 24 Oct 2016 20:02:54 +0000 (18:02 -0200)
Previously, width of 720 was used, but it gives 16-pixel wide black bar
at right side of encoded picture.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/tw5864/tw5864-reg.h
drivers/media/pci/tw5864/tw5864-video.c

index 92a1b077ef8a547f5de31ed538086707df7d4326..30ac14210e91f956e4434e88448067e9032db586 100644 (file)
 #define TW5864_INDIR_IN_PIC_HEIGHT(channel) (0x201 + 4 * channel)
 #define TW5864_INDIR_OUT_PIC_WIDTH(channel) (0x202 + 4 * channel)
 #define TW5864_INDIR_OUT_PIC_HEIGHT(channel) (0x203 + 4 * channel)
+
+/* Some registers skipped */
+
+#define TW5864_INDIR_CROP_ETC 0x260
+/* Define controls in register TW5864_INDIR_CROP_ETC */
+/* Enable cropping from 720 to 704 */
+#define TW5864_INDIR_CROP_ETC_CROP_EN 0x4
+
 /*
  * Interrupt status register from the front-end. Write "1" to each bit to clear
  * the interrupt
index 652a059b2e0abb3c9bdf9139a69328c7cd1cc72a..9421216bb942a106c1d94f81d4e14cfc43bfc770 100644 (file)
@@ -330,6 +330,15 @@ static int tw5864_enable_input(struct tw5864_input *input)
        tw_indir_writeb(TW5864_INDIR_OUT_PIC_WIDTH(nr), input->width / 4);
        tw_indir_writeb(TW5864_INDIR_OUT_PIC_HEIGHT(nr), input->height / 4);
 
+       /*
+        * Crop width from 720 to 704.
+        * Above register settings need value 720 involved.
+        */
+       input->width = 704;
+       tw_indir_writeb(TW5864_INDIR_CROP_ETC,
+                       tw_indir_readb(TW5864_INDIR_CROP_ETC) |
+                       TW5864_INDIR_CROP_ETC_CROP_EN);
+
        tw_writel(TW5864_DSP_PIC_MAX_MB,
                  ((input->width / 16) << 8) | (input->height / 16));
 
@@ -532,7 +541,7 @@ static int tw5864_fmt_vid_cap(struct file *file, void *priv,
 {
        struct tw5864_input *input = video_drvdata(file);
 
-       f->fmt.pix.width = 720;
+       f->fmt.pix.width = 704;
        switch (input->std) {
        default:
                WARN_ON_ONCE(1);
@@ -738,7 +747,7 @@ static int tw5864_enum_framesizes(struct file *file, void *priv,
                return -EINVAL;
 
        fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
-       fsize->discrete.width = 720;
+       fsize->discrete.width = 704;
        fsize->discrete.height = input->std == STD_NTSC ? 480 : 576;
 
        return 0;