Lines Matching defs:ofb
613 static void overlay1fb_setup(struct pxafb_layer *ofb)
615 int size = ofb->fb.fix.line_length * ofb->fb.var.yres_virtual;
616 unsigned long start = ofb->video_mem_phys;
617 setup_frame_dma(ofb->fbi, DMA_OV1, PAL_NONE, start, size);
623 static void overlay1fb_enable(struct pxafb_layer *ofb)
625 int enabled = lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN;
626 uint32_t fdadr1 = ofb->fbi->fdadr[DMA_OV1] | (enabled ? 0x1 : 0);
628 lcd_writel(ofb->fbi, enabled ? FBR1 : FDADR1, fdadr1);
629 lcd_writel(ofb->fbi, OVL1C2, ofb->control[1]);
630 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] | OVLxC1_OEN);
633 static void overlay1fb_disable(struct pxafb_layer *ofb)
637 if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
640 lccr5 = lcd_readl(ofb->fbi, LCCR5);
642 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
644 lcd_writel(ofb->fbi, LCSR1, LCSR1_BS(1));
645 lcd_writel(ofb->fbi, LCCR5, lccr5 & ~LCSR1_BS(1));
646 lcd_writel(ofb->fbi, FBR1, ofb->fbi->fdadr[DMA_OV1] | 0x3);
648 if (wait_for_completion_timeout(&ofb->branch_done, 1 * HZ) == 0)
651 lcd_writel(ofb->fbi, LCCR5, lccr5);
654 static void overlay2fb_setup(struct pxafb_layer *ofb)
656 int size, div = 1, pfor = NONSTD_TO_PFOR(ofb->fb.var.nonstd);
657 unsigned long start[3] = { ofb->video_mem_phys, 0, 0 };
660 size = ofb->fb.fix.line_length * ofb->fb.var.yres_virtual;
661 setup_frame_dma(ofb->fbi, DMA_OV2_Y, -1, start[0], size);
663 size = ofb->fb.var.xres_virtual * ofb->fb.var.yres_virtual;
671 setup_frame_dma(ofb->fbi, DMA_OV2_Y, -1, start[0], size);
672 setup_frame_dma(ofb->fbi, DMA_OV2_Cb, -1, start[1], size / div);
673 setup_frame_dma(ofb->fbi, DMA_OV2_Cr, -1, start[2], size / div);
677 static void overlay2fb_enable(struct pxafb_layer *ofb)
679 int pfor = NONSTD_TO_PFOR(ofb->fb.var.nonstd);
680 int enabled = lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN;
681 uint32_t fdadr2 = ofb->fbi->fdadr[DMA_OV2_Y] | (enabled ? 0x1 : 0);
682 uint32_t fdadr3 = ofb->fbi->fdadr[DMA_OV2_Cb] | (enabled ? 0x1 : 0);
683 uint32_t fdadr4 = ofb->fbi->fdadr[DMA_OV2_Cr] | (enabled ? 0x1 : 0);
686 lcd_writel(ofb->fbi, enabled ? FBR2 : FDADR2, fdadr2);
688 lcd_writel(ofb->fbi, enabled ? FBR2 : FDADR2, fdadr2);
689 lcd_writel(ofb->fbi, enabled ? FBR3 : FDADR3, fdadr3);
690 lcd_writel(ofb->fbi, enabled ? FBR4 : FDADR4, fdadr4);
692 lcd_writel(ofb->fbi, OVL2C2, ofb->control[1]);
693 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] | OVLxC1_OEN);
696 static void overlay2fb_disable(struct pxafb_layer *ofb)
700 if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
703 lccr5 = lcd_readl(ofb->fbi, LCCR5);
705 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
707 lcd_writel(ofb->fbi, LCSR1, LCSR1_BS(2));
708 lcd_writel(ofb->fbi, LCCR5, lccr5 & ~LCSR1_BS(2));
709 lcd_writel(ofb->fbi, FBR2, ofb->fbi->fdadr[DMA_OV2_Y] | 0x3);
710 lcd_writel(ofb->fbi, FBR3, ofb->fbi->fdadr[DMA_OV2_Cb] | 0x3);
711 lcd_writel(ofb->fbi, FBR4, ofb->fbi->fdadr[DMA_OV2_Cr] | 0x3);
713 if (wait_for_completion_timeout(&ofb->branch_done, 1 * HZ) == 0)
732 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
738 if (ofb->usage++ == 0) {
741 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
750 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
752 if (ofb->usage == 1) {
753 ofb->ops->disable(ofb);
754 ofb->fb.var.height = -1;
755 ofb->fb.var.width = -1;
756 ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
757 ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
759 ofb->usage--;
767 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
768 struct fb_var_screeninfo *base_var = &ofb->fbi->fb.var;
780 if (ofb->id == OVERLAY1 && pfor != 0)
816 static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
818 struct fb_var_screeninfo *var = &ofb->fb.var;
830 ofb->fb.fix.line_length = var->xres_virtual * bpp / 8;
832 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
834 if (ofb->video_mem) {
835 if (ofb->video_mem_size >= size)
843 struct pxafb_layer *ofb = container_of(info, struct pxafb_layer, fb);
847 ret = overlayfb_check_video_memory(ofb);
856 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
858 ofb->control[1] = OVLxC2_XPOS(xpos) | OVLxC2_YPOS(ypos);
860 if (ofb->id == OVERLAY2)
861 ofb->control[1] |= OVL2C2_PFOR(pfor);
863 ofb->ops->setup(ofb);
864 ofb->ops->enable(ofb);
876 static void init_pxafb_overlay(struct pxafb_info *fbi, struct pxafb_layer *ofb,
879 sprintf(ofb->fb.fix.id, "overlay%d", id + 1);
881 ofb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
882 ofb->fb.fix.xpanstep = 0;
883 ofb->fb.fix.ypanstep = 1;
885 ofb->fb.var.activate = FB_ACTIVATE_NOW;
886 ofb->fb.var.height = -1;
887 ofb->fb.var.width = -1;
888 ofb->fb.var.vmode = FB_VMODE_NONINTERLACED;
890 ofb->fb.fbops = &overlay_fb_ops;
891 ofb->fb.flags = FBINFO_FLAG_DEFAULT;
892 ofb->fb.node = -1;
893 ofb->fb.pseudo_palette = NULL;
895 ofb->id = id;
896 ofb->ops = &ofb_ops[id];
897 ofb->usage = 0;
898 ofb->fbi = fbi;
899 init_completion(&ofb->branch_done);
911 struct pxafb_layer *ofb)
916 ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
918 if (ofb->video_mem == NULL)
921 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
922 ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
924 mutex_lock(&ofb->fb.mm_lock);
925 ofb->fb.fix.smem_start = ofb->video_mem_phys;
926 ofb->fb.fix.smem_len = pxafb->video_mem_size;
927 mutex_unlock(&ofb->fb.mm_lock);
929 ofb->fb.screen_base = ofb->video_mem;
942 struct pxafb_layer *ofb = &fbi->overlay[i];
943 init_pxafb_overlay(fbi, ofb, i);
944 ret = register_framebuffer(&ofb->fb);
949 ret = pxafb_overlay_map_video_memory(fbi, ofb);
954 unregister_framebuffer(&ofb->fb);
957 ofb->registered = 1;
974 struct pxafb_layer *ofb = &fbi->overlay[i];
975 if (ofb->registered) {
976 if (ofb->video_mem)
977 free_pages_exact(ofb->video_mem,
978 ofb->video_mem_size);
979 unregister_framebuffer(&ofb->fb);