int s3cfb_window_off(struct s3cfb_global *ctrl, int id) { unsigned int cfg; cfg = readl(ctrl->regs + S3C_WINCON(id)); cfg &= ~S3C_WINCON_ENWIN_ENABLE; writel(cfg, ctrl->regs + S3C_WINCON(id)); dev_dbg(ctrl->dev, "[fb%d] turn off\n", id); return 0; }
static void s3cfb_activate_var(struct s3c_fb_info *fbi, struct fb_var_screeninfo *var) { unsigned id = fbi->win_id; unsigned enable = fbi->wincon & S3C_WINCONx_ENWIN_F_ENABLE; switch (var->bits_per_pixel) { case 8: fbi->wincon = S3C_FB_WINCON_8BPP; fbi->bpp = 8; fbi->bytes_per_pixel = 1; break; case 16: fbi->wincon = S3C_FB_WINCON_16BPP; fbi->bpp = 16; fbi->bytes_per_pixel = 2; break; case 32: fbi->wincon = S3C_FB_WINCON_24BPP; fbi->bpp = 32; fbi->bytes_per_pixel = 4; break; } fbi->fb.fix.line_length = var->xres_virtual * fbi->bytes_per_pixel; if (id != 0) fbi->wincon |= S3C_WINCONx_ALPHA_SEL_1; fbi->wincon |= enable; /* write new registers */ writel(fbi->wincon, S3C_WINCON(id)); }
int s3cfb_window_on(struct s3cfb_global *ctrl, int id) { struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev); u32 cfg; cfg = readl(ctrl->regs + S3C_WINCON(id)); cfg |= S3C_WINCON_ENWIN_ENABLE; writel(cfg, ctrl->regs + S3C_WINCON(id)); if (pdata->hw_ver == 0x62) { cfg = readl(ctrl->regs + S3C_WINSHMAP); cfg |= S3C_WINSHMAP_CH_ENABLE(id); writel(cfg, ctrl->regs + S3C_WINSHMAP); } dev_dbg(ctrl->dev, "[fb%d] turn on\n", id); return 0; }
int s3cfb_window_off(struct s3cfb_global *ctrl, int id) { struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev); u32 cfg; cfg = readl(ctrl->regs + S3C_WINCON(id)); cfg &= ~(S3C_WINCON_ENWIN_ENABLE | S3C_WINCON_DATAPATH_MASK); cfg |= S3C_WINCON_DATAPATH_DMA; writel(cfg, ctrl->regs + S3C_WINCON(id)); if ((pdata->hw_ver == 0x62) || (pdata->hw_ver == 0x70)) { cfg = readl(ctrl->regs + S3C_WINSHMAP); cfg &= ~S3C_WINSHMAP_CH_DISABLE(id); writel(cfg, ctrl->regs + S3C_WINSHMAP); } dev_dbg(ctrl->dev, "[fb%d] turn off\n", id); return 0; }
int s3cfb_set_alpha_blending(struct s3cfb_global *ctrl, int id) { struct s3cfb_window *win = ctrl->fb[id]->par; struct s3cfb_alpha *alpha = &win->alpha; u32 avalue = 0, cfg; if (id == 0) { dev_err(ctrl->dev, "[fb%d] does not support alpha blending\n", id); return -EINVAL; } cfg = readl(ctrl->regs + S3C_WINCON(id)); cfg &= ~(S3C_WINCON_BLD_MASK | S3C_WINCON_ALPHA_SEL_MASK); if (alpha->mode == PIXEL_BLENDING) { dev_dbg(ctrl->dev, "[fb%d] alpha mode: pixel blending\n", id); /* fixing to DATA[31:24] for alpha value */ cfg |= (S3C_WINCON_BLD_PIXEL | S3C_WINCON_ALPHA1_SEL); } else { dev_dbg(ctrl->dev, "[fb%d] alpha mode: plane %d blending\n", id, alpha->channel); cfg |= S3C_WINCON_BLD_PLANE; if (alpha->channel == 0) { cfg |= S3C_WINCON_ALPHA0_SEL; avalue = (alpha->value << S3C_VIDOSD_ALPHA0_SHIFT); } else { cfg |= S3C_WINCON_ALPHA1_SEL; avalue = (alpha->value << S3C_VIDOSD_ALPHA1_SHIFT); } } writel(cfg, ctrl->regs + S3C_WINCON(id)); writel(avalue, ctrl->regs + S3C_VIDOSD_C(id)); return 0; }
int s3cfb_set_window_control(struct s3cfb_global *ctrl, int id) { struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev); struct fb_info *fb = ctrl->fb[id]; struct fb_var_screeninfo *var = &fb->var; struct s3cfb_window *win = fb->par; u32 cfg; cfg = readl(ctrl->regs + S3C_WINCON(id)); cfg &= ~(S3C_WINCON_BITSWP_ENABLE | S3C_WINCON_BYTESWP_ENABLE | S3C_WINCON_HAWSWP_ENABLE | S3C_WINCON_WSWP_ENABLE | S3C_WINCON_BURSTLEN_MASK | S3C_WINCON_BPPMODE_MASK | S3C_WINCON_INRGB_MASK | S3C_WINCON_DATAPATH_MASK); if (win->path != DATA_PATH_DMA) { dev_dbg(ctrl->dev, "[fb%d] data path: fifo\n", id); cfg |= S3C_WINCON_DATAPATH_LOCAL; if (win->path == DATA_PATH_FIFO) { cfg |= S3C_WINCON_INRGB_RGB; cfg |= S3C_WINCON_BPPMODE_24BPP_888; } else if (win->path == DATA_PATH_IPC) { cfg |= S3C_WINCON_INRGB_YUV; cfg |= S3C_WINCON_BPPMODE_24BPP_888; } if (id == 1) { cfg &= ~(S3C_WINCON1_LOCALSEL_MASK | S3C_WINCON1_VP_ENABLE); if (win->local_channel == 0) { cfg |= S3C_WINCON1_LOCALSEL_FIMC1; } else { cfg |= (S3C_WINCON1_LOCALSEL_VP | S3C_WINCON1_VP_ENABLE); } } } else { dev_dbg(ctrl->dev, "[fb%d] data path: dma\n", id); cfg |= S3C_WINCON_DATAPATH_DMA; if (fb->var.bits_per_pixel == 16 && pdata->swap & FB_SWAP_HWORD) cfg |= S3C_WINCON_HAWSWP_ENABLE; if (fb->var.bits_per_pixel == 32 && pdata->swap & FB_SWAP_WORD) cfg |= S3C_WINCON_WSWP_ENABLE; /* dma burst */ if (win->dma_burst == 4) cfg |= S3C_WINCON_BURSTLEN_4WORD; else if (win->dma_burst == 8) cfg |= S3C_WINCON_BURSTLEN_8WORD; else cfg |= S3C_WINCON_BURSTLEN_16WORD; /* bpp mode set */ switch (fb->var.bits_per_pixel) { case 16: if (var->transp.length == 1) { dev_dbg(ctrl->dev, "[fb%d] bpp mode: A1-R5-G5-B5\n", id); cfg |= S3C_WINCON_BPPMODE_16BPP_A555; } else if (var->transp.length == 4) { dev_dbg(ctrl->dev, "[fb%d] bpp mode: A4-R4-G4-B4\n", id); cfg |= S3C_WINCON_BPPMODE_16BPP_A444; } else { dev_dbg(ctrl->dev, "[fb%d] bpp mode: R5-G6-B5\n", id); cfg |= S3C_WINCON_BPPMODE_16BPP_565; } break; case 24: /* packed 24 bpp: nothing to do for 6.x fimd */ break; case 32: if (var->transp.length == 0) { dev_dbg(ctrl->dev, "[fb%d] bpp mode: R8-G8-B8\n", id); cfg |= S3C_WINCON_BPPMODE_24BPP_888; } else { dev_dbg(ctrl->dev, "[fb%d] bpp mode: A8-R8-G8-B8\n", id); cfg |= S3C_WINCON_BPPMODE_32BPP; } break; } } writel(cfg, ctrl->regs + S3C_WINCON(id)); return 0; }