Lines Matching +full:current +full:- +full:rotate

21  * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device
54 #include <linux/dma-mapping.h>
58 #include <asm/mach-au1x00/au1000.h>
97 .height = -1,
98 .width = -1,
116 fbdev->regs->lcd_control |= LCD_CONTROL_GO; in au1100fb_fb_blank()
124 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; in au1100fb_fb_blank()
140 struct fb_info *info = &fbdev->info; in au1100fb_setmode()
145 return -EINVAL; in au1100fb_setmode()
147 /* Update var-dependent FB info */ in au1100fb_setmode()
148 if (panel_is_active(fbdev->panel) || panel_is_color(fbdev->panel)) { in au1100fb_setmode()
149 if (info->var.bits_per_pixel <= 8) { in au1100fb_setmode()
151 info->var.red.offset = 0; in au1100fb_setmode()
152 info->var.red.length = info->var.bits_per_pixel; in au1100fb_setmode()
153 info->var.red.msb_right = 0; in au1100fb_setmode()
155 info->var.green.offset = 0; in au1100fb_setmode()
156 info->var.green.length = info->var.bits_per_pixel; in au1100fb_setmode()
157 info->var.green.msb_right = 0; in au1100fb_setmode()
159 info->var.blue.offset = 0; in au1100fb_setmode()
160 info->var.blue.length = info->var.bits_per_pixel; in au1100fb_setmode()
161 info->var.blue.msb_right = 0; in au1100fb_setmode()
163 info->var.transp.offset = 0; in au1100fb_setmode()
164 info->var.transp.length = 0; in au1100fb_setmode()
165 info->var.transp.msb_right = 0; in au1100fb_setmode()
167 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; in au1100fb_setmode()
168 info->fix.line_length = info->var.xres_virtual / in au1100fb_setmode()
169 (8/info->var.bits_per_pixel); in au1100fb_setmode()
171 /* non-palettized */ in au1100fb_setmode()
172 index = (fbdev->panel->control_base & LCD_CONTROL_SBPPF_MASK) >> LCD_CONTROL_SBPPF_BIT; in au1100fb_setmode()
173 info->var.red = rgb_bitfields[index][0]; in au1100fb_setmode()
174 info->var.green = rgb_bitfields[index][1]; in au1100fb_setmode()
175 info->var.blue = rgb_bitfields[index][2]; in au1100fb_setmode()
176 info->var.transp = rgb_bitfields[index][3]; in au1100fb_setmode()
178 info->fix.visual = FB_VISUAL_TRUECOLOR; in au1100fb_setmode()
179 info->fix.line_length = info->var.xres_virtual << 1; /* depth=16 */ in au1100fb_setmode()
183 info->fix.visual = FB_VISUAL_MONO10; in au1100fb_setmode()
184 info->fix.line_length = info->var.xres_virtual / 8; in au1100fb_setmode()
187 info->screen_size = info->fix.line_length * info->var.yres_virtual; in au1100fb_setmode()
188 info->var.rotate = ((fbdev->panel->control_base&LCD_CONTROL_SM_MASK) \ in au1100fb_setmode()
192 fbdev->regs->lcd_control = fbdev->panel->control_base; in au1100fb_setmode()
193 fbdev->regs->lcd_horztiming = fbdev->panel->horztiming; in au1100fb_setmode()
194 fbdev->regs->lcd_verttiming = fbdev->panel->verttiming; in au1100fb_setmode()
195 fbdev->regs->lcd_clkcontrol = fbdev->panel->clkcontrol_base; in au1100fb_setmode()
196 fbdev->regs->lcd_intenable = 0; in au1100fb_setmode()
197 fbdev->regs->lcd_intstatus = 0; in au1100fb_setmode()
198 fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(fbdev->fb_phys); in au1100fb_setmode()
200 if (panel_is_dual(fbdev->panel)) { in au1100fb_setmode()
203 if (info->var.yres_virtual >= (info->var.yres << 1)) { in au1100fb_setmode()
204 fbdev->regs->lcd_dmaaddr1 = LCD_DMA_SA_N(fbdev->fb_phys + in au1100fb_setmode()
205 (info->fix.line_length * in au1100fb_setmode()
206 (info->var.yres_virtual >> 1))); in au1100fb_setmode()
208 fbdev->regs->lcd_dmaaddr1 = LCD_DMA_SA_N(fbdev->fb_phys); in au1100fb_setmode()
212 words = info->fix.line_length / sizeof(u32); in au1100fb_setmode()
213 if (!info->var.rotate || (info->var.rotate == 180)) { in au1100fb_setmode()
214 words *= info->var.yres_virtual; in au1100fb_setmode()
215 if (info->var.rotate /* 180 */) { in au1100fb_setmode()
216 words -= (words % 8); /* should be divisable by 8 */ in au1100fb_setmode()
219 fbdev->regs->lcd_words = LCD_WRD_WRDS_N(words); in au1100fb_setmode()
221 fbdev->regs->lcd_pwmdiv = 0; in au1100fb_setmode()
222 fbdev->regs->lcd_pwmhi = 0; in au1100fb_setmode()
225 fbdev->regs->lcd_control |= LCD_CONTROL_GO; in au1100fb_setmode()
242 palette = fbdev->regs->lcd_palettebase; in au1100fb_fb_setcolreg()
244 if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1)) in au1100fb_fb_setcolreg()
245 return -EINVAL; in au1100fb_fb_setcolreg()
247 if (fbi->var.grayscale) { in au1100fb_fb_setcolreg()
253 if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) { in au1100fb_fb_setcolreg()
256 return -EINVAL; in au1100fb_fb_setcolreg()
258 palette = (u32*)fbi->pseudo_palette; in au1100fb_fb_setcolreg()
260 red >>= (16 - fbi->var.red.length); in au1100fb_fb_setcolreg()
261 green >>= (16 - fbi->var.green.length); in au1100fb_fb_setcolreg()
262 blue >>= (16 - fbi->var.blue.length); in au1100fb_fb_setcolreg()
264 value = (red << fbi->var.red.offset) | in au1100fb_fb_setcolreg()
265 (green << fbi->var.green.offset)| in au1100fb_fb_setcolreg()
266 (blue << fbi->var.blue.offset); in au1100fb_fb_setcolreg()
269 } else if (panel_is_active(fbdev->panel)) { in au1100fb_fb_setcolreg()
274 } else if (panel_is_color(fbdev->panel)) { in au1100fb_fb_setcolreg()
276 value = (((panel_swap_rgb(fbdev->panel) ? blue : red) >> 12) & 0x000F) | in au1100fb_fb_setcolreg()
278 (((panel_swap_rgb(fbdev->panel) ? red : blue) >> 4) & 0x0F00); in au1100fb_fb_setcolreg()
304 return -EINVAL; in au1100fb_fb_pan_display()
307 if (var->xoffset - fbi->var.xoffset) { in au1100fb_fb_pan_display()
309 return -EINVAL; in au1100fb_fb_pan_display()
313 dy = var->yoffset - fbi->var.yoffset; in au1100fb_fb_pan_display()
320 dmaaddr = fbdev->regs->lcd_dmaaddr0; in au1100fb_fb_pan_display()
321 dmaaddr += (fbi->fix.line_length * dy); in au1100fb_fb_pan_display()
323 /* TODO: Wait for current frame to finished */ in au1100fb_fb_pan_display()
324 fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); in au1100fb_fb_pan_display()
326 if (panel_is_dual(fbdev->panel)) { in au1100fb_fb_pan_display()
327 dmaaddr = fbdev->regs->lcd_dmaaddr1; in au1100fb_fb_pan_display()
328 dmaaddr += (fbi->fix.line_length * dy); in au1100fb_fb_pan_display()
329 fbdev->regs->lcd_dmaaddr0 = LCD_DMA_SA_N(dmaaddr); in au1100fb_fb_pan_display()
345 vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); in au1100fb_fb_mmap()
347 pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 in au1100fb_fb_mmap()
349 return dma_mmap_coherent(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys, in au1100fb_fb_mmap()
350 fbdev->fb_len); in au1100fb_fb_mmap()
364 /*-------------------------------------------------------------------------*/
373 return -ENODEV; in au1100fb_setup()
377 return -ENODEV; in au1100fb_setup()
379 return -ENODEV; in au1100fb_setup()
389 fbdev->panel = &known_lcd_panels[i]; in au1100fb_setup()
390 fbdev->panel_idx = i; in au1100fb_setup()
396 return -ENODEV; in au1100fb_setup()
404 print_info("Panel=%s", fbdev->panel->name); in au1100fb_setup()
416 fbdev = devm_kzalloc(&dev->dev, sizeof(*fbdev), GFP_KERNEL); in au1100fb_drv_probe()
418 return -ENOMEM; in au1100fb_drv_probe()
424 fbdev->dev = &dev->dev; in au1100fb_drv_probe()
430 return -EFAULT; in au1100fb_drv_probe()
433 au1100fb_fix.mmio_start = regs_res->start; in au1100fb_drv_probe()
436 if (!devm_request_mem_region(&dev->dev, in au1100fb_drv_probe()
442 return -EBUSY; in au1100fb_drv_probe()
445 fbdev->regs = (struct au1100fb_regs*)KSEG1ADDR(au1100fb_fix.mmio_start); in au1100fb_drv_probe()
447 print_dbg("Register memory map at %p", fbdev->regs); in au1100fb_drv_probe()
448 print_dbg("phys=0x%08x, size=%d", fbdev->regs_phys, fbdev->regs_len); in au1100fb_drv_probe()
452 fbdev->lcdclk = c; in au1100fb_drv_probe()
458 fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres * in au1100fb_drv_probe()
459 (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS; in au1100fb_drv_probe()
461 fbdev->fb_mem = dmam_alloc_coherent(&dev->dev, in au1100fb_drv_probe()
462 PAGE_ALIGN(fbdev->fb_len), in au1100fb_drv_probe()
463 &fbdev->fb_phys, GFP_KERNEL); in au1100fb_drv_probe()
464 if (!fbdev->fb_mem) { in au1100fb_drv_probe()
466 fbdev->fb_len / 1024); in au1100fb_drv_probe()
467 return -ENOMEM; in au1100fb_drv_probe()
470 au1100fb_fix.smem_start = fbdev->fb_phys; in au1100fb_drv_probe()
471 au1100fb_fix.smem_len = fbdev->fb_len; in au1100fb_drv_probe()
473 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); in au1100fb_drv_probe()
474 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); in au1100fb_drv_probe()
477 au1100fb_var.bits_per_pixel = fbdev->panel->bpp; in au1100fb_drv_probe()
478 au1100fb_var.xres = fbdev->panel->xres; in au1100fb_drv_probe()
480 au1100fb_var.yres = fbdev->panel->yres; in au1100fb_drv_probe()
483 fbdev->info.screen_base = fbdev->fb_mem; in au1100fb_drv_probe()
484 fbdev->info.fbops = &au1100fb_ops; in au1100fb_drv_probe()
485 fbdev->info.fix = au1100fb_fix; in au1100fb_drv_probe()
487 fbdev->info.pseudo_palette = in au1100fb_drv_probe()
488 devm_kcalloc(&dev->dev, 16, sizeof(u32), GFP_KERNEL); in au1100fb_drv_probe()
489 if (!fbdev->info.pseudo_palette) in au1100fb_drv_probe()
490 return -ENOMEM; in au1100fb_drv_probe()
492 if (fb_alloc_cmap(&fbdev->info.cmap, AU1100_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { in au1100fb_drv_probe()
495 return -EFAULT; in au1100fb_drv_probe()
498 fbdev->info.var = au1100fb_var; in au1100fb_drv_probe()
504 if (register_framebuffer(&fbdev->info) < 0) { in au1100fb_drv_probe()
512 if (fbdev->lcdclk) { in au1100fb_drv_probe()
513 clk_disable_unprepare(fbdev->lcdclk); in au1100fb_drv_probe()
514 clk_put(fbdev->lcdclk); in au1100fb_drv_probe()
516 if (fbdev->info.cmap.len != 0) { in au1100fb_drv_probe()
517 fb_dealloc_cmap(&fbdev->info.cmap); in au1100fb_drv_probe()
520 return -ENODEV; in au1100fb_drv_probe()
530 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); in au1100fb_drv_remove()
532 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO; in au1100fb_drv_remove()
535 unregister_framebuffer(&fbdev->info); in au1100fb_drv_remove()
537 fb_dealloc_cmap(&fbdev->info.cmap); in au1100fb_drv_remove()
539 if (fbdev->lcdclk) { in au1100fb_drv_remove()
540 clk_disable_unprepare(fbdev->lcdclk); in au1100fb_drv_remove()
541 clk_put(fbdev->lcdclk); in au1100fb_drv_remove()
556 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); in au1100fb_drv_suspend()
558 clk_disable(fbdev->lcdclk); in au1100fb_drv_suspend()
560 memcpy(&fbregs, fbdev->regs, sizeof(struct au1100fb_regs)); in au1100fb_drv_suspend()
572 memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs)); in au1100fb_drv_resume()
574 clk_enable(fbdev->lcdclk); in au1100fb_drv_resume()
577 au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info); in au1100fb_drv_resume()
588 .name = "au1100-lcd",