Lines Matching +full:burst +full:- +full:length

12 #include <linux/dma-mapping.h>
36 #define OCFB_CTRL_PC 0x00000800 /* 8-bit Pseudo Color Enable*/
41 #define OCFB_CTRL_VBL1 0x00000000 /* Burst Length 1 */
42 #define OCFB_CTRL_VBL2 0x00000080 /* Burst Length 2 */
43 #define OCFB_CTRL_VBL4 0x00000100 /* Burst Length 4 */
44 #define OCFB_CTRL_VBL8 0x00000180 /* Burst Length 8 */
89 if (fbdev->little_endian) in ocfb_readreg()
90 return ioread32(fbdev->regs + offset); in ocfb_readreg()
92 return ioread32be(fbdev->regs + offset); in ocfb_readreg()
97 if (fbdev->little_endian) in ocfb_writereg()
98 iowrite32(data, fbdev->regs + offset); in ocfb_writereg()
100 iowrite32be(data, fbdev->regs + offset); in ocfb_writereg()
106 struct fb_var_screeninfo *var = &fbdev->info.var; in ocfb_setupfb()
107 struct device *dev = fbdev->info.device; in ocfb_setupfb()
115 fbdev->little_endian = 0; in ocfb_setupfb()
116 ocfb_writereg(fbdev, OCFB_VBARA, fbdev->fb_phys); in ocfb_setupfb()
119 if (ocfb_readreg(fbdev, OCFB_VBARA) != fbdev->fb_phys) { in ocfb_setupfb()
120 fbdev->little_endian = 1; in ocfb_setupfb()
121 ocfb_writereg(fbdev, OCFB_VBARA, fbdev->fb_phys); in ocfb_setupfb()
125 ocfb_writereg(fbdev, OCFB_HTIM, (var->hsync_len - 1) << 24 | in ocfb_setupfb()
126 (var->left_margin - 1) << 16 | (var->xres - 1)); in ocfb_setupfb()
129 ocfb_writereg(fbdev, OCFB_VTIM, (var->vsync_len - 1) << 24 | in ocfb_setupfb()
130 (var->upper_margin - 1) << 16 | (var->yres - 1)); in ocfb_setupfb()
132 /* Total length of frame */ in ocfb_setupfb()
133 hlen = var->left_margin + var->right_margin + var->hsync_len + in ocfb_setupfb()
134 var->xres; in ocfb_setupfb()
136 vlen = var->upper_margin + var->lower_margin + var->vsync_len + in ocfb_setupfb()
137 var->yres; in ocfb_setupfb()
139 ocfb_writereg(fbdev, OCFB_HVLEN, (hlen - 1) << 16 | (vlen - 1)); in ocfb_setupfb()
142 switch (var->bits_per_pixel) { in ocfb_setupfb()
144 if (!var->grayscale) in ocfb_setupfb()
165 /* maximum (8) VBL (video memory burst length) */ in ocfb_setupfb()
178 struct ocfb_dev *fbdev = (struct ocfb_dev *)info->par; in ocfb_setcolreg()
181 if (regno >= info->cmap.len) { in ocfb_setcolreg()
182 dev_err(info->device, "regno >= cmap.len\n"); in ocfb_setcolreg()
186 if (info->var.grayscale) { in ocfb_setcolreg()
191 red >>= (16 - info->var.red.length); in ocfb_setcolreg()
192 green >>= (16 - info->var.green.length); in ocfb_setcolreg()
193 blue >>= (16 - info->var.blue.length); in ocfb_setcolreg()
194 transp >>= (16 - info->var.transp.length); in ocfb_setcolreg()
196 if (info->var.bits_per_pixel == 8 && !info->var.grayscale) { in ocfb_setcolreg()
201 ((u32 *)(info->pseudo_palette))[regno] = in ocfb_setcolreg()
202 (red << info->var.red.offset) | in ocfb_setcolreg()
203 (green << info->var.green.offset) | in ocfb_setcolreg()
204 (blue << info->var.blue.offset) | in ocfb_setcolreg()
205 (transp << info->var.transp.offset); in ocfb_setcolreg()
213 struct fb_var_screeninfo *var = &fbdev->info.var; in ocfb_init_fix()
214 struct fb_fix_screeninfo *fix = &fbdev->info.fix; in ocfb_init_fix()
216 strcpy(fix->id, OCFB_NAME); in ocfb_init_fix()
218 fix->line_length = var->xres * var->bits_per_pixel/8; in ocfb_init_fix()
219 fix->smem_len = fix->line_length * var->yres; in ocfb_init_fix()
220 fix->type = FB_TYPE_PACKED_PIXELS; in ocfb_init_fix()
222 if (var->bits_per_pixel == 8 && !var->grayscale) in ocfb_init_fix()
223 fix->visual = FB_VISUAL_PSEUDOCOLOR; in ocfb_init_fix()
225 fix->visual = FB_VISUAL_TRUECOLOR; in ocfb_init_fix()
232 struct fb_var_screeninfo *var = &fbdev->info.var; in ocfb_init_var()
234 var->accel_flags = FB_ACCEL_NONE; in ocfb_init_var()
235 var->activate = FB_ACTIVATE_NOW; in ocfb_init_var()
236 var->xres_virtual = var->xres; in ocfb_init_var()
237 var->yres_virtual = var->yres; in ocfb_init_var()
239 switch (var->bits_per_pixel) { in ocfb_init_var()
241 var->transp.offset = 0; in ocfb_init_var()
242 var->transp.length = 0; in ocfb_init_var()
243 var->red.offset = 0; in ocfb_init_var()
244 var->red.length = 8; in ocfb_init_var()
245 var->green.offset = 0; in ocfb_init_var()
246 var->green.length = 8; in ocfb_init_var()
247 var->blue.offset = 0; in ocfb_init_var()
248 var->blue.length = 8; in ocfb_init_var()
252 var->transp.offset = 0; in ocfb_init_var()
253 var->transp.length = 0; in ocfb_init_var()
254 var->red.offset = 11; in ocfb_init_var()
255 var->red.length = 5; in ocfb_init_var()
256 var->green.offset = 5; in ocfb_init_var()
257 var->green.length = 6; in ocfb_init_var()
258 var->blue.offset = 0; in ocfb_init_var()
259 var->blue.length = 5; in ocfb_init_var()
263 var->transp.offset = 0; in ocfb_init_var()
264 var->transp.length = 0; in ocfb_init_var()
265 var->red.offset = 16; in ocfb_init_var()
266 var->red.length = 8; in ocfb_init_var()
267 var->green.offset = 8; in ocfb_init_var()
268 var->green.length = 8; in ocfb_init_var()
269 var->blue.offset = 0; in ocfb_init_var()
270 var->blue.length = 8; in ocfb_init_var()
274 var->transp.offset = 24; in ocfb_init_var()
275 var->transp.length = 8; in ocfb_init_var()
276 var->red.offset = 16; in ocfb_init_var()
277 var->red.length = 8; in ocfb_init_var()
278 var->green.offset = 8; in ocfb_init_var()
279 var->green.length = 8; in ocfb_init_var()
280 var->blue.offset = 0; in ocfb_init_var()
281 var->blue.length = 8; in ocfb_init_var()
300 fbdev = devm_kzalloc(&pdev->dev, sizeof(*fbdev), GFP_KERNEL); in ocfb_probe()
302 return -ENOMEM; in ocfb_probe()
306 fbdev->info.fbops = &ocfb_ops; in ocfb_probe()
307 fbdev->info.device = &pdev->dev; in ocfb_probe()
308 fbdev->info.par = fbdev; in ocfb_probe()
311 if (!fb_find_mode(&fbdev->info.var, &fbdev->info, mode_option, in ocfb_probe()
313 dev_err(&pdev->dev, "No valid video modes found\n"); in ocfb_probe()
314 return -EINVAL; in ocfb_probe()
319 fbdev->regs = devm_platform_ioremap_resource(pdev, 0); in ocfb_probe()
320 if (IS_ERR(fbdev->regs)) in ocfb_probe()
321 return PTR_ERR(fbdev->regs); in ocfb_probe()
324 fbsize = fbdev->info.fix.smem_len; in ocfb_probe()
325 fbdev->fb_virt = dma_alloc_coherent(&pdev->dev, PAGE_ALIGN(fbsize), in ocfb_probe()
326 &fbdev->fb_phys, GFP_KERNEL); in ocfb_probe()
327 if (!fbdev->fb_virt) { in ocfb_probe()
328 dev_err(&pdev->dev, in ocfb_probe()
330 return -ENOMEM; in ocfb_probe()
332 fbdev->info.fix.smem_start = fbdev->fb_phys; in ocfb_probe()
333 fbdev->info.screen_base = fbdev->fb_virt; in ocfb_probe()
334 fbdev->info.pseudo_palette = fbdev->pseudo_palette; in ocfb_probe()
337 memset_io(fbdev->fb_virt, 0, fbsize); in ocfb_probe()
342 if (fbdev->little_endian) in ocfb_probe()
343 fbdev->info.flags |= FBINFO_FOREIGN_ENDIAN; in ocfb_probe()
346 ret = fb_alloc_cmap(&fbdev->info.cmap, PALETTE_SIZE, 0); in ocfb_probe()
348 dev_err(&pdev->dev, "Color map allocation failed\n"); in ocfb_probe()
353 ret = register_framebuffer(&fbdev->info); in ocfb_probe()
355 dev_err(&pdev->dev, "Framebuffer registration failed\n"); in ocfb_probe()
362 fb_dealloc_cmap(&fbdev->info.cmap); in ocfb_probe()
365 dma_free_coherent(&pdev->dev, PAGE_ALIGN(fbsize), fbdev->fb_virt, in ocfb_probe()
366 fbdev->fb_phys); in ocfb_probe()
375 unregister_framebuffer(&fbdev->info); in ocfb_remove()
376 fb_dealloc_cmap(&fbdev->info.cmap); in ocfb_remove()
377 dma_free_coherent(&pdev->dev, PAGE_ALIGN(fbdev->info.fix.smem_len), in ocfb_remove()
378 fbdev->fb_virt, fbdev->fb_phys); in ocfb_remove()
410 return -ENODEV; in ocfb_init()
428 MODULE_PARM_DESC(mode_option, "Video mode ('<xres>x<yres>[-<bpp>][@refresh]')");