Lines Matching refs:ovl

309 static void lcdc_write_overlay(struct sh_mobile_lcdc_overlay *ovl,  in lcdc_write_overlay()  argument
312 iowrite32(data, ovl->channel->lcdc->base + reg); in lcdc_write_overlay()
313 iowrite32(data, ovl->channel->lcdc->base + reg + SIDE_B_OFFSET); in lcdc_write_overlay()
777 static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_setup() argument
781 if (!ovl->enabled) { in sh_mobile_lcdc_overlay_setup()
782 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_setup()
783 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), 0); in sh_mobile_lcdc_overlay_setup()
784 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_setup()
785 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_setup()
789 ovl->base_addr_y = ovl->dma_handle; in sh_mobile_lcdc_overlay_setup()
790 ovl->base_addr_c = ovl->dma_handle in sh_mobile_lcdc_overlay_setup()
791 + ovl->xres_virtual * ovl->yres_virtual; in sh_mobile_lcdc_overlay_setup()
793 switch (ovl->mode) { in sh_mobile_lcdc_overlay_setup()
795 format = LDBBSIFR_EN | (ovl->alpha << LDBBSIFR_LAY_SHIFT); in sh_mobile_lcdc_overlay_setup()
800 | (ovl->rop3 << LDBBSIFR_ROP3_SHIFT); in sh_mobile_lcdc_overlay_setup()
804 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_setup()
823 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_setup()
847 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_setup()
849 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), format); in sh_mobile_lcdc_overlay_setup()
851 lcdc_write_overlay(ovl, LDBnBSSZR(ovl->index), in sh_mobile_lcdc_overlay_setup()
852 (ovl->yres << LDBBSSZR_BVSS_SHIFT) | in sh_mobile_lcdc_overlay_setup()
853 (ovl->xres << LDBBSSZR_BHSS_SHIFT)); in sh_mobile_lcdc_overlay_setup()
854 lcdc_write_overlay(ovl, LDBnBLOCR(ovl->index), in sh_mobile_lcdc_overlay_setup()
855 (ovl->pos_y << LDBBLOCR_CVLC_SHIFT) | in sh_mobile_lcdc_overlay_setup()
856 (ovl->pos_x << LDBBLOCR_CHLC_SHIFT)); in sh_mobile_lcdc_overlay_setup()
857 lcdc_write_overlay(ovl, LDBnBSMWR(ovl->index), in sh_mobile_lcdc_overlay_setup()
858 ovl->pitch << LDBBSMWR_BSMW_SHIFT); in sh_mobile_lcdc_overlay_setup()
860 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y); in sh_mobile_lcdc_overlay_setup()
861 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c); in sh_mobile_lcdc_overlay_setup()
863 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_setup()
864 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_setup()
1030 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[k]; in sh_mobile_lcdc_start() local
1031 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_start()
1193 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_alpha_show() local
1195 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha); in overlay_alpha_show()
1203 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_alpha_store() local
1217 if (ovl->alpha != alpha) { in overlay_alpha_store()
1218 ovl->alpha = alpha; in overlay_alpha_store()
1220 if (ovl->mode == LCDC_OVERLAY_BLEND && ovl->enabled) in overlay_alpha_store()
1221 sh_mobile_lcdc_overlay_setup(ovl); in overlay_alpha_store()
1231 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_mode_show() local
1233 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode); in overlay_mode_show()
1241 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_mode_store() local
1255 if (ovl->mode != mode) { in overlay_mode_store()
1256 ovl->mode = mode; in overlay_mode_store()
1258 if (ovl->enabled) in overlay_mode_store()
1259 sh_mobile_lcdc_overlay_setup(ovl); in overlay_mode_store()
1270 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_position_show() local
1272 return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y); in overlay_position_show()
1280 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_position_store() local
1296 if (ovl->pos_x != pos_x || ovl->pos_y != pos_y) { in overlay_position_store()
1297 ovl->pos_x = pos_x; in overlay_position_store()
1298 ovl->pos_y = pos_y; in overlay_position_store()
1300 if (ovl->enabled) in overlay_position_store()
1301 sh_mobile_lcdc_overlay_setup(ovl); in overlay_position_store()
1311 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_rop3_show() local
1313 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3); in overlay_rop3_show()
1321 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_rop3_store() local
1335 if (ovl->rop3 != rop3) { in overlay_rop3_store()
1336 ovl->rop3 = rop3; in overlay_rop3_store()
1338 if (ovl->mode == LCDC_OVERLAY_ROP3 && ovl->enabled) in overlay_rop3_store()
1339 sh_mobile_lcdc_overlay_setup(ovl); in overlay_rop3_store()
1370 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_pan() local
1376 if (!ovl->format->yuv) { in sh_mobile_lcdc_overlay_pan()
1377 y_offset = (var->yoffset * ovl->xres_virtual + var->xoffset) in sh_mobile_lcdc_overlay_pan()
1378 * ovl->format->bpp / 8; in sh_mobile_lcdc_overlay_pan()
1381 unsigned int xsub = ovl->format->bpp < 24 ? 2 : 1; in sh_mobile_lcdc_overlay_pan()
1382 unsigned int ysub = ovl->format->bpp < 16 ? 2 : 1; in sh_mobile_lcdc_overlay_pan()
1384 y_offset = var->yoffset * ovl->xres_virtual + var->xoffset; in sh_mobile_lcdc_overlay_pan()
1385 c_offset = var->yoffset / ysub * ovl->xres_virtual * 2 / xsub in sh_mobile_lcdc_overlay_pan()
1392 if (y_offset == ovl->pan_y_offset) in sh_mobile_lcdc_overlay_pan()
1396 base_addr_y = ovl->dma_handle + y_offset; in sh_mobile_lcdc_overlay_pan()
1397 base_addr_c = ovl->dma_handle + ovl->xres_virtual * ovl->yres_virtual in sh_mobile_lcdc_overlay_pan()
1400 ovl->base_addr_y = base_addr_y; in sh_mobile_lcdc_overlay_pan()
1401 ovl->base_addr_c = base_addr_c; in sh_mobile_lcdc_overlay_pan()
1402 ovl->pan_y_offset = y_offset; in sh_mobile_lcdc_overlay_pan()
1404 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_pan()
1406 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y); in sh_mobile_lcdc_overlay_pan()
1407 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c); in sh_mobile_lcdc_overlay_pan()
1409 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_pan()
1410 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_pan()
1418 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_ioctl() local
1422 return sh_mobile_lcdc_wait_for_vsync(ovl->channel); in sh_mobile_lcdc_overlay_ioctl()
1437 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_set_par() local
1439 ovl->format = in sh_mobile_lcdc_overlay_set_par()
1442 ovl->xres = info->var.xres; in sh_mobile_lcdc_overlay_set_par()
1443 ovl->xres_virtual = info->var.xres_virtual; in sh_mobile_lcdc_overlay_set_par()
1444 ovl->yres = info->var.yres; in sh_mobile_lcdc_overlay_set_par()
1445 ovl->yres_virtual = info->var.yres_virtual; in sh_mobile_lcdc_overlay_set_par()
1447 if (ovl->format->yuv) in sh_mobile_lcdc_overlay_set_par()
1448 ovl->pitch = info->var.xres_virtual; in sh_mobile_lcdc_overlay_set_par()
1450 ovl->pitch = info->var.xres_virtual * ovl->format->bpp / 8; in sh_mobile_lcdc_overlay_set_par()
1452 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_overlay_set_par()
1454 info->fix.line_length = ovl->pitch; in sh_mobile_lcdc_overlay_set_par()
1470 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_blank() local
1472 ovl->enabled = !blank; in sh_mobile_lcdc_overlay_blank()
1473 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_overlay_blank()
1484 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_mmap() local
1486 return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem, in sh_mobile_lcdc_overlay_mmap()
1487 ovl->dma_handle, ovl->fb_size); in sh_mobile_lcdc_overlay_mmap()
1506 sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_unregister() argument
1508 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_unregister()
1513 unregister_framebuffer(ovl->info); in sh_mobile_lcdc_overlay_fb_unregister()
1517 sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_register() argument
1519 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc; in sh_mobile_lcdc_overlay_fb_register()
1520 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_register()
1532 dev_name(lcdc->dev), ovl->index, info->var.xres, in sh_mobile_lcdc_overlay_fb_register()
1545 sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_cleanup() argument
1547 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_cleanup()
1556 sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_init() argument
1558 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc; in sh_mobile_lcdc_overlay_fb_init()
1567 ovl->info = info; in sh_mobile_lcdc_overlay_fb_init()
1572 info->screen_buffer = ovl->fb_mem; in sh_mobile_lcdc_overlay_fb_init()
1573 info->par = ovl; in sh_mobile_lcdc_overlay_fb_init()
1580 "SH Mobile LCDC Overlay %u", ovl->index); in sh_mobile_lcdc_overlay_fb_init()
1581 info->fix.smem_start = ovl->dma_handle; in sh_mobile_lcdc_overlay_fb_init()
1582 info->fix.smem_len = ovl->fb_size; in sh_mobile_lcdc_overlay_fb_init()
1583 info->fix.line_length = ovl->pitch; in sh_mobile_lcdc_overlay_fb_init()
1585 if (ovl->format->yuv) in sh_mobile_lcdc_overlay_fb_init()
1590 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_fb_init()
1603 var->xres = ovl->xres; in sh_mobile_lcdc_overlay_fb_init()
1604 var->yres = ovl->yres; in sh_mobile_lcdc_overlay_fb_init()
1605 var->xres_virtual = ovl->xres_virtual; in sh_mobile_lcdc_overlay_fb_init()
1606 var->yres_virtual = ovl->yres_virtual; in sh_mobile_lcdc_overlay_fb_init()
1612 if (!ovl->format->yuv) in sh_mobile_lcdc_overlay_fb_init()
1613 var->bits_per_pixel = ovl->format->bpp; in sh_mobile_lcdc_overlay_fb_init()
1615 var->grayscale = ovl->format->fourcc; in sh_mobile_lcdc_overlay_fb_init()
2263 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_remove() local
2265 sh_mobile_lcdc_overlay_fb_cleanup(ovl); in sh_mobile_lcdc_remove()
2267 if (ovl->fb_mem) in sh_mobile_lcdc_remove()
2268 dma_free_coherent(&pdev->dev, ovl->fb_size, in sh_mobile_lcdc_remove()
2269 ovl->fb_mem, ovl->dma_handle); in sh_mobile_lcdc_remove()
2350 sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_init() argument
2353 struct device *dev = ovl->channel->lcdc->dev; in sh_mobile_lcdc_overlay_init()
2356 if (ovl->cfg->fourcc == 0) in sh_mobile_lcdc_overlay_init()
2360 format = sh_mobile_format_info(ovl->cfg->fourcc); in sh_mobile_lcdc_overlay_init()
2362 dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc); in sh_mobile_lcdc_overlay_init()
2366 ovl->enabled = false; in sh_mobile_lcdc_overlay_init()
2367 ovl->mode = LCDC_OVERLAY_BLEND; in sh_mobile_lcdc_overlay_init()
2368 ovl->alpha = 255; in sh_mobile_lcdc_overlay_init()
2369 ovl->rop3 = 0; in sh_mobile_lcdc_overlay_init()
2370 ovl->pos_x = 0; in sh_mobile_lcdc_overlay_init()
2371 ovl->pos_y = 0; in sh_mobile_lcdc_overlay_init()
2376 ovl->format = format; in sh_mobile_lcdc_overlay_init()
2377 ovl->xres = ovl->cfg->max_xres; in sh_mobile_lcdc_overlay_init()
2378 ovl->xres_virtual = ovl->xres; in sh_mobile_lcdc_overlay_init()
2379 ovl->yres = ovl->cfg->max_yres; in sh_mobile_lcdc_overlay_init()
2380 ovl->yres_virtual = ovl->yres * 2; in sh_mobile_lcdc_overlay_init()
2383 ovl->pitch = ovl->xres_virtual * format->bpp / 8; in sh_mobile_lcdc_overlay_init()
2385 ovl->pitch = ovl->xres_virtual; in sh_mobile_lcdc_overlay_init()
2388 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres in sh_mobile_lcdc_overlay_init()
2390 ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle, in sh_mobile_lcdc_overlay_init()
2392 if (!ovl->fb_mem) { in sh_mobile_lcdc_overlay_init()
2397 ret = sh_mobile_lcdc_overlay_fb_init(ovl); in sh_mobile_lcdc_overlay_init()
2612 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_probe() local
2614 ovl->cfg = &pdata->overlays[i]; in sh_mobile_lcdc_probe()
2615 ovl->channel = &priv->ch[0]; in sh_mobile_lcdc_probe()
2617 error = sh_mobile_lcdc_overlay_init(ovl); in sh_mobile_lcdc_probe()
2637 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_probe() local
2639 error = sh_mobile_lcdc_overlay_fb_register(ovl); in sh_mobile_lcdc_probe()