Lines Matching full:var
293 struct fb_var_screeninfo *var) in atmel_lcdfb_update_dma() argument
299 dma_addr = (fix->smem_start + var->yoffset * fix->line_length in atmel_lcdfb_update_dma()
300 + var->xoffset * info->var.bits_per_pixel / 8); in atmel_lcdfb_update_dma()
326 struct fb_var_screeninfo *var = &info->var; in atmel_lcdfb_alloc_video_memory() local
329 smem_len = (var->xres_virtual * var->yres_virtual in atmel_lcdfb_alloc_video_memory()
330 * ((var->bits_per_pixel + 7) / 8)); in atmel_lcdfb_alloc_video_memory()
346 static const struct fb_videomode *atmel_lcdfb_choose_mode(struct fb_var_screeninfo *var, in atmel_lcdfb_choose_mode() argument
352 fb_var_to_videomode(&varfbmode, var); in atmel_lcdfb_choose_mode()
355 fb_videomode_to_var(var, fbmode); in atmel_lcdfb_choose_mode()
361 * atmel_lcdfb_check_var - Validates a var passed in.
362 * @var: frame buffer variable screen structure
366 * var passed in. This function does not alter the hardware
368 * struct atmel_lcdfb_info do not change. This includes the var
372 * this. If the var passed in is slightly off by what the
373 * hardware can support then we alter the var PASSED in to what
378 * needed. In this case the driver would just provide a var that
383 static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, in atmel_lcdfb_check_var() argument
395 if (!(var->pixclock && var->bits_per_pixel)) { in atmel_lcdfb_check_var()
397 if (!atmel_lcdfb_choose_mode(var, info)) { in atmel_lcdfb_check_var()
403 dev_dbg(dev, " resolution: %ux%u\n", var->xres, var->yres); in atmel_lcdfb_check_var()
404 dev_dbg(dev, " pixclk: %lu KHz\n", PICOS2KHZ(var->pixclock)); in atmel_lcdfb_check_var()
405 dev_dbg(dev, " bpp: %u\n", var->bits_per_pixel); in atmel_lcdfb_check_var()
408 if (PICOS2KHZ(var->pixclock) > clk_value_khz) { in atmel_lcdfb_check_var()
409 dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock)); in atmel_lcdfb_check_var()
414 if (var->xres > var->xres_virtual) in atmel_lcdfb_check_var()
415 var->xres_virtual = var->xres; in atmel_lcdfb_check_var()
417 if (var->yres > var->yres_virtual) in atmel_lcdfb_check_var()
418 var->yres_virtual = var->yres; in atmel_lcdfb_check_var()
421 var->xres = (var->xres + 3) & ~3UL; in atmel_lcdfb_check_var()
422 var->xres_virtual = (var->xres_virtual + 3) & ~3UL; in atmel_lcdfb_check_var()
424 var->red.msb_right = var->green.msb_right = var->blue.msb_right = 0; in atmel_lcdfb_check_var()
425 var->transp.msb_right = 0; in atmel_lcdfb_check_var()
426 var->transp.offset = var->transp.length = 0; in atmel_lcdfb_check_var()
427 var->xoffset = var->yoffset = 0; in atmel_lcdfb_check_var()
430 unsigned int smem_len = (var->xres_virtual * var->yres_virtual in atmel_lcdfb_check_var()
431 * ((var->bits_per_pixel + 7) / 8)); in atmel_lcdfb_check_var()
440 var->vsync_len = min_t(u32, var->vsync_len, in atmel_lcdfb_check_var()
442 var->upper_margin = min_t(u32, var->upper_margin, in atmel_lcdfb_check_var()
444 var->lower_margin = min_t(u32, var->lower_margin, in atmel_lcdfb_check_var()
446 var->right_margin = min_t(u32, var->right_margin, in atmel_lcdfb_check_var()
448 var->hsync_len = min_t(u32, var->hsync_len, in atmel_lcdfb_check_var()
450 var->left_margin = min_t(u32, var->left_margin, in atmel_lcdfb_check_var()
454 var->vsync_len = max_t(u32, var->vsync_len, 1); in atmel_lcdfb_check_var()
455 var->right_margin = max_t(u32, var->right_margin, 1); in atmel_lcdfb_check_var()
456 var->hsync_len = max_t(u32, var->hsync_len, 1); in atmel_lcdfb_check_var()
457 var->left_margin = max_t(u32, var->left_margin, 1); in atmel_lcdfb_check_var()
459 switch (var->bits_per_pixel) { in atmel_lcdfb_check_var()
464 var->red.offset = var->green.offset = var->blue.offset = 0; in atmel_lcdfb_check_var()
465 var->red.length = var->green.length = var->blue.length in atmel_lcdfb_check_var()
466 = var->bits_per_pixel; in atmel_lcdfb_check_var()
471 var->green.length = 5; in atmel_lcdfb_check_var()
473 var->green.length = 6; in atmel_lcdfb_check_var()
477 var->red.offset = var->green.length + 5; in atmel_lcdfb_check_var()
478 var->blue.offset = 0; in atmel_lcdfb_check_var()
481 var->red.offset = 0; in atmel_lcdfb_check_var()
482 var->blue.offset = var->green.length + 5; in atmel_lcdfb_check_var()
484 var->green.offset = 5; in atmel_lcdfb_check_var()
485 var->red.length = var->blue.length = 5; in atmel_lcdfb_check_var()
488 var->transp.offset = 24; in atmel_lcdfb_check_var()
489 var->transp.length = 8; in atmel_lcdfb_check_var()
494 var->red.offset = 16; in atmel_lcdfb_check_var()
495 var->blue.offset = 0; in atmel_lcdfb_check_var()
498 var->red.offset = 0; in atmel_lcdfb_check_var()
499 var->blue.offset = 16; in atmel_lcdfb_check_var()
501 var->green.offset = 8; in atmel_lcdfb_check_var()
502 var->red.length = var->green.length = var->blue.length = 8; in atmel_lcdfb_check_var()
506 var->bits_per_pixel); in atmel_lcdfb_check_var()
531 * not alter var in fb_info since we are using that data. This
532 * means we depend on the data in var inside fb_info to be
552 info->var.xres, info->var.yres, in atmel_lcdfb_set_par()
553 info->var.xres_virtual, info->var.yres_virtual); in atmel_lcdfb_set_par()
557 if (info->var.bits_per_pixel == 1) in atmel_lcdfb_set_par()
559 else if (info->var.bits_per_pixel <= 8) in atmel_lcdfb_set_par()
564 bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel; in atmel_lcdfb_set_par()
569 atmel_lcdfb_update_dma(info, &info->var); in atmel_lcdfb_set_par()
572 value = (info->var.yres * info->var.xres * info->var.bits_per_pixel) / 32; in atmel_lcdfb_set_par()
584 value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock)); in atmel_lcdfb_set_par()
595 info->var.pixclock = in atmel_lcdfb_set_par()
598 PICOS2KHZ(info->var.pixclock)); in atmel_lcdfb_set_par()
605 if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) in atmel_lcdfb_set_par()
607 if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) in atmel_lcdfb_set_par()
610 switch (info->var.bits_per_pixel) { in atmel_lcdfb_set_par()
625 value = (info->var.vsync_len - 1) << ATMEL_LCDC_VPW_OFFSET; in atmel_lcdfb_set_par()
626 value |= info->var.upper_margin << ATMEL_LCDC_VBP_OFFSET; in atmel_lcdfb_set_par()
627 value |= info->var.lower_margin; in atmel_lcdfb_set_par()
632 value = (info->var.right_margin - 1) << ATMEL_LCDC_HFP_OFFSET; in atmel_lcdfb_set_par()
633 value |= (info->var.hsync_len - 1) << ATMEL_LCDC_HPW_OFFSET; in atmel_lcdfb_set_par()
634 value |= (info->var.left_margin - 1); in atmel_lcdfb_set_par()
639 hozval_linesz = compute_hozval(sinfo, info->var.xres); in atmel_lcdfb_set_par()
643 value |= info->var.yres - 1; in atmel_lcdfb_set_par()
712 if (info->var.grayscale) in atmel_lcdfb_setcolreg()
721 val = chan_to_field(red, &info->var.red); in atmel_lcdfb_setcolreg()
722 val |= chan_to_field(green, &info->var.green); in atmel_lcdfb_setcolreg()
723 val |= chan_to_field(blue, &info->var.blue); in atmel_lcdfb_setcolreg()
773 static int atmel_lcdfb_pan_display(struct fb_var_screeninfo *var, in atmel_lcdfb_pan_display() argument
778 atmel_lcdfb_update_dma(info, var); in atmel_lcdfb_pan_display()
848 info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; in atmel_lcdfb_init_fbinfo()
921 struct fb_var_screeninfo *var = &info->var; in atmel_lcdfb_of_init() local
942 ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel); in atmel_lcdfb_of_init()
1082 fb_videomode_to_var(&info->var, &modelist->mode); in atmel_lcdfb_probe()
1084 atmel_lcdfb_check_var(&info->var, info); in atmel_lcdfb_probe()