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()
773 static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_setup() argument
777 if (!ovl->enabled) { in sh_mobile_lcdc_overlay_setup()
778 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_setup()
779 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), 0); in sh_mobile_lcdc_overlay_setup()
780 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_setup()
781 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_setup()
785 ovl->base_addr_y = ovl->dma_handle; in sh_mobile_lcdc_overlay_setup()
786 ovl->base_addr_c = ovl->dma_handle in sh_mobile_lcdc_overlay_setup()
787 + ovl->xres_virtual * ovl->yres_virtual; in sh_mobile_lcdc_overlay_setup()
789 switch (ovl->mode) { in sh_mobile_lcdc_overlay_setup()
791 format = LDBBSIFR_EN | (ovl->alpha << LDBBSIFR_LAY_SHIFT); in sh_mobile_lcdc_overlay_setup()
796 | (ovl->rop3 << LDBBSIFR_ROP3_SHIFT); in sh_mobile_lcdc_overlay_setup()
800 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_setup()
819 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_setup()
843 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_setup()
845 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), format); in sh_mobile_lcdc_overlay_setup()
847 lcdc_write_overlay(ovl, LDBnBSSZR(ovl->index), in sh_mobile_lcdc_overlay_setup()
848 (ovl->yres << LDBBSSZR_BVSS_SHIFT) | in sh_mobile_lcdc_overlay_setup()
849 (ovl->xres << LDBBSSZR_BHSS_SHIFT)); in sh_mobile_lcdc_overlay_setup()
850 lcdc_write_overlay(ovl, LDBnBLOCR(ovl->index), in sh_mobile_lcdc_overlay_setup()
851 (ovl->pos_y << LDBBLOCR_CVLC_SHIFT) | in sh_mobile_lcdc_overlay_setup()
852 (ovl->pos_x << LDBBLOCR_CHLC_SHIFT)); in sh_mobile_lcdc_overlay_setup()
853 lcdc_write_overlay(ovl, LDBnBSMWR(ovl->index), in sh_mobile_lcdc_overlay_setup()
854 ovl->pitch << LDBBSMWR_BSMW_SHIFT); in sh_mobile_lcdc_overlay_setup()
856 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y); in sh_mobile_lcdc_overlay_setup()
857 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c); in sh_mobile_lcdc_overlay_setup()
859 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_setup()
860 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_setup()
1026 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[k]; in sh_mobile_lcdc_start() local
1027 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_start()
1189 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_alpha_show() local
1191 return sysfs_emit(buf, "%u\n", ovl->alpha); in overlay_alpha_show()
1199 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_alpha_store() local
1213 if (ovl->alpha != alpha) { in overlay_alpha_store()
1214 ovl->alpha = alpha; in overlay_alpha_store()
1216 if (ovl->mode == LCDC_OVERLAY_BLEND && ovl->enabled) in overlay_alpha_store()
1217 sh_mobile_lcdc_overlay_setup(ovl); in overlay_alpha_store()
1227 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_mode_show() local
1229 return sysfs_emit(buf, "%u\n", ovl->mode); in overlay_mode_show()
1237 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_mode_store() local
1251 if (ovl->mode != mode) { in overlay_mode_store()
1252 ovl->mode = mode; in overlay_mode_store()
1254 if (ovl->enabled) in overlay_mode_store()
1255 sh_mobile_lcdc_overlay_setup(ovl); in overlay_mode_store()
1266 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_position_show() local
1268 return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y); in overlay_position_show()
1276 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_position_store() local
1292 if (ovl->pos_x != pos_x || ovl->pos_y != pos_y) { in overlay_position_store()
1293 ovl->pos_x = pos_x; in overlay_position_store()
1294 ovl->pos_y = pos_y; in overlay_position_store()
1296 if (ovl->enabled) in overlay_position_store()
1297 sh_mobile_lcdc_overlay_setup(ovl); in overlay_position_store()
1307 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_rop3_show() local
1309 return sysfs_emit(buf, "%u\n", ovl->rop3); in overlay_rop3_show()
1317 struct sh_mobile_lcdc_overlay *ovl = info->par; in overlay_rop3_store() local
1331 if (ovl->rop3 != rop3) { in overlay_rop3_store()
1332 ovl->rop3 = rop3; in overlay_rop3_store()
1334 if (ovl->mode == LCDC_OVERLAY_ROP3 && ovl->enabled) in overlay_rop3_store()
1335 sh_mobile_lcdc_overlay_setup(ovl); in overlay_rop3_store()
1366 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_pan() local
1372 if (!ovl->format->yuv) { in sh_mobile_lcdc_overlay_pan()
1373 y_offset = (var->yoffset * ovl->xres_virtual + var->xoffset) in sh_mobile_lcdc_overlay_pan()
1374 * ovl->format->bpp / 8; in sh_mobile_lcdc_overlay_pan()
1377 unsigned int xsub = ovl->format->bpp < 24 ? 2 : 1; in sh_mobile_lcdc_overlay_pan()
1378 unsigned int ysub = ovl->format->bpp < 16 ? 2 : 1; in sh_mobile_lcdc_overlay_pan()
1380 y_offset = var->yoffset * ovl->xres_virtual + var->xoffset; in sh_mobile_lcdc_overlay_pan()
1381 c_offset = var->yoffset / ysub * ovl->xres_virtual * 2 / xsub in sh_mobile_lcdc_overlay_pan()
1388 if (y_offset == ovl->pan_y_offset) in sh_mobile_lcdc_overlay_pan()
1392 base_addr_y = ovl->dma_handle + y_offset; in sh_mobile_lcdc_overlay_pan()
1393 base_addr_c = ovl->dma_handle + ovl->xres_virtual * ovl->yres_virtual in sh_mobile_lcdc_overlay_pan()
1396 ovl->base_addr_y = base_addr_y; in sh_mobile_lcdc_overlay_pan()
1397 ovl->base_addr_c = base_addr_c; in sh_mobile_lcdc_overlay_pan()
1398 ovl->pan_y_offset = y_offset; in sh_mobile_lcdc_overlay_pan()
1400 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index)); in sh_mobile_lcdc_overlay_pan()
1402 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y); in sh_mobile_lcdc_overlay_pan()
1403 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c); in sh_mobile_lcdc_overlay_pan()
1405 lcdc_write(ovl->channel->lcdc, LDBCR, in sh_mobile_lcdc_overlay_pan()
1406 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index)); in sh_mobile_lcdc_overlay_pan()
1414 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_ioctl() local
1418 return sh_mobile_lcdc_wait_for_vsync(ovl->channel); in sh_mobile_lcdc_overlay_ioctl()
1433 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_set_par() local
1435 ovl->format = in sh_mobile_lcdc_overlay_set_par()
1438 ovl->xres = info->var.xres; in sh_mobile_lcdc_overlay_set_par()
1439 ovl->xres_virtual = info->var.xres_virtual; in sh_mobile_lcdc_overlay_set_par()
1440 ovl->yres = info->var.yres; in sh_mobile_lcdc_overlay_set_par()
1441 ovl->yres_virtual = info->var.yres_virtual; in sh_mobile_lcdc_overlay_set_par()
1443 if (ovl->format->yuv) in sh_mobile_lcdc_overlay_set_par()
1444 ovl->pitch = info->var.xres_virtual; in sh_mobile_lcdc_overlay_set_par()
1446 ovl->pitch = info->var.xres_virtual * ovl->format->bpp / 8; in sh_mobile_lcdc_overlay_set_par()
1448 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_overlay_set_par()
1450 info->fix.line_length = ovl->pitch; in sh_mobile_lcdc_overlay_set_par()
1466 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_blank() local
1468 ovl->enabled = !blank; in sh_mobile_lcdc_overlay_blank()
1469 sh_mobile_lcdc_overlay_setup(ovl); in sh_mobile_lcdc_overlay_blank()
1480 struct sh_mobile_lcdc_overlay *ovl = info->par; in sh_mobile_lcdc_overlay_mmap() local
1487 return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem, in sh_mobile_lcdc_overlay_mmap()
1488 ovl->dma_handle, ovl->fb_size); in sh_mobile_lcdc_overlay_mmap()
1504 sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_unregister() argument
1506 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_unregister()
1511 unregister_framebuffer(ovl->info); in sh_mobile_lcdc_overlay_fb_unregister()
1515 sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_register() argument
1517 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc; in sh_mobile_lcdc_overlay_fb_register()
1518 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_register()
1530 dev_name(lcdc->dev), ovl->index, info->var.xres, in sh_mobile_lcdc_overlay_fb_register()
1543 sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_cleanup() argument
1545 struct fb_info *info = ovl->info; in sh_mobile_lcdc_overlay_fb_cleanup()
1554 sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_fb_init() argument
1556 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc; in sh_mobile_lcdc_overlay_fb_init()
1565 ovl->info = info; in sh_mobile_lcdc_overlay_fb_init()
1570 info->screen_buffer = ovl->fb_mem; in sh_mobile_lcdc_overlay_fb_init()
1571 info->par = ovl; in sh_mobile_lcdc_overlay_fb_init()
1578 "SHMobile ovl %u", ovl->index); in sh_mobile_lcdc_overlay_fb_init()
1579 info->fix.smem_start = ovl->dma_handle; in sh_mobile_lcdc_overlay_fb_init()
1580 info->fix.smem_len = ovl->fb_size; in sh_mobile_lcdc_overlay_fb_init()
1581 info->fix.line_length = ovl->pitch; in sh_mobile_lcdc_overlay_fb_init()
1583 if (ovl->format->yuv) in sh_mobile_lcdc_overlay_fb_init()
1588 switch (ovl->format->fourcc) { in sh_mobile_lcdc_overlay_fb_init()
1601 var->xres = ovl->xres; in sh_mobile_lcdc_overlay_fb_init()
1602 var->yres = ovl->yres; in sh_mobile_lcdc_overlay_fb_init()
1603 var->xres_virtual = ovl->xres_virtual; in sh_mobile_lcdc_overlay_fb_init()
1604 var->yres_virtual = ovl->yres_virtual; in sh_mobile_lcdc_overlay_fb_init()
1610 if (!ovl->format->yuv) in sh_mobile_lcdc_overlay_fb_init()
1611 var->bits_per_pixel = ovl->format->bpp; in sh_mobile_lcdc_overlay_fb_init()
1613 var->grayscale = ovl->format->fourcc; in sh_mobile_lcdc_overlay_fb_init()
2258 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_remove() local
2260 sh_mobile_lcdc_overlay_fb_cleanup(ovl); in sh_mobile_lcdc_remove()
2262 if (ovl->fb_mem) in sh_mobile_lcdc_remove()
2263 dma_free_coherent(&pdev->dev, ovl->fb_size, in sh_mobile_lcdc_remove()
2264 ovl->fb_mem, ovl->dma_handle); in sh_mobile_lcdc_remove()
2344 sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl) in sh_mobile_lcdc_overlay_init() argument
2347 struct device *dev = ovl->channel->lcdc->dev; in sh_mobile_lcdc_overlay_init()
2350 if (ovl->cfg->fourcc == 0) in sh_mobile_lcdc_overlay_init()
2354 format = sh_mobile_format_info(ovl->cfg->fourcc); in sh_mobile_lcdc_overlay_init()
2356 dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc); in sh_mobile_lcdc_overlay_init()
2360 ovl->enabled = false; in sh_mobile_lcdc_overlay_init()
2361 ovl->mode = LCDC_OVERLAY_BLEND; in sh_mobile_lcdc_overlay_init()
2362 ovl->alpha = 255; in sh_mobile_lcdc_overlay_init()
2363 ovl->rop3 = 0; in sh_mobile_lcdc_overlay_init()
2364 ovl->pos_x = 0; in sh_mobile_lcdc_overlay_init()
2365 ovl->pos_y = 0; in sh_mobile_lcdc_overlay_init()
2370 ovl->format = format; in sh_mobile_lcdc_overlay_init()
2371 ovl->xres = ovl->cfg->max_xres; in sh_mobile_lcdc_overlay_init()
2372 ovl->xres_virtual = ovl->xres; in sh_mobile_lcdc_overlay_init()
2373 ovl->yres = ovl->cfg->max_yres; in sh_mobile_lcdc_overlay_init()
2374 ovl->yres_virtual = ovl->yres * 2; in sh_mobile_lcdc_overlay_init()
2377 ovl->pitch = ovl->xres_virtual * format->bpp / 8; in sh_mobile_lcdc_overlay_init()
2379 ovl->pitch = ovl->xres_virtual; in sh_mobile_lcdc_overlay_init()
2382 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres in sh_mobile_lcdc_overlay_init()
2384 ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle, in sh_mobile_lcdc_overlay_init()
2386 if (!ovl->fb_mem) { in sh_mobile_lcdc_overlay_init()
2391 ret = sh_mobile_lcdc_overlay_fb_init(ovl); in sh_mobile_lcdc_overlay_init()
2606 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_probe() local
2608 ovl->cfg = &pdata->overlays[i]; in sh_mobile_lcdc_probe()
2609 ovl->channel = &priv->ch[0]; in sh_mobile_lcdc_probe()
2611 error = sh_mobile_lcdc_overlay_init(ovl); in sh_mobile_lcdc_probe()
2631 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i]; in sh_mobile_lcdc_probe() local
2633 error = sh_mobile_lcdc_overlay_fb_register(ovl); in sh_mobile_lcdc_probe()