diff options
Diffstat (limited to 'patches.at91/0146-media-at91sam9x5-video-change-scaling-factor-calcula.patch')
-rw-r--r-- | patches.at91/0146-media-at91sam9x5-video-change-scaling-factor-calcula.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/patches.at91/0146-media-at91sam9x5-video-change-scaling-factor-calcula.patch b/patches.at91/0146-media-at91sam9x5-video-change-scaling-factor-calcula.patch new file mode 100644 index 00000000000000..7a06df38f9920d --- /dev/null +++ b/patches.at91/0146-media-at91sam9x5-video-change-scaling-factor-calcula.patch @@ -0,0 +1,76 @@ +From 5ce36caa7629ccccf5ae2b7c35c578cc2bfedc3f Mon Sep 17 00:00:00 2001 +From: Nicolas Ferre <nicolas.ferre@atmel.com> +Date: Tue, 16 Oct 2012 18:30:47 +0200 +Subject: media/at91sam9x5-video: change scaling factor calculation + +Useful for future revision of the HEO IP + +Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> +--- + drivers/media/video/at91sam9x5-video.c | 36 ++++++++++++++++++++++++++++------ + 1 file changed, 30 insertions(+), 6 deletions(-) + +diff --git a/drivers/media/video/at91sam9x5-video.c b/drivers/media/video/at91sam9x5-video.c +index 9d7e6c5..1e5a0a7 100644 +--- a/drivers/media/video/at91sam9x5-video.c ++++ b/drivers/media/video/at91sam9x5-video.c +@@ -518,6 +518,19 @@ static void at91sam9x5_video_params(unsigned width, unsigned height, + *tloffset = e[ro(0)]; + } + ++static void at91sam9x5_video_setup_scaling_coef( ++ struct at91sam9x5_video_priv *priv, ++ unsigned hwxmem_size, unsigned hwxsize, ++ unsigned hwymem_size, unsigned hwysize, ++ unsigned *xphidef, unsigned *yphidef) {} ++ ++static void at91sam9x5_video_setup_scaling_factor( ++ unsigned hwmem_size, unsigned hwsize, ++ unsigned phidef, unsigned *factor) ++{ ++ *factor = 1024 * hwmem_size / hwsize; ++} ++ + static void at91sam9x5_video_update_config_real( + struct at91sam9x5_video_priv *priv) + { +@@ -529,6 +542,9 @@ static void at91sam9x5_video_update_config_real( + + unsigned hwxpos, hwypos, hwxsize, hwysize; + unsigned hwxmem_size, hwymem_size; ++ unsigned xphidef = 0; ++ unsigned yphidef = 0; ++ unsigned xfactor, yfactor; + s32 hwxstride, hwpstride; + s32 hwuvxstride, hwuvpstride; + s32 rotated_pixwidth, rotated_pixheight; +@@ -600,12 +616,20 @@ static void at91sam9x5_video_update_config_real( + valtomask(hwxmem_size - 1, REG_HEOCFG4_XMEMSIZE) | + valtomask(hwymem_size - 1, REG_HEOCFG4_YMEMSIZE)); + +- at91sam9x5_video_write32(priv, REG_HEOCFG13, +- REG_HEOCFG13_SCALEN | +- valtomask(1024 * hwxmem_size / hwxsize, +- REG_HEOCFG13_XFACTOR) | +- valtomask(1024 * hwymem_size / hwysize, +- REG_HEOCFG13_YFACTOR)); ++ at91sam9x5_video_setup_scaling_coef(priv, ++ hwxmem_size, hwxsize, ++ hwymem_size, hwysize, ++ &xphidef, &yphidef); ++ ++ at91sam9x5_video_setup_scaling_factor(hwxmem_size - 1, hwxsize - 1, ++ xphidef, &xfactor); ++ ++ at91sam9x5_video_setup_scaling_factor(hwymem_size - 1, hwysize - 1, ++ yphidef, &yfactor); ++ ++ at91sam9x5_video_write32(priv, REG_HEOCFG13, REG_HEOCFG13_SCALEN ++ | valtomask(xfactor, REG_HEOCFG13_XFACTOR) ++ | valtomask(yfactor, REG_HEOCFG13_YFACTOR)); + + at91sam9x5_video_params(pix->width, pix->height, priv->rotation, + &hwxstride, &hwpstride, &priv->y_offset); +-- +1.8.0.197.g5a90748 + |