Lines Matching defs:lcdc
33 #include <mach/lcdc.h>
40 #include "lcdc.h"
42 #define MODULE_NAME "lcdc"
81 } lcdc;
85 lcdc.irq_mask |= mask;
90 lcdc.irq_mask &= ~mask;
121 l |= lcdc.irq_mask | OMAP_LCDC_IRQ_DONE; /* enabled IRQs */
143 init_completion(&lcdc.last_frame_complete);
145 if (!wait_for_completion_timeout(&lcdc.last_frame_complete,
147 dev_err(lcdc.fbdev->dev, "timeout waiting for FRAME DONE\n");
158 dev_err(lcdc.fbdev->dev,
167 dev_err(lcdc.fbdev->dev,
174 * in lcdc.fbdev and fbdev->var.
185 struct omapfb_plane_struct *plane = lcdc.fbdev->fb_info[0]->par;
186 struct fb_var_screeninfo *var = &lcdc.fbdev->fb_info[0]->var;
190 src = lcdc.vram_phys + lcdc.frame_offset;
195 lcdc.color_mode == OMAPFB_COLOR_YUV420 ||
196 (lcdc.xres & 1))
200 xelem = lcdc.xres * lcdc.bpp / 8 / esize;
201 yelem = lcdc.yres;
210 xelem = lcdc.yres * lcdc.bpp / 16;
211 yelem = lcdc.xres;
218 dev_dbg(lcdc.fbdev->dev,
224 int bpp = lcdc.bpp;
230 if (lcdc.color_mode == OMAPFB_COLOR_YUV420)
234 lcdc.screen_width * bpp / 8 / esize);
262 complete(&lcdc.last_frame_complete);
266 complete(&lcdc.palette_load_complete);
297 struct fb_var_screeninfo *var = &lcdc.fbdev->fb_info[0]->var;
298 struct lcd_panel *panel = lcdc.fbdev->panel;
311 dev_dbg(lcdc.fbdev->dev,
318 lcdc.frame_offset = offset;
319 lcdc.xres = width;
320 lcdc.yres = height;
321 lcdc.screen_width = screen_width;
322 lcdc.color_mode = color_mode;
326 lcdc.bpp = 8;
327 lcdc.palette_code = 0x3000;
328 lcdc.palette_size = 512;
331 lcdc.bpp = 16;
332 lcdc.palette_code = 0x4000;
333 lcdc.palette_size = 32;
336 lcdc.bpp = 16;
337 lcdc.palette_code = 0x4000;
338 lcdc.palette_size = 32;
341 if (lcdc.ext_mode) {
342 lcdc.bpp = 12;
347 if (lcdc.ext_mode) {
348 lcdc.bpp = 16;
353 dev_dbg(lcdc.fbdev->dev, "invalid color mode %d\n", color_mode);
358 if (lcdc.ext_mode) {
363 if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) {
375 dev_dbg(lcdc.fbdev->dev,
377 plane, enable, lcdc.update_mode, lcdc.ext_mode);
393 palette = (u16 *)lcdc.palette_virt;
396 *(u16 *)palette |= lcdc.palette_code;
398 omap_set_lcd_dma_b1(lcdc.palette_phys,
399 lcdc.palette_size / 4 + 1, 1, OMAP_DMA_DATA_TYPE_S32);
404 init_completion(&lcdc.palette_load_complete);
408 if (!wait_for_completion_timeout(&lcdc.palette_load_complete,
410 dev_err(lcdc.fbdev->dev, "timeout waiting for FRAME DONE\n");
415 omap_set_lcd_dma_single_transfer(lcdc.ext_mode);
424 if (lcdc.color_mode != OMAPFB_COLOR_CLUT_8BPP || regno > 255)
427 palette = (u16 *)lcdc.palette_virt;
450 lck = clk_get_rate(lcdc.lcd_ck);
458 dev_warn(lcdc.fbdev->dev, "pixclock %d kHz too low.\n",
466 struct lcd_panel *panel = lcdc.fbdev->panel;
501 lck = clk_get_rate(lcdc.lcd_ck);
506 dev_warn(lcdc.fbdev->dev,
531 if (mode != lcdc.update_mode) {
544 lcdc.update_mode = mode;
549 lcdc.update_mode = mode;
561 return lcdc.update_mode;
584 if (lcdc.dma_callback)
587 lcdc.dma_callback = callback;
588 lcdc.dma_callback_data = data;
596 lcdc.dma_callback = NULL;
602 if (lcdc.dma_callback)
603 lcdc.dma_callback(lcdc.dma_callback_data);
613 kvma = get_vm_area(lcdc.vram_size, VM_IOREMAP);
615 dev_err(lcdc.fbdev->dev, "can't get kernel vm area\n");
622 vma.vm_end = vaddr + lcdc.vram_size;
626 lcdc.vram_phys >> PAGE_SHIFT,
627 lcdc.vram_size, pgprot) < 0) {
628 dev_err(lcdc.fbdev->dev, "kernel mmap for FB memory failed\n");
632 lcdc.vram_virt = (void *)vaddr;
639 vunmap(lcdc.vram_virt);
644 lcdc.palette_virt = dma_alloc_writecombine(lcdc.fbdev->dev,
645 MAX_PALETTE_SIZE, &lcdc.palette_phys, GFP_KERNEL);
646 if (lcdc.palette_virt == NULL) {
647 dev_err(lcdc.fbdev->dev, "failed to alloc palette memory\n");
650 memset(lcdc.palette_virt, 0, MAX_PALETTE_SIZE);
657 dma_free_writecombine(lcdc.fbdev->dev, MAX_PALETTE_SIZE,
658 lcdc.palette_virt, lcdc.palette_phys);
665 struct lcd_panel *panel = lcdc.fbdev->panel;
673 lcdc.vram_size = frame_size;
674 lcdc.vram_virt = dma_alloc_writecombine(lcdc.fbdev->dev,
675 lcdc.vram_size, &lcdc.vram_phys, GFP_KERNEL);
676 if (lcdc.vram_virt == NULL) {
677 dev_err(lcdc.fbdev->dev, "unable to allocate FB DMA memory\n");
681 region->paddr = lcdc.vram_phys;
682 region->vaddr = lcdc.vram_virt;
685 memset(lcdc.vram_virt, 0, lcdc.vram_size);
692 dma_free_writecombine(lcdc.fbdev->dev, lcdc.vram_size,
693 lcdc.vram_virt, lcdc.vram_phys);
701 dev_err(lcdc.fbdev->dev, "no memory regions defined\n");
706 dev_err(lcdc.fbdev->dev, "only one plane is supported\n");
711 lcdc.fbmem_allocated = 1;
717 lcdc.vram_phys = req_md->region[0].paddr;
718 lcdc.vram_size = req_md->region[0].size;
723 dev_dbg(lcdc.fbdev->dev, "vram at %08x size %08lx mapped to 0x%p\n",
724 lcdc.vram_phys, lcdc.vram_size, lcdc.vram_virt);
731 if (lcdc.fbmem_allocated)
745 lcdc.irq_mask = 0;
747 lcdc.fbdev = fbdev;
748 lcdc.ext_mode = ext_mode;
753 lcdc.lcd_ck = clk_get(fbdev->dev, "lcd_ck");
754 if (IS_ERR(lcdc.lcd_ck)) {
756 r = PTR_ERR(lcdc.lcd_ck);
774 r = clk_set_rate(lcdc.lcd_ck, rate);
779 clk_enable(lcdc.lcd_ck);
812 free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
814 clk_disable(lcdc.lcd_ck);
816 clk_put(lcdc.lcd_ck);
823 if (!lcdc.ext_mode)
827 free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
828 clk_disable(lcdc.lcd_ck);
829 clk_put(lcdc.lcd_ck);