Lines Matching refs:fbi

237 	struct fb_info		*fbi;  member
363 static void sdc_fb_init(struct mx3fb_info *fbi) in sdc_fb_init() argument
365 struct mx3fb_data *mx3fb = fbi->mx3fb; in sdc_fb_init()
374 static uint32_t sdc_fb_uninit(struct mx3fb_info *fbi) in sdc_fb_uninit() argument
376 struct mx3fb_data *mx3fb = fbi->mx3fb; in sdc_fb_uninit()
727 static int mx3fb_blank(int blank, struct fb_info *fbi);
728 static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len,
730 static int mx3fb_unmap_video_memory(struct fb_info *fbi);
737 static int mx3fb_set_fix(struct fb_info *fbi) in mx3fb_set_fix() argument
739 struct fb_fix_screeninfo *fix = &fbi->fix; in mx3fb_set_fix()
740 struct fb_var_screeninfo *var = &fbi->var; in mx3fb_set_fix()
761 struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; in mx3fb_dma_done()
771 static bool mx3fb_must_set_par(struct fb_info *fbi) in mx3fb_must_set_par() argument
773 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_must_set_par()
775 struct fb_var_screeninfo new_var = fbi->var; in mx3fb_must_set_par()
777 if ((fbi->var.activate & FB_ACTIVATE_FORCE) && in mx3fb_must_set_par()
778 (fbi->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) in mx3fb_must_set_par()
791 static int __set_par(struct fb_info *fbi, bool lock) in __set_par() argument
796 struct mx3fb_info *mx3_fbi = fbi->par; in __set_par()
806 mx3fb_set_fix(fbi); in __set_par()
808 mem_len = fbi->var.yres_virtual * fbi->fix.line_length; in __set_par()
809 if (mem_len > fbi->fix.smem_len) { in __set_par()
810 if (fbi->fix.smem_start) in __set_par()
811 mx3fb_unmap_video_memory(fbi); in __set_par()
813 if (mx3fb_map_video_memory(fbi, mem_len, lock) < 0) in __set_par()
820 sg_dma_address(&sg[0]) = fbi->fix.smem_start; in __set_par()
821 sg_set_page(&sg[0], virt_to_page(fbi->screen_base), in __set_par()
822 fbi->fix.smem_len, in __set_par()
823 offset_in_page(fbi->screen_base)); in __set_par()
827 if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT) in __set_par()
829 if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT) in __set_par()
831 if (fbi->var.sync & FB_SYNC_CLK_INVERT) in __set_par()
833 if (fbi->var.sync & FB_SYNC_DATA_INVERT) in __set_par()
835 if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH) in __set_par()
837 if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN) in __set_par()
839 if (fbi->var.sync & FB_SYNC_CLK_SEL_EN) in __set_par()
841 if (fbi->var.sync & FB_SYNC_SHARP_MODE) in __set_par()
844 dev_dbg(fbi->device, "pixclock = %u Hz\n", in __set_par()
845 (u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL)); in __set_par()
848 (PICOS2KHZ(fbi->var.pixclock)) * 1000UL, in __set_par()
849 fbi->var.xres, fbi->var.yres, in __set_par()
850 fbi->var.left_margin, in __set_par()
851 fbi->var.hsync_len, in __set_par()
852 fbi->var.right_margin + in __set_par()
853 fbi->var.hsync_len, in __set_par()
854 fbi->var.upper_margin, in __set_par()
855 fbi->var.vsync_len, in __set_par()
856 fbi->var.lower_margin + in __set_par()
857 fbi->var.vsync_len, &sig_cfg) != 0) { in __set_par()
858 dev_err(fbi->device, in __set_par()
868 video->out_pixel_fmt = bpp_to_pixfmt(fbi->var.bits_per_pixel); in __set_par()
869 video->out_width = fbi->var.xres; in __set_par()
870 video->out_height = fbi->var.yres; in __set_par()
871 video->out_stride = fbi->var.xres_virtual; in __set_par()
889 mx3_fbi->cur_var = fbi->var; in __set_par()
901 static int mx3fb_set_par(struct fb_info *fbi) in mx3fb_set_par() argument
903 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_set_par()
912 ret = mx3fb_must_set_par(fbi) ? __set_par(fbi, true) : 0; in mx3fb_set_par()
924 static int mx3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi) in mx3fb_check_var() argument
926 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_check_var()
930 dev_dbg(fbi->device, "%s\n", __func__); in mx3fb_check_var()
1002 dev_dbg(fbi->device, "pixclock set for 60Hz refresh = %u ps\n", in mx3fb_check_var()
1026 unsigned int trans, struct fb_info *fbi) in mx3fb_setcolreg() argument
1028 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_setcolreg()
1032 dev_dbg(fbi->device, "%s, regno = %u\n", __func__, regno); in mx3fb_setcolreg()
1039 if (fbi->var.grayscale) in mx3fb_setcolreg()
1042 switch (fbi->fix.visual) { in mx3fb_setcolreg()
1049 u32 *pal = fbi->pseudo_palette; in mx3fb_setcolreg()
1051 val = chan_to_field(red, &fbi->var.red); in mx3fb_setcolreg()
1052 val |= chan_to_field(green, &fbi->var.green); in mx3fb_setcolreg()
1053 val |= chan_to_field(blue, &fbi->var.blue); in mx3fb_setcolreg()
1070 static void __blank(int blank, struct fb_info *fbi) in __blank() argument
1072 struct mx3fb_info *mx3_fbi = fbi->par; in __blank()
1093 memset((char *)fbi->screen_base, 0, fbi->fix.smem_len); in __blank()
1110 static int mx3fb_blank(int blank, struct fb_info *fbi) in mx3fb_blank() argument
1112 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_blank()
1114 dev_dbg(fbi->device, "%s, blank = %d, base %p, len %u\n", __func__, in mx3fb_blank()
1115 blank, fbi->screen_base, fbi->fix.smem_len); in mx3fb_blank()
1121 __blank(blank, fbi); in mx3fb_blank()
1135 struct fb_info *fbi) in mx3fb_pan_display() argument
1137 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_pan_display()
1147 dev_dbg(fbi->device, "%s [%c]\n", __func__, in mx3fb_pan_display()
1151 dev_dbg(fbi->device, "x panning not supported\n"); in mx3fb_pan_display()
1162 y_bottom += fbi->var.yres; in mx3fb_pan_display()
1164 if (y_bottom > fbi->var.yres_virtual) in mx3fb_pan_display()
1169 offset = var->yoffset * fbi->fix.line_length in mx3fb_pan_display()
1170 + var->xoffset * (fbi->var.bits_per_pixel / 8); in mx3fb_pan_display()
1171 base = fbi->fix.smem_start + offset; in mx3fb_pan_display()
1173 dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n", in mx3fb_pan_display()
1187 dev_info(fbi->device, "Panning failed due to %s\n", ret < 0 ? in mx3fb_pan_display()
1197 virt_to_page(fbi->screen_base + offset), fbi->fix.smem_len, in mx3fb_pan_display()
1198 offset_in_page(fbi->screen_base + offset)); in mx3fb_pan_display()
1206 dev_err(fbi->device, in mx3fb_pan_display()
1220 dev_dbg(fbi->device, "%d: Submit %p #%d\n", __LINE__, txd, cookie); in mx3fb_pan_display()
1222 dev_err(fbi->device, in mx3fb_pan_display()
1231 fbi->var.xoffset = var->xoffset; in mx3fb_pan_display()
1232 fbi->var.yoffset = var->yoffset; in mx3fb_pan_display()
1235 fbi->var.vmode |= FB_VMODE_YWRAP; in mx3fb_pan_display()
1237 fbi->var.vmode &= ~FB_VMODE_YWRAP; in mx3fb_pan_display()
1239 mx3_fbi->cur_var = fbi->var; in mx3fb_pan_display()
1243 dev_dbg(fbi->device, "Update complete\n"); in mx3fb_pan_display()
1277 struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; in mx3fb_suspend()
1280 fb_set_suspend(mx3fb->fbi, 1); in mx3fb_suspend()
1297 struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; in mx3fb_resume()
1305 fb_set_suspend(mx3fb->fbi, 0); in mx3fb_resume()
1331 static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len, in mx3fb_map_video_memory() argument
1337 fbi->screen_base = dma_alloc_wc(fbi->device, mem_len, &addr, in mx3fb_map_video_memory()
1340 if (!fbi->screen_base) { in mx3fb_map_video_memory()
1341 dev_err(fbi->device, "Cannot allocate %u bytes framebuffer memory\n", in mx3fb_map_video_memory()
1348 mutex_lock(&fbi->mm_lock); in mx3fb_map_video_memory()
1349 fbi->fix.smem_start = addr; in mx3fb_map_video_memory()
1350 fbi->fix.smem_len = mem_len; in mx3fb_map_video_memory()
1352 mutex_unlock(&fbi->mm_lock); in mx3fb_map_video_memory()
1354 dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n", in mx3fb_map_video_memory()
1355 (uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len); in mx3fb_map_video_memory()
1357 fbi->screen_size = fbi->fix.smem_len; in mx3fb_map_video_memory()
1360 memset((char *)fbi->screen_base, 0, fbi->fix.smem_len); in mx3fb_map_video_memory()
1365 fbi->fix.smem_len = 0; in mx3fb_map_video_memory()
1366 fbi->fix.smem_start = 0; in mx3fb_map_video_memory()
1367 fbi->screen_base = NULL; in mx3fb_map_video_memory()
1376 static int mx3fb_unmap_video_memory(struct fb_info *fbi) in mx3fb_unmap_video_memory() argument
1378 dma_free_wc(fbi->device, fbi->fix.smem_len, fbi->screen_base, in mx3fb_unmap_video_memory()
1379 fbi->fix.smem_start); in mx3fb_unmap_video_memory()
1381 fbi->screen_base = NULL; in mx3fb_unmap_video_memory()
1382 mutex_lock(&fbi->mm_lock); in mx3fb_unmap_video_memory()
1383 fbi->fix.smem_start = 0; in mx3fb_unmap_video_memory()
1384 fbi->fix.smem_len = 0; in mx3fb_unmap_video_memory()
1385 mutex_unlock(&fbi->mm_lock); in mx3fb_unmap_video_memory()
1398 struct fb_info *fbi; in mx3fb_init_fbinfo() local
1403 fbi = framebuffer_alloc(sizeof(struct mx3fb_info), dev); in mx3fb_init_fbinfo()
1404 if (!fbi) in mx3fb_init_fbinfo()
1407 mx3fbi = fbi->par; in mx3fb_init_fbinfo()
1411 fbi->var.activate = FB_ACTIVATE_NOW; in mx3fb_init_fbinfo()
1413 fbi->fbops = ops; in mx3fb_init_fbinfo()
1414 fbi->flags = FBINFO_FLAG_DEFAULT; in mx3fb_init_fbinfo()
1415 fbi->pseudo_palette = mx3fbi->pseudo_palette; in mx3fb_init_fbinfo()
1420 ret = fb_alloc_cmap(&fbi->cmap, 16, 0); in mx3fb_init_fbinfo()
1422 framebuffer_release(fbi); in mx3fb_init_fbinfo()
1426 return fbi; in mx3fb_init_fbinfo()
1434 struct fb_info *fbi; in init_fb_chan() local
1450 fbi = mx3fb_init_fbinfo(dev, &mx3fb_ops); in init_fb_chan()
1451 if (!fbi) in init_fb_chan()
1470 if (!fb_find_mode(&fbi->var, fbi, fb_mode, mode, in init_fb_chan()
1476 fb_videomode_to_modelist(mode, num_modes, &fbi->modelist); in init_fb_chan()
1479 fbi->var.yres_virtual = fbi->var.yres * 2; in init_fb_chan()
1481 mx3fb->fbi = fbi; in init_fb_chan()
1491 mx3fbi = fbi->par; in init_fb_chan()
1502 ret = __set_par(fbi, false); in init_fb_chan()
1506 __blank(FB_BLANK_UNBLANK, fbi); in init_fb_chan()
1510 ret = register_framebuffer(fbi); in init_fb_chan()
1519 fb_dealloc_cmap(&fbi->cmap); in init_fb_chan()
1520 framebuffer_release(fbi); in init_fb_chan()
1544 static void release_fbi(struct fb_info *fbi) in release_fbi() argument
1546 mx3fb_unmap_video_memory(fbi); in release_fbi()
1548 fb_dealloc_cmap(&fbi->cmap); in release_fbi()
1550 unregister_framebuffer(fbi); in release_fbi()
1551 framebuffer_release(fbi); in release_fbi()
1627 struct fb_info *fbi = mx3fb->fbi; in mx3fb_remove() local
1628 struct mx3fb_info *mx3_fbi = fbi->par; in mx3fb_remove()
1632 release_fbi(fbi); in mx3fb_remove()