Lines Matching refs:var
37 static int determine_best_pix_fmt(struct fb_var_screeninfo *var) in determine_best_pix_fmt() argument
42 if (var->bits_per_pixel == 8) in determine_best_pix_fmt()
48 if (var->bits_per_pixel == 16 && var->red.length <= 5 && in determine_best_pix_fmt()
49 var->green.length <= 6 && var->blue.length <= 5) { in determine_best_pix_fmt()
50 if (var->transp.length == 0) { in determine_best_pix_fmt()
51 if (var->red.offset >= var->blue.offset) in determine_best_pix_fmt()
57 if (var->transp.length == 1 && var->green.length <= 5) { in determine_best_pix_fmt()
58 if (var->red.offset >= var->blue.offset) in determine_best_pix_fmt()
68 if (var->bits_per_pixel <= 32 && var->red.length <= 8 && in determine_best_pix_fmt()
69 var->green.length <= 8 && var->blue.length <= 8) { in determine_best_pix_fmt()
70 if (var->bits_per_pixel == 24 && var->transp.length == 0) { in determine_best_pix_fmt()
71 if (var->red.offset >= var->blue.offset) in determine_best_pix_fmt()
77 if (var->bits_per_pixel == 32 && var->transp.length == 8) { in determine_best_pix_fmt()
78 if (var->red.offset >= var->blue.offset) in determine_best_pix_fmt()
83 if (var->red.offset >= var->blue.offset) in determine_best_pix_fmt()
93 static void set_pix_fmt(struct fb_var_screeninfo *var, int pix_fmt) in set_pix_fmt() argument
97 var->bits_per_pixel = 16; in set_pix_fmt()
98 var->red.offset = 11; var->red.length = 5; in set_pix_fmt()
99 var->green.offset = 5; var->green.length = 6; in set_pix_fmt()
100 var->blue.offset = 0; var->blue.length = 5; in set_pix_fmt()
101 var->transp.offset = 0; var->transp.length = 0; in set_pix_fmt()
104 var->bits_per_pixel = 16; in set_pix_fmt()
105 var->red.offset = 0; var->red.length = 5; in set_pix_fmt()
106 var->green.offset = 5; var->green.length = 6; in set_pix_fmt()
107 var->blue.offset = 11; var->blue.length = 5; in set_pix_fmt()
108 var->transp.offset = 0; var->transp.length = 0; in set_pix_fmt()
111 var->bits_per_pixel = 16; in set_pix_fmt()
112 var->red.offset = 10; var->red.length = 5; in set_pix_fmt()
113 var->green.offset = 5; var->green.length = 5; in set_pix_fmt()
114 var->blue.offset = 0; var->blue.length = 5; in set_pix_fmt()
115 var->transp.offset = 15; var->transp.length = 1; in set_pix_fmt()
118 var->bits_per_pixel = 16; in set_pix_fmt()
119 var->red.offset = 0; var->red.length = 5; in set_pix_fmt()
120 var->green.offset = 5; var->green.length = 5; in set_pix_fmt()
121 var->blue.offset = 10; var->blue.length = 5; in set_pix_fmt()
122 var->transp.offset = 15; var->transp.length = 1; in set_pix_fmt()
125 var->bits_per_pixel = 24; in set_pix_fmt()
126 var->red.offset = 16; var->red.length = 8; in set_pix_fmt()
127 var->green.offset = 8; var->green.length = 8; in set_pix_fmt()
128 var->blue.offset = 0; var->blue.length = 8; in set_pix_fmt()
129 var->transp.offset = 0; var->transp.length = 0; in set_pix_fmt()
132 var->bits_per_pixel = 24; in set_pix_fmt()
133 var->red.offset = 0; var->red.length = 8; in set_pix_fmt()
134 var->green.offset = 8; var->green.length = 8; in set_pix_fmt()
135 var->blue.offset = 16; var->blue.length = 8; in set_pix_fmt()
136 var->transp.offset = 0; var->transp.length = 0; in set_pix_fmt()
139 var->bits_per_pixel = 32; in set_pix_fmt()
140 var->red.offset = 16; var->red.length = 8; in set_pix_fmt()
141 var->green.offset = 8; var->green.length = 8; in set_pix_fmt()
142 var->blue.offset = 0; var->blue.length = 8; in set_pix_fmt()
143 var->transp.offset = 24; var->transp.length = 8; in set_pix_fmt()
146 var->bits_per_pixel = 32; in set_pix_fmt()
147 var->red.offset = 0; var->red.length = 8; in set_pix_fmt()
148 var->green.offset = 8; var->green.length = 8; in set_pix_fmt()
149 var->blue.offset = 16; var->blue.length = 8; in set_pix_fmt()
150 var->transp.offset = 24; var->transp.length = 8; in set_pix_fmt()
153 var->bits_per_pixel = 8; in set_pix_fmt()
154 var->red.offset = 0; var->red.length = 8; in set_pix_fmt()
155 var->green.offset = 0; var->green.length = 8; in set_pix_fmt()
156 var->blue.offset = 0; var->blue.length = 8; in set_pix_fmt()
157 var->transp.offset = 0; var->transp.length = 0; in set_pix_fmt()
162 static void set_mode(struct pxa168fb_info *fbi, struct fb_var_screeninfo *var, in set_mode() argument
167 set_pix_fmt(var, pix_fmt); in set_mode()
169 var->xres = mode->xres; in set_mode()
170 var->yres = mode->yres; in set_mode()
171 var->xres_virtual = max(var->xres, var->xres_virtual); in set_mode()
173 var->yres_virtual = info->fix.smem_len / in set_mode()
174 (var->xres_virtual * (var->bits_per_pixel >> 3)); in set_mode()
176 var->yres_virtual = max(var->yres, var->yres_virtual); in set_mode()
177 var->grayscale = 0; in set_mode()
178 var->accel_flags = FB_ACCEL_NONE; in set_mode()
179 var->pixclock = mode->pixclock; in set_mode()
180 var->left_margin = mode->left_margin; in set_mode()
181 var->right_margin = mode->right_margin; in set_mode()
182 var->upper_margin = mode->upper_margin; in set_mode()
183 var->lower_margin = mode->lower_margin; in set_mode()
184 var->hsync_len = mode->hsync_len; in set_mode()
185 var->vsync_len = mode->vsync_len; in set_mode()
186 var->sync = mode->sync; in set_mode()
187 var->vmode = FB_VMODE_NONINTERLACED; in set_mode()
188 var->rotate = FB_ROTATE_UR; in set_mode()
191 static int pxa168fb_check_var(struct fb_var_screeninfo *var, in pxa168fb_check_var() argument
200 pix_fmt = determine_best_pix_fmt(var); in pxa168fb_check_var()
203 set_pix_fmt(var, pix_fmt); in pxa168fb_check_var()
209 if (var->xoffset + var->xres > var->xres_virtual) in pxa168fb_check_var()
211 if (var->yoffset + var->yres > var->yres_virtual) in pxa168fb_check_var()
213 if (var->xres + var->right_margin + in pxa168fb_check_var()
214 var->hsync_len + var->left_margin > 2048) in pxa168fb_check_var()
216 if (var->yres + var->lower_margin + in pxa168fb_check_var()
217 var->vsync_len + var->upper_margin > 2048) in pxa168fb_check_var()
223 if (var->xres_virtual * var->yres_virtual * in pxa168fb_check_var()
224 (var->bits_per_pixel >> 3) > info->fix.smem_len) in pxa168fb_check_var()
350 struct fb_var_screeninfo *var = &info->var; in set_graphics_start() local
354 pixel_offset = (yoffset * var->xres_virtual) + xoffset; in set_graphics_start()
356 addr = fbi->fb_start_dma + (pixel_offset * (var->bits_per_pixel >> 3)); in set_graphics_start()
376 x |= (info->var.sync & FB_SYNC_COMP_HIGH_ACT) ? 0x00000020 : 0; in set_dumb_panel_control()
378 x |= (info->var.sync & FB_SYNC_VERT_HIGH_ACT) ? 0 : 0x00000008; in set_dumb_panel_control()
379 x |= (info->var.sync & FB_SYNC_HOR_HIGH_ACT) ? 0 : 0x00000004; in set_dumb_panel_control()
388 struct fb_var_screeninfo *v = &info->var; in set_dumb_screen_dimensions()
401 struct fb_var_screeninfo *var = &info->var; in pxa168fb_set_par() local
412 info->fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; in pxa168fb_set_par()
413 info->fix.ypanstep = var->yres; in pxa168fb_set_par()
424 writel((var->yres << 16) | var->xres, in pxa168fb_set_par()
430 fb_var_to_videomode(&mode, &info->var); in pxa168fb_set_par()
437 set_dma_control1(fbi, info->var.sync); in pxa168fb_set_par()
443 x = (x & ~0xFFFF) | ((var->xres_virtual * var->bits_per_pixel) >> 3); in pxa168fb_set_par()
445 writel((var->yres << 16) | var->xres, in pxa168fb_set_par()
447 writel((var->yres << 16) | var->xres, in pxa168fb_set_par()
456 writel((var->left_margin << 16) | var->right_margin, in pxa168fb_set_par()
458 writel((var->upper_margin << 16) | var->lower_margin, in pxa168fb_set_par()
491 if (info->var.grayscale) in pxa168fb_setcolreg()
496 val = chan_to_field(red, &info->var.red); in pxa168fb_setcolreg()
497 val |= chan_to_field(green, &info->var.green); in pxa168fb_setcolreg()
498 val |= chan_to_field(blue , &info->var.blue); in pxa168fb_setcolreg()
521 static int pxa168fb_pan_display(struct fb_var_screeninfo *var, in pxa168fb_pan_display() argument
524 set_graphics_start(info, var->xoffset, var->yoffset); in pxa168fb_pan_display()
558 struct fb_var_screeninfo *var = &info->var; in pxa168fb_init_mode() local
569 m = fb_find_best_mode(&info->var, &info->modelist); in pxa168fb_init_mode()
571 fb_videomode_to_var(&info->var, m); in pxa168fb_init_mode()
574 var->xres_virtual = var->xres; in pxa168fb_init_mode()
575 var->yres_virtual = info->fix.smem_len / in pxa168fb_init_mode()
576 (var->xres_virtual * (var->bits_per_pixel >> 3)); in pxa168fb_init_mode()
578 var->xres, var->yres); in pxa168fb_init_mode()
581 total_w = var->xres + var->left_margin + var->right_margin + in pxa168fb_init_mode()
582 var->hsync_len; in pxa168fb_init_mode()
583 total_h = var->yres + var->upper_margin + var->lower_margin + in pxa168fb_init_mode()
584 var->vsync_len; in pxa168fb_init_mode()
588 var->pixclock = (u32)div_result; in pxa168fb_init_mode()
681 set_mode(fbi, &info->var, mi->modes, mi->pix_fmt, 1); in pxa168fb_probe()
693 ret = pxa168fb_check_var(&info->var, info); in pxa168fb_probe()