Commit 81685327 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: introduce #define for maximum supported scaling values (register 0x30-0x33)

The maximum supported scaling value for registers 0x30+0x31 (horizontal scaling)
and 0x32+0x33 (vertical scaling) is 0x3fff, which corresponds to 20% of the
input frame size.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 84e902aa
...@@ -152,6 +152,8 @@ ...@@ -152,6 +152,8 @@
#define EM28XX_R31_HSCALEHIGH 0x31 #define EM28XX_R31_HSCALEHIGH 0x31
#define EM28XX_R32_VSCALELOW 0x32 #define EM28XX_R32_VSCALELOW 0x32
#define EM28XX_R33_VSCALEHIGH 0x33 #define EM28XX_R33_VSCALEHIGH 0x33
#define EM28XX_HVSCALE_MAX 0x3fff /* => 20% */
#define EM28XX_R34_VBI_START_H 0x34 #define EM28XX_R34_VBI_START_H 0x34
#define EM28XX_R35_VBI_START_V 0x35 #define EM28XX_R35_VBI_START_V 0x35
#define EM28XX_R36_VBI_WIDTH 0x36 #define EM28XX_R36_VBI_WIDTH 0x36
......
...@@ -807,12 +807,12 @@ static void get_scale(struct em28xx *dev, ...@@ -807,12 +807,12 @@ static void get_scale(struct em28xx *dev,
unsigned int maxh = norm_maxh(dev); unsigned int maxh = norm_maxh(dev);
*hscale = (((unsigned long)maxw) << 12) / width - 4096L; *hscale = (((unsigned long)maxw) << 12) / width - 4096L;
if (*hscale >= 0x4000) if (*hscale > EM28XX_HVSCALE_MAX)
*hscale = 0x3fff; *hscale = EM28XX_HVSCALE_MAX;
*vscale = (((unsigned long)maxh) << 12) / height - 4096L; *vscale = (((unsigned long)maxh) << 12) / height - 4096L;
if (*vscale >= 0x4000) if (*vscale > EM28XX_HVSCALE_MAX)
*vscale = 0x3fff; *vscale = EM28XX_HVSCALE_MAX;
} }
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment