Skip to contentSkip to conversation

video: imxfb: Fix the maximum value for yres

PATCH New Fabio Estevam 3 participants 3 messages Dec 24, 2010 – Jan 6, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 video: imxfb: Fix the maximum value for yres

MX27 and MX25 have 10 bits in the YMAX field of LCDC Size Register.

Fix the maximum value for yres.

---
Changes since v2:
- Perform run-time detection of CPU time

Changes since v1:
- factor out SIZE_YMAX definition

 drivers/video/imxfb.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/video/imxfb.c +3 -6
index 5c363d0..1ab2c25 100644
@@ -53,11 +53,8 @@
 #define LCDC_SIZE	0x04
 #define SIZE_XMAX(x)	((((x) >> 4) & 0x3f) << 20)
 
-#ifdef CONFIG_ARCH_MX1
-#define SIZE_YMAX(y)	((y) & 0x1ff)
-#else
-#define SIZE_YMAX(y)	((y) & 0x3ff)
-#endif
+#define YMAX_MASK       (cpu_is_mx1() ? 0x1ff : 0x3ff)
+#define SIZE_YMAX(y)	((y) & YMAX_MASK)
 
 #define LCDC_VPW	0x08
 #define VPW_VPW(x)	((x) & 0x3ff)
@@ -623,7 +620,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
 	if (var->right_margin > 255)
 		printk(KERN_ERR "%s: invalid right_margin %d\n",
 			info->fix.id, var->right_margin);
-	if (var->yres < 1 || var->yres > 511)
+	if (var->yres < 1 || var->yres > YMAX_MASK)
 		printk(KERN_ERR "%s: invalid yres %d\n",
 			info->fix.id, var->yres);
 	if (var->vsync_len > 100)
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH v3 1/1 video: imxfb: Fix the maximum value for yres

Fabio,
________________________________________

Quoted 39 lines

From: linux-fbdev-owner at vger.kernel.org [linux-fbdev-owner at vger.kernel.org] On Behalf Of Fabio Estevam [fabio.estevam at freescale.com]
Sent: Friday, December 24, 2010 5:58 PM
To: linux-fbdev at vger.kernel.org
Cc: kernel at pengutronix.de; linux-arm-kernel at lists.infradead.org; lethal at linux-sh.org; Fabio Estevam
Subject: [PATCH v3] video: imxfb: Fix the maximum value for yres

MX27 and MX25 have 10 bits in the YMAX field of LCDC Size Register.

Fix the maximum value for yres.

---
Changes since v2:
- Perform run-time detection of CPU time

Changes since v1:
- factor out SIZE_YMAX definition
drivers/video/imxfb.c | 9 +++------

1 files changed, 3 insertions(+), 6 deletions(-)
drivers/video/imxfb.c +2 -5
index 5c363d0..1ab2c25 100644
@@ -53,11 +53,8 @@
 #define LCDC_SIZE      0x04
 #define SIZE_XMAX(x)   ((((x) >> 4) & 0x3f) << 20)
 
-#ifdef CONFIG_ARCH_MX1
-#define SIZE_YMAX(y)   ((y) & 0x1ff)
-#else
-#define SIZE_YMAX(y)   ((y) & 0x3ff)
-#endif
+#define YMAX_MASK       (cpu_is_mx1() ? 0x1ff : 0x3ff)
+#define SIZE_YMAX(y)   ((y) & YMAX_MASK)
 
 #define LCDC_VPW       0x08
 #define VPW_VPW(x)     ((x) & 0x3ff)

drivers/video/imxfb.c static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf · line 623

Quoted 5 lines
drivers/video/imxfb.c +1 -1
@@ -623,7 +620,7 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
      if (var->right_margin > 255)
               printk(KERN_ERR "%s: invalid right_margin %d\n",
                     info->fix.id, var->right_margin);
-       if (var->yres < 1 || var->yres > 511)
+       if (var->yres < 1 || var->yres > YMAX_MASK)

[Mayuresh]: If minimum value of yres_mask is 1 then you please define YMIN_MASK to be 1 This would make your code more readable.

Quoted 5 lines
drivers/video/imxfb.c +0 -1
              printk(KERN_ERR "%s: invalid yres %d\n",
                     info->fix.id, var->yres);
      if (var->vsync_len > 100)
--

1.6.0.4