aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/atmel_lcdfb.c20
-rw-r--r--include/video/atmel_lcdc.h14
2 files changed, 27 insertions, 7 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index f8e711147501..5d22ea532e42 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -203,6 +203,26 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
203 var->transp.offset = var->transp.length = 0; 203 var->transp.offset = var->transp.length = 0;
204 var->xoffset = var->yoffset = 0; 204 var->xoffset = var->yoffset = 0;
205 205
206 /* Saturate vertical and horizontal timings at maximum values */
207 var->vsync_len = min_t(u32, var->vsync_len,
208 (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
209 var->upper_margin = min_t(u32, var->upper_margin,
210 ATMEL_LCDC_VBP >> ATMEL_LCDC_VBP_OFFSET);
211 var->lower_margin = min_t(u32, var->lower_margin,
212 ATMEL_LCDC_VFP);
213 var->right_margin = min_t(u32, var->right_margin,
214 (ATMEL_LCDC_HFP >> ATMEL_LCDC_HFP_OFFSET) + 1);
215 var->hsync_len = min_t(u32, var->hsync_len,
216 (ATMEL_LCDC_HPW >> ATMEL_LCDC_HPW_OFFSET) + 1);
217 var->left_margin = min_t(u32, var->left_margin,
218 ATMEL_LCDC_HBP + 1);
219
220 /* Some parameters can't be zero */
221 var->vsync_len = max_t(u32, var->vsync_len, 1);
222 var->right_margin = max_t(u32, var->right_margin, 1);
223 var->hsync_len = max_t(u32, var->hsync_len, 1);
224 var->left_margin = max_t(u32, var->left_margin, 1);
225
206 switch (var->bits_per_pixel) { 226 switch (var->bits_per_pixel) {
207 case 1: 227 case 1:
208 case 2: 228 case 2:
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 4eea63761a3f..76095e70935b 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -115,20 +115,20 @@ struct atmel_lcdfb_info {
115#define ATMEL_LCDC_MEMOR_LITTLE (1 << 31) 115#define ATMEL_LCDC_MEMOR_LITTLE (1 << 31)
116 116
117#define ATMEL_LCDC_TIM1 0x0808 117#define ATMEL_LCDC_TIM1 0x0808
118#define ATMEL_LCDC_VFP (0xff << 0) 118#define ATMEL_LCDC_VFP (0xffU << 0)
119#define ATMEL_LCDC_VBP_OFFSET 8 119#define ATMEL_LCDC_VBP_OFFSET 8
120#define ATMEL_LCDC_VBP (0xff << ATMEL_LCDC_VBP_OFFSET) 120#define ATMEL_LCDC_VBP (0xffU << ATMEL_LCDC_VBP_OFFSET)
121#define ATMEL_LCDC_VPW_OFFSET 16 121#define ATMEL_LCDC_VPW_OFFSET 16
122#define ATMEL_LCDC_VPW (0x3f << ATMEL_LCDC_VPW_OFFSET) 122#define ATMEL_LCDC_VPW (0x3fU << ATMEL_LCDC_VPW_OFFSET)
123#define ATMEL_LCDC_VHDLY_OFFSET 24 123#define ATMEL_LCDC_VHDLY_OFFSET 24
124#define ATMEL_LCDC_VHDLY (0xf << ATMEL_LCDC_VHDLY_OFFSET) 124#define ATMEL_LCDC_VHDLY (0xfU << ATMEL_LCDC_VHDLY_OFFSET)
125 125
126#define ATMEL_LCDC_TIM2 0x080c 126#define ATMEL_LCDC_TIM2 0x080c
127#define ATMEL_LCDC_HBP (0xff << 0) 127#define ATMEL_LCDC_HBP (0xffU << 0)
128#define ATMEL_LCDC_HPW_OFFSET 8 128#define ATMEL_LCDC_HPW_OFFSET 8
129#define ATMEL_LCDC_HPW (0x3f << ATMEL_LCDC_HPW_OFFSET) 129#define ATMEL_LCDC_HPW (0x3fU << ATMEL_LCDC_HPW_OFFSET)
130#define ATMEL_LCDC_HFP_OFFSET 21 130#define ATMEL_LCDC_HFP_OFFSET 21
131#define ATMEL_LCDC_HFP (0x7ff << ATMEL_LCDC_HFP_OFFSET) 131#define ATMEL_LCDC_HFP (0x7ffU << ATMEL_LCDC_HFP_OFFSET)
132 132
133#define ATMEL_LCDC_LCDFRMCFG 0x0810 133#define ATMEL_LCDC_LCDFRMCFG 0x0810
134#define ATMEL_LCDC_LINEVAL (0x7ff << 0) 134#define ATMEL_LCDC_LINEVAL (0x7ff << 0)