Lines Matching full:lcdc

28 #include "lcdc.h"
31 #define MODULE_NAME "lcdc"
69 } lcdc; variable
73 lcdc.irq_mask |= mask; in enable_irqs()
78 lcdc.irq_mask &= ~mask; in disable_irqs()
109 l |= lcdc.irq_mask | OMAP_LCDC_IRQ_DONE; /* enabled IRQs */ in enable_controller()
131 init_completion(&lcdc.last_frame_complete); in disable_controller()
133 if (!wait_for_completion_timeout(&lcdc.last_frame_complete, in disable_controller()
135 dev_err(lcdc.fbdev->dev, "timeout waiting for FRAME DONE\n"); in disable_controller()
146 dev_err(lcdc.fbdev->dev, in reset_controller()
155 dev_err(lcdc.fbdev->dev, in reset_controller()
162 * in lcdc.fbdev and fbdev->var.
173 struct omapfb_plane_struct *plane = lcdc.fbdev->fb_info[0]->par; in setup_lcd_dma()
174 struct fb_var_screeninfo *var = &lcdc.fbdev->fb_info[0]->var; in setup_lcd_dma()
178 src = lcdc.vram_phys + lcdc.frame_offset; in setup_lcd_dma()
183 lcdc.color_mode == OMAPFB_COLOR_YUV420 || in setup_lcd_dma()
184 (lcdc.xres & 1)) in setup_lcd_dma()
188 xelem = lcdc.xres * lcdc.bpp / 8 / esize; in setup_lcd_dma()
189 yelem = lcdc.yres; in setup_lcd_dma()
198 xelem = lcdc.yres * lcdc.bpp / 16; in setup_lcd_dma()
199 yelem = lcdc.xres; in setup_lcd_dma()
206 dev_dbg(lcdc.fbdev->dev, in setup_lcd_dma()
212 int bpp = lcdc.bpp; in setup_lcd_dma()
218 if (lcdc.color_mode == OMAPFB_COLOR_YUV420) in setup_lcd_dma()
222 lcdc.screen_width * bpp / 8 / esize); in setup_lcd_dma()
250 complete(&lcdc.last_frame_complete); in lcdc_irq_handler()
254 complete(&lcdc.palette_load_complete); in lcdc_irq_handler()
285 struct fb_var_screeninfo *var = &lcdc.fbdev->fb_info[0]->var; in omap_lcdc_setup_plane()
286 struct lcd_panel *panel = lcdc.fbdev->panel; in omap_lcdc_setup_plane()
299 dev_dbg(lcdc.fbdev->dev, in omap_lcdc_setup_plane()
306 lcdc.frame_offset = offset; in omap_lcdc_setup_plane()
307 lcdc.xres = width; in omap_lcdc_setup_plane()
308 lcdc.yres = height; in omap_lcdc_setup_plane()
309 lcdc.screen_width = screen_width; in omap_lcdc_setup_plane()
310 lcdc.color_mode = color_mode; in omap_lcdc_setup_plane()
314 lcdc.bpp = 8; in omap_lcdc_setup_plane()
315 lcdc.palette_code = 0x3000; in omap_lcdc_setup_plane()
316 lcdc.palette_size = 512; in omap_lcdc_setup_plane()
319 lcdc.bpp = 16; in omap_lcdc_setup_plane()
320 lcdc.palette_code = 0x4000; in omap_lcdc_setup_plane()
321 lcdc.palette_size = 32; in omap_lcdc_setup_plane()
324 lcdc.bpp = 16; in omap_lcdc_setup_plane()
325 lcdc.palette_code = 0x4000; in omap_lcdc_setup_plane()
326 lcdc.palette_size = 32; in omap_lcdc_setup_plane()
329 if (lcdc.ext_mode) { in omap_lcdc_setup_plane()
330 lcdc.bpp = 12; in omap_lcdc_setup_plane()
335 if (lcdc.ext_mode) { in omap_lcdc_setup_plane()
336 lcdc.bpp = 16; in omap_lcdc_setup_plane()
347 dev_dbg(lcdc.fbdev->dev, "invalid color mode %d\n", color_mode); in omap_lcdc_setup_plane()
352 if (lcdc.ext_mode) { in omap_lcdc_setup_plane()
357 if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) { in omap_lcdc_setup_plane()
369 dev_dbg(lcdc.fbdev->dev, in omap_lcdc_enable_plane()
371 plane, enable, lcdc.update_mode, lcdc.ext_mode); in omap_lcdc_enable_plane()
387 palette = (u16 *)lcdc.palette_virt; in load_palette()
390 *(u16 *)palette |= lcdc.palette_code; in load_palette()
392 omap_set_lcd_dma_b1(lcdc.palette_phys, in load_palette()
393 lcdc.palette_size / 4 + 1, 1, OMAP_DMA_DATA_TYPE_S32); in load_palette()
398 init_completion(&lcdc.palette_load_complete); in load_palette()
402 if (!wait_for_completion_timeout(&lcdc.palette_load_complete, in load_palette()
404 dev_err(lcdc.fbdev->dev, "timeout waiting for FRAME DONE\n"); in load_palette()
409 omap_set_lcd_dma_single_transfer(lcdc.ext_mode); in load_palette()
418 if (lcdc.color_mode != OMAPFB_COLOR_CLUT_8BPP || regno > 255) in omap_lcdc_setcolreg()
421 palette = (u16 *)lcdc.palette_virt; in omap_lcdc_setcolreg()
444 lck = clk_get_rate(lcdc.lcd_ck); in calc_ck_div()
453 dev_warn(lcdc.fbdev->dev, "pixclock %d kHz too low.\n", in calc_ck_div()
461 struct lcd_panel *panel = lcdc.fbdev->panel; in setup_regs()
497 lck = clk_get_rate(lcdc.lcd_ck); in setup_regs()
502 dev_warn(lcdc.fbdev->dev, in setup_regs()
527 if (mode != lcdc.update_mode) { in omap_lcdc_set_update_mode()
540 lcdc.update_mode = mode; in omap_lcdc_set_update_mode()
545 lcdc.update_mode = mode; in omap_lcdc_set_update_mode()
557 return lcdc.update_mode; in omap_lcdc_get_update_mode()
580 if (lcdc.dma_callback) in omap_lcdc_set_dma_callback()
583 lcdc.dma_callback = callback; in omap_lcdc_set_dma_callback()
584 lcdc.dma_callback_data = data; in omap_lcdc_set_dma_callback()
592 lcdc.dma_callback = NULL; in omap_lcdc_free_dma_callback()
598 if (lcdc.dma_callback) in lcdc_dma_handler()
599 lcdc.dma_callback(lcdc.dma_callback_data); in lcdc_dma_handler()
604 lcdc.palette_virt = dma_alloc_wc(lcdc.fbdev->dev, MAX_PALETTE_SIZE, in alloc_palette_ram()
605 &lcdc.palette_phys, GFP_KERNEL); in alloc_palette_ram()
606 if (lcdc.palette_virt == NULL) { in alloc_palette_ram()
607 dev_err(lcdc.fbdev->dev, "failed to alloc palette memory\n"); in alloc_palette_ram()
610 memset(lcdc.palette_virt, 0, MAX_PALETTE_SIZE); in alloc_palette_ram()
617 dma_free_wc(lcdc.fbdev->dev, MAX_PALETTE_SIZE, lcdc.palette_virt, in free_palette_ram()
618 lcdc.palette_phys); in free_palette_ram()
625 struct lcd_panel *panel = lcdc.fbdev->panel; in alloc_fbmem()
633 lcdc.vram_size = frame_size; in alloc_fbmem()
634 lcdc.vram_virt = dma_alloc_wc(lcdc.fbdev->dev, lcdc.vram_size, in alloc_fbmem()
635 &lcdc.vram_phys, GFP_KERNEL); in alloc_fbmem()
636 if (lcdc.vram_virt == NULL) { in alloc_fbmem()
637 dev_err(lcdc.fbdev->dev, "unable to allocate FB DMA memory\n"); in alloc_fbmem()
641 region->paddr = lcdc.vram_phys; in alloc_fbmem()
642 region->vaddr = lcdc.vram_virt; in alloc_fbmem()
645 memset(lcdc.vram_virt, 0, lcdc.vram_size); in alloc_fbmem()
652 dma_free_wc(lcdc.fbdev->dev, lcdc.vram_size, lcdc.vram_virt, in free_fbmem()
653 lcdc.vram_phys); in free_fbmem()
659 dev_err(lcdc.fbdev->dev, "no memory regions defined\n"); in setup_fbmem()
664 dev_err(lcdc.fbdev->dev, "only one plane is supported\n"); in setup_fbmem()
679 lcdc.irq_mask = 0; in omap_lcdc_init()
681 lcdc.fbdev = fbdev; in omap_lcdc_init()
682 lcdc.ext_mode = ext_mode; in omap_lcdc_init()
690 lcdc.lcd_ck = clk_get(fbdev->dev, "lcd_ck"); in omap_lcdc_init()
691 if (IS_ERR(lcdc.lcd_ck)) { in omap_lcdc_init()
693 r = PTR_ERR(lcdc.lcd_ck); in omap_lcdc_init()
709 r = clk_set_rate(lcdc.lcd_ck, rate); in omap_lcdc_init()
714 clk_prepare_enable(lcdc.lcd_ck); in omap_lcdc_init()
738 pr_info("omapfb: LCDC initialized\n"); in omap_lcdc_init()
747 free_irq(fbdev->int_irq, lcdc.fbdev); in omap_lcdc_init()
749 clk_disable_unprepare(lcdc.lcd_ck); in omap_lcdc_init()
751 clk_put(lcdc.lcd_ck); in omap_lcdc_init()
758 if (!lcdc.ext_mode) in omap_lcdc_cleanup()
762 free_irq(lcdc.fbdev->int_irq, lcdc.fbdev); in omap_lcdc_cleanup()
763 clk_disable_unprepare(lcdc.lcd_ck); in omap_lcdc_cleanup()
764 clk_put(lcdc.lcd_ck); in omap_lcdc_cleanup()