Lines Matching refs:ovl

310 static void lcdc_write_overlay(struct sh_mobile_lcdc_overlay *ovl,
313 iowrite32(data, ovl->channel->lcdc->base + reg);
314 iowrite32(data, ovl->channel->lcdc->base + reg + SIDE_B_OFFSET);
780 static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl)
784 if (!ovl->enabled) {
785 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
786 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), 0);
787 lcdc_write(ovl->channel->lcdc, LDBCR,
788 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
792 ovl->base_addr_y = ovl->dma_handle;
793 ovl->base_addr_c = ovl->dma_handle
794 + ovl->xres_virtual * ovl->yres_virtual;
796 switch (ovl->mode) {
798 format = LDBBSIFR_EN | (ovl->alpha << LDBBSIFR_LAY_SHIFT);
803 | (ovl->rop3 << LDBBSIFR_ROP3_SHIFT);
807 switch (ovl->format->fourcc) {
826 switch (ovl->format->fourcc) {
850 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
852 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), format);
854 lcdc_write_overlay(ovl, LDBnBSSZR(ovl->index),
855 (ovl->yres << LDBBSSZR_BVSS_SHIFT) |
856 (ovl->xres << LDBBSSZR_BHSS_SHIFT));
857 lcdc_write_overlay(ovl, LDBnBLOCR(ovl->index),
858 (ovl->pos_y << LDBBLOCR_CVLC_SHIFT) |
859 (ovl->pos_x << LDBBLOCR_CHLC_SHIFT));
860 lcdc_write_overlay(ovl, LDBnBSMWR(ovl->index),
861 ovl->pitch << LDBBSMWR_BSMW_SHIFT);
863 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y);
864 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c);
866 lcdc_write(ovl->channel->lcdc, LDBCR,
867 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
1033 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[k];
1034 sh_mobile_lcdc_overlay_setup(ovl);
1196 struct sh_mobile_lcdc_overlay *ovl = info->par;
1198 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha);
1206 struct sh_mobile_lcdc_overlay *ovl = info->par;
1220 if (ovl->alpha != alpha) {
1221 ovl->alpha = alpha;
1223 if (ovl->mode == LCDC_OVERLAY_BLEND && ovl->enabled)
1224 sh_mobile_lcdc_overlay_setup(ovl);
1234 struct sh_mobile_lcdc_overlay *ovl = info->par;
1236 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode);
1244 struct sh_mobile_lcdc_overlay *ovl = info->par;
1258 if (ovl->mode != mode) {
1259 ovl->mode = mode;
1261 if (ovl->enabled)
1262 sh_mobile_lcdc_overlay_setup(ovl);
1273 struct sh_mobile_lcdc_overlay *ovl = info->par;
1275 return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y);
1283 struct sh_mobile_lcdc_overlay *ovl = info->par;
1299 if (ovl->pos_x != pos_x || ovl->pos_y != pos_y) {
1300 ovl->pos_x = pos_x;
1301 ovl->pos_y = pos_y;
1303 if (ovl->enabled)
1304 sh_mobile_lcdc_overlay_setup(ovl);
1314 struct sh_mobile_lcdc_overlay *ovl = info->par;
1316 return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3);
1324 struct sh_mobile_lcdc_overlay *ovl = info->par;
1338 if (ovl->rop3 != rop3) {
1339 ovl->rop3 = rop3;
1341 if (ovl->mode == LCDC_OVERLAY_ROP3 && ovl->enabled)
1342 sh_mobile_lcdc_overlay_setup(ovl);
1373 struct sh_mobile_lcdc_overlay *ovl = info->par;
1379 if (!ovl->format->yuv) {
1380 y_offset = (var->yoffset * ovl->xres_virtual + var->xoffset)
1381 * ovl->format->bpp / 8;
1384 unsigned int xsub = ovl->format->bpp < 24 ? 2 : 1;
1385 unsigned int ysub = ovl->format->bpp < 16 ? 2 : 1;
1387 y_offset = var->yoffset * ovl->xres_virtual + var->xoffset;
1388 c_offset = var->yoffset / ysub * ovl->xres_virtual * 2 / xsub
1395 if (y_offset == ovl->pan_y_offset)
1399 base_addr_y = ovl->dma_handle + y_offset;
1400 base_addr_c = ovl->dma_handle + ovl->xres_virtual * ovl->yres_virtual
1403 ovl->base_addr_y = base_addr_y;
1404 ovl->base_addr_c = base_addr_c;
1405 ovl->pan_y_offset = y_offset;
1407 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
1409 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y);
1410 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c);
1412 lcdc_write(ovl->channel->lcdc, LDBCR,
1413 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
1421 struct sh_mobile_lcdc_overlay *ovl = info->par;
1425 return sh_mobile_lcdc_wait_for_vsync(ovl->channel);
1440 struct sh_mobile_lcdc_overlay *ovl = info->par;
1442 ovl->format =
1445 ovl->xres = info->var.xres;
1446 ovl->xres_virtual = info->var.xres_virtual;
1447 ovl->yres = info->var.yres;
1448 ovl->yres_virtual = info->var.yres_virtual;
1450 if (ovl->format->yuv)
1451 ovl->pitch = info->var.xres_virtual;
1453 ovl->pitch = info->var.xres_virtual * ovl->format->bpp / 8;
1455 sh_mobile_lcdc_overlay_setup(ovl);
1457 info->fix.line_length = ovl->pitch;
1473 struct sh_mobile_lcdc_overlay *ovl = info->par;
1475 ovl->enabled = !blank;
1476 sh_mobile_lcdc_overlay_setup(ovl);
1487 struct sh_mobile_lcdc_overlay *ovl = info->par;
1489 return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem,
1490 ovl->dma_handle, ovl->fb_size);
1509 sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl)
1511 struct fb_info *info = ovl->info;
1516 unregister_framebuffer(ovl->info);
1520 sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
1522 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
1523 struct fb_info *info = ovl->info;
1535 dev_name(lcdc->dev), ovl->index, info->var.xres,
1548 sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl)
1550 struct fb_info *info = ovl->info;
1559 sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
1561 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc;
1570 ovl->info = info;
1575 info->screen_buffer = ovl->fb_mem;
1576 info->par = ovl;
1583 "SH Mobile LCDC Overlay %u", ovl->index);
1584 info->fix.smem_start = ovl->dma_handle;
1585 info->fix.smem_len = ovl->fb_size;
1586 info->fix.line_length = ovl->pitch;
1588 if (ovl->format->yuv)
1593 switch (ovl->format->fourcc) {
1606 var->xres = ovl->xres;
1607 var->yres = ovl->yres;
1608 var->xres_virtual = ovl->xres_virtual;
1609 var->yres_virtual = ovl->yres_virtual;
1615 if (!ovl->format->yuv)
1616 var->bits_per_pixel = ovl->format->bpp;
1618 var->grayscale = ovl->format->fourcc;
2266 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2268 sh_mobile_lcdc_overlay_fb_cleanup(ovl);
2270 if (ovl->fb_mem)
2271 dma_free_coherent(&pdev->dev, ovl->fb_size,
2272 ovl->fb_mem, ovl->dma_handle);
2353 sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
2356 struct device *dev = ovl->channel->lcdc->dev;
2359 if (ovl->cfg->fourcc == 0)
2363 format = sh_mobile_format_info(ovl->cfg->fourcc);
2365 dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
2369 ovl->enabled = false;
2370 ovl->mode = LCDC_OVERLAY_BLEND;
2371 ovl->alpha = 255;
2372 ovl->rop3 = 0;
2373 ovl->pos_x = 0;
2374 ovl->pos_y = 0;
2379 ovl->format = format;
2380 ovl->xres = ovl->cfg->max_xres;
2381 ovl->xres_virtual = ovl->xres;
2382 ovl->yres = ovl->cfg->max_yres;
2383 ovl->yres_virtual = ovl->yres * 2;
2386 ovl->pitch = ovl->xres_virtual * format->bpp / 8;
2388 ovl->pitch = ovl->xres_virtual;
2391 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres
2393 ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle,
2395 if (!ovl->fb_mem) {
2400 ret = sh_mobile_lcdc_overlay_fb_init(ovl);
2615 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2617 ovl->cfg = &pdata->overlays[i];
2618 ovl->channel = &priv->ch[0];
2620 error = sh_mobile_lcdc_overlay_init(ovl);
2640 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2642 error = sh_mobile_lcdc_overlay_fb_register(ovl);