From 5394ba0fd892291eb425649fdbc82b673e0b7956 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 5 Aug 2008 13:01:28 -0700 Subject: drivers/video/fsl-diu-fb.c: add missing of_node_put of_node_put is needed before discarding a value received from of_find_node_by_type, eg in error handling code. The semantic patch that makes the change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct device_node *n; struct device_node *n1; struct device_node *n2; statement S; identifier f1,f2; expression E1,E2; constant C; @@ n = of_find_node_by_type(...) ... if (!n) S ... when != of_node_put(n) when != n1 = f1(n,...) when != E1 = n when any when strict ( + of_node_put(n); return -C; | of_node_put(n); | n2 = f2(n,...) | E2 = n | return ...; ) // Signed-off-by: Julia Lawall Acked-by: Krzysztof Helt Cc: Timur Tabi Cc: York Sun Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/video/fsl-diu-fb.c') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 9cd36c223d33..bd320a2bfb7c 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -1649,8 +1649,10 @@ static int __init fsl_diu_init(void) } prop = of_get_property(np, "d-cache-size", NULL); - if (prop == NULL) + if (prop == NULL) { + of_node_put(np); return -ENODEV; + } /* Freescale PLRU requires 13/8 times the cache size to do a proper displacement flush @@ -1659,8 +1661,10 @@ static int __init fsl_diu_init(void) coherence_data_size /= 8; prop = of_get_property(np, "d-cache-line-size", NULL); - if (prop == NULL) + if (prop == NULL) { + of_node_put(np); return -ENODEV; + } d_cache_line_size = *prop; of_node_put(np); -- cgit v1.2.3-59-g8ed1b From ae5591e3f4754478b397a4e09ebd7cf4774ef88e Mon Sep 17 00:00:00 2001 From: York Sun Date: Fri, 15 Aug 2008 00:40:28 -0700 Subject: freescale DIU: add virtual resolution and panning support Application can now have the virtual resoltuion and use FBIOPAN_DISPLAY ioctl to pan. Signed-off-by: York Sun Cc: Kumar Gala Cc: "Antonino A. Daplas" Cc: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'drivers/video/fsl-diu-fb.c') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index bd320a2bfb7c..d9d24938da9e 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -777,6 +777,22 @@ static void unmap_video_memory(struct fb_info *info) info->fix.smem_len = 0; } +/* + * Using the fb_var_screeninfo in fb_info we set the aoi of this + * particular framebuffer. It is a light version of fsl_diu_set_par. + */ +static int fsl_diu_set_aoi(struct fb_info *info) +{ + struct fb_var_screeninfo *var = &info->var; + struct mfb_info *mfbi = info->par; + struct diu_ad *ad = mfbi->ad; + + /* AOI should not be greater than display size */ + ad->offset_xyi = cpu_to_le32((var->yoffset << 16) | var->xoffset); + ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); + return 0; +} + /* * Using the fb_var_screeninfo in fb_info we set the resolution of this * particular framebuffer. This function alters the fb_fix_screeninfo stored @@ -817,11 +833,11 @@ static int fsl_diu_set_par(struct fb_info *info) diu_ops.get_pixel_format(var->bits_per_pixel, machine_data->monitor_port); ad->addr = cpu_to_le32(info->fix.smem_start); - ad->src_size_g_alpha = cpu_to_le32((var->yres << 12) | - var->xres) | mfbi->g_alpha; - /* fix me. AOI should not be greater than display size */ + ad->src_size_g_alpha = cpu_to_le32((var->yres_virtual << 12) | + var->xres_virtual) | mfbi->g_alpha; + /* AOI should not be greater than display size */ ad->aoi_size = cpu_to_le32((var->yres << 16) | var->xres); - ad->offset_xyi = 0; + ad->offset_xyi = cpu_to_le32((var->yoffset << 16) | var->xoffset); ad->offset_xyd = cpu_to_le32((mfbi->y_aoi_d << 16) | mfbi->x_aoi_d); /* Disable chroma keying function */ @@ -921,6 +937,8 @@ static int fsl_diu_pan_display(struct fb_var_screeninfo *var, else info->var.vmode &= ~FB_VMODE_YWRAP; + fsl_diu_set_aoi(info); + return 0; } @@ -989,7 +1007,7 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, pr_debug("set AOI display offset of index %d to (%d,%d)\n", mfbi->index, aoi_d.x_aoi_d, aoi_d.y_aoi_d); fsl_diu_check_var(&info->var, info); - fsl_diu_set_par(info); + fsl_diu_set_aoi(info); break; case MFB_GET_AOID: aoi_d.x_aoi_d = mfbi->x_aoi_d; -- cgit v1.2.3-59-g8ed1b From fdfaa4833f984c6f8d44afb1fed6c0c775e6e67b Mon Sep 17 00:00:00 2001 From: York Sun Date: Fri, 15 Aug 2008 00:40:29 -0700 Subject: freescale DIU: bug fix: add sanity check for AOI position AOI position cannot be negative. Signed-off-by: York Sun Cc: Kumar Gala Cc: "Antonino A. Daplas" Cc: Krzysztof Helt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/fsl-diu-fb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/video/fsl-diu-fb.c') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index d9d24938da9e..fb51197d1c98 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -479,6 +479,10 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var, base_plane_width = machine_data->fsl_diu_info[0]->var.xres; base_plane_height = machine_data->fsl_diu_info[0]->var.yres; + if (mfbi->x_aoi_d < 0) + mfbi->x_aoi_d = 0; + if (mfbi->y_aoi_d < 0) + mfbi->y_aoi_d = 0; switch (index) { case 0: if (mfbi->x_aoi_d != 0) -- cgit v1.2.3-59-g8ed1b