Lines Matching defs:ofb

611 static void overlay1fb_setup(struct pxafb_layer *ofb)
613 int size = ofb->fb.fix.line_length * ofb->fb.var.yres_virtual;
614 unsigned long start = ofb->video_mem_phys;
615 setup_frame_dma(ofb->fbi, DMA_OV1, PAL_NONE, start, size);
621 static void overlay1fb_enable(struct pxafb_layer *ofb)
623 int enabled = lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN;
624 uint32_t fdadr1 = ofb->fbi->fdadr[DMA_OV1] | (enabled ? 0x1 : 0);
626 lcd_writel(ofb->fbi, enabled ? FBR1 : FDADR1, fdadr1);
627 lcd_writel(ofb->fbi, OVL1C2, ofb->control[1]);
628 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] | OVLxC1_OEN);
631 static void overlay1fb_disable(struct pxafb_layer *ofb)
635 if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
638 lccr5 = lcd_readl(ofb->fbi, LCCR5);
640 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
642 lcd_writel(ofb->fbi, LCSR1, LCSR1_BS(1));
643 lcd_writel(ofb->fbi, LCCR5, lccr5 & ~LCSR1_BS(1));
644 lcd_writel(ofb->fbi, FBR1, ofb->fbi->fdadr[DMA_OV1] | 0x3);
646 if (wait_for_completion_timeout(&ofb->branch_done, 1 * HZ) == 0)
649 lcd_writel(ofb->fbi, LCCR5, lccr5);
652 static void overlay2fb_setup(struct pxafb_layer *ofb)
654 int size, div = 1, pfor = NONSTD_TO_PFOR(ofb->fb.var.nonstd);
655 unsigned long start[3] = { ofb->video_mem_phys, 0, 0 };
658 size = ofb->fb.fix.line_length * ofb->fb.var.yres_virtual;
659 setup_frame_dma(ofb->fbi, DMA_OV2_Y, -1, start[0], size);
661 size = ofb->fb.var.xres_virtual * ofb->fb.var.yres_virtual;
669 setup_frame_dma(ofb->fbi, DMA_OV2_Y, -1, start[0], size);
670 setup_frame_dma(ofb->fbi, DMA_OV2_Cb, -1, start[1], size / div);
671 setup_frame_dma(ofb->fbi, DMA_OV2_Cr, -1, start[2], size / div);
675 static void overlay2fb_enable(struct pxafb_layer *ofb)
677 int pfor = NONSTD_TO_PFOR(ofb->fb.var.nonstd);
678 int enabled = lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN;
679 uint32_t fdadr2 = ofb->fbi->fdadr[DMA_OV2_Y] | (enabled ? 0x1 : 0);
680 uint32_t fdadr3 = ofb->fbi->fdadr[DMA_OV2_Cb] | (enabled ? 0x1 : 0);
681 uint32_t fdadr4 = ofb->fbi->fdadr[DMA_OV2_Cr] | (enabled ? 0x1 : 0);
684 lcd_writel(ofb->fbi, enabled ? FBR2 : FDADR2, fdadr2);
686 lcd_writel(ofb->fbi, enabled ? FBR2 : FDADR2, fdadr2);
687 lcd_writel(ofb->fbi, enabled ? FBR3 : FDADR3, fdadr3);
688 lcd_writel(ofb->fbi, enabled ? FBR4 : FDADR4, fdadr4);
690 lcd_writel(ofb->fbi, OVL2C2, ofb->control[1]);
691 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] | OVLxC1_OEN);
694 static void overlay2fb_disable(struct pxafb_layer *ofb)
698 if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
701 lccr5 = lcd_readl(ofb->fbi, LCCR5);
703 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
705 lcd_writel(ofb->fbi, LCSR1, LCSR1_BS(2));
706 lcd_writel(ofb->fbi, LCCR5, lccr5 & ~LCSR1_BS(2));
707 lcd_writel(ofb->fbi, FBR2, ofb->fbi->fdadr[DMA_OV2_Y] | 0x3);
708 lcd_writel(ofb->fbi, FBR3, ofb->fbi->fdadr[DMA_OV2_Cb] | 0x3);
709 lcd_writel(ofb->fbi, FBR4, ofb->fbi->fdadr[DMA_OV2_Cr] | 0x3);
711 if (wait_for_completion_timeout(&ofb->branch_done, 1 * HZ) == 0)
730 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
736 if (ofb->usage++ == 0) {
739 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
748 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
750 if (ofb->usage == 1) {
751 ofb->ops->disable(ofb);
752 ofb->fb.var.height = -1;
753 ofb->fb.var.width = -1;
754 ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
755 ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
757 ofb->usage--;
765 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
766 struct fb_var_screeninfo *base_var = &ofb->fbi->fb.var;
778 if (ofb->id == OVERLAY1 && pfor != 0)
814 static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
816 struct fb_var_screeninfo *var = &ofb->fb.var;
828 ofb->fb.fix.line_length = var->xres_virtual * bpp / 8;
830 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
832 if (ofb->video_mem) {
833 if (ofb->video_mem_size >= size)
841 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
845 ret = overlayfb_check_video_memory(ofb);
854 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
856 ofb->control[1] = OVLxC2_XPOS(xpos) | OVLxC2_YPOS(ypos);
858 if (ofb->id == OVERLAY2)
859 ofb->control[1] |= OVL2C2_PFOR(pfor);
861 ofb->ops->setup(ofb);
862 ofb->ops->enable(ofb);
874 static void init_pxafb_overlay(struct pxafb_info *fbi, struct pxafb_layer *ofb,
877 sprintf(ofb->fb.fix.id, "overlay%d", id + 1);
879 ofb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
880 ofb->fb.fix.xpanstep = 0;
881 ofb->fb.fix.ypanstep = 1;
883 ofb->fb.var.activate = FB_ACTIVATE_NOW;
884 ofb->fb.var.height = -1;
885 ofb->fb.var.width = -1;
886 ofb->fb.var.vmode = FB_VMODE_NONINTERLACED;
888 ofb->fb.fbops = &overlay_fb_ops;
889 ofb->fb.node = -1;
890 ofb->fb.pseudo_palette = NULL;
892 ofb->id = id;
893 ofb->ops = &ofb_ops[id];
894 ofb->usage = 0;
895 ofb->fbi = fbi;
896 init_completion(&ofb->branch_done);
908 struct pxafb_layer *ofb)
913 ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
915 if (ofb->video_mem == NULL)
918 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
919 ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
921 mutex_lock(&ofb->fb.mm_lock);
922 ofb->fb.fix.smem_start = ofb->video_mem_phys;
923 ofb->fb.fix.smem_len = pxafb->video_mem_size;
924 mutex_unlock(&ofb->fb.mm_lock);
926 ofb->fb.screen_base = ofb->video_mem;
939 struct pxafb_layer *ofb = &fbi->overlay[i];
940 init_pxafb_overlay(fbi, ofb, i);
941 ret = register_framebuffer(&ofb->fb);
946 ret = pxafb_overlay_map_video_memory(fbi, ofb);
951 unregister_framebuffer(&ofb->fb);
954 ofb->registered = 1;
971 struct pxafb_layer *ofb = &fbi->overlay[i];
972 if (ofb->registered) {
973 if (ofb->video_mem)
974 free_pages_exact(ofb->video_mem,
975 ofb->video_mem_size);
976 unregister_framebuffer(&ofb->fb);