Lines Matching refs:ovl

309 static void lcdc_write_overlay(struct sh_mobile_lcdc_overlay *ovl,
312 iowrite32(data, ovl->channel->lcdc->base + reg);
313 iowrite32(data, ovl->channel->lcdc->base + reg + SIDE_B_OFFSET);
773 static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl)
777 if (!ovl->enabled) {
778 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
779 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), 0);
780 lcdc_write(ovl->channel->lcdc, LDBCR,
781 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
785 ovl->base_addr_y = ovl->dma_handle;
786 ovl->base_addr_c = ovl->dma_handle
787 + ovl->xres_virtual * ovl->yres_virtual;
789 switch (ovl->mode) {
791 format = LDBBSIFR_EN | (ovl->alpha << LDBBSIFR_LAY_SHIFT);
796 | (ovl->rop3 << LDBBSIFR_ROP3_SHIFT);
800 switch (ovl->format->fourcc) {
819 switch (ovl->format->fourcc) {
843 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
845 lcdc_write_overlay(ovl, LDBnBSIFR(ovl->index), format);
847 lcdc_write_overlay(ovl, LDBnBSSZR(ovl->index),
848 (ovl->yres << LDBBSSZR_BVSS_SHIFT) |
849 (ovl->xres << LDBBSSZR_BHSS_SHIFT));
850 lcdc_write_overlay(ovl, LDBnBLOCR(ovl->index),
851 (ovl->pos_y << LDBBLOCR_CVLC_SHIFT) |
852 (ovl->pos_x << LDBBLOCR_CHLC_SHIFT));
853 lcdc_write_overlay(ovl, LDBnBSMWR(ovl->index),
854 ovl->pitch << LDBBSMWR_BSMW_SHIFT);
856 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y);
857 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c);
859 lcdc_write(ovl->channel->lcdc, LDBCR,
860 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
1026 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[k];
1027 sh_mobile_lcdc_overlay_setup(ovl);
1189 struct sh_mobile_lcdc_overlay *ovl = info->par;
1191 return sysfs_emit(buf, "%u\n", ovl->alpha);
1199 struct sh_mobile_lcdc_overlay *ovl = info->par;
1213 if (ovl->alpha != alpha) {
1214 ovl->alpha = alpha;
1216 if (ovl->mode == LCDC_OVERLAY_BLEND && ovl->enabled)
1217 sh_mobile_lcdc_overlay_setup(ovl);
1227 struct sh_mobile_lcdc_overlay *ovl = info->par;
1229 return sysfs_emit(buf, "%u\n", ovl->mode);
1237 struct sh_mobile_lcdc_overlay *ovl = info->par;
1251 if (ovl->mode != mode) {
1252 ovl->mode = mode;
1254 if (ovl->enabled)
1255 sh_mobile_lcdc_overlay_setup(ovl);
1266 struct sh_mobile_lcdc_overlay *ovl = info->par;
1268 return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y);
1276 struct sh_mobile_lcdc_overlay *ovl = info->par;
1292 if (ovl->pos_x != pos_x || ovl->pos_y != pos_y) {
1293 ovl->pos_x = pos_x;
1294 ovl->pos_y = pos_y;
1296 if (ovl->enabled)
1297 sh_mobile_lcdc_overlay_setup(ovl);
1307 struct sh_mobile_lcdc_overlay *ovl = info->par;
1309 return sysfs_emit(buf, "%u\n", ovl->rop3);
1317 struct sh_mobile_lcdc_overlay *ovl = info->par;
1331 if (ovl->rop3 != rop3) {
1332 ovl->rop3 = rop3;
1334 if (ovl->mode == LCDC_OVERLAY_ROP3 && ovl->enabled)
1335 sh_mobile_lcdc_overlay_setup(ovl);
1366 struct sh_mobile_lcdc_overlay *ovl = info->par;
1372 if (!ovl->format->yuv) {
1373 y_offset = (var->yoffset * ovl->xres_virtual + var->xoffset)
1374 * ovl->format->bpp / 8;
1377 unsigned int xsub = ovl->format->bpp < 24 ? 2 : 1;
1378 unsigned int ysub = ovl->format->bpp < 16 ? 2 : 1;
1380 y_offset = var->yoffset * ovl->xres_virtual + var->xoffset;
1381 c_offset = var->yoffset / ysub * ovl->xres_virtual * 2 / xsub
1388 if (y_offset == ovl->pan_y_offset)
1392 base_addr_y = ovl->dma_handle + y_offset;
1393 base_addr_c = ovl->dma_handle + ovl->xres_virtual * ovl->yres_virtual
1396 ovl->base_addr_y = base_addr_y;
1397 ovl->base_addr_c = base_addr_c;
1398 ovl->pan_y_offset = y_offset;
1400 lcdc_write(ovl->channel->lcdc, LDBCR, LDBCR_UPC(ovl->index));
1402 lcdc_write_overlay(ovl, LDBnBSAYR(ovl->index), ovl->base_addr_y);
1403 lcdc_write_overlay(ovl, LDBnBSACR(ovl->index), ovl->base_addr_c);
1405 lcdc_write(ovl->channel->lcdc, LDBCR,
1406 LDBCR_UPF(ovl->index) | LDBCR_UPD(ovl->index));
1414 struct sh_mobile_lcdc_overlay *ovl = info->par;
1418 return sh_mobile_lcdc_wait_for_vsync(ovl->channel);
1433 struct sh_mobile_lcdc_overlay *ovl = info->par;
1435 ovl->format =
1438 ovl->xres = info->var.xres;
1439 ovl->xres_virtual = info->var.xres_virtual;
1440 ovl->yres = info->var.yres;
1441 ovl->yres_virtual = info->var.yres_virtual;
1443 if (ovl->format->yuv)
1444 ovl->pitch = info->var.xres_virtual;
1446 ovl->pitch = info->var.xres_virtual * ovl->format->bpp / 8;
1448 sh_mobile_lcdc_overlay_setup(ovl);
1450 info->fix.line_length = ovl->pitch;
1466 struct sh_mobile_lcdc_overlay *ovl = info->par;
1468 ovl->enabled = !blank;
1469 sh_mobile_lcdc_overlay_setup(ovl);
1480 struct sh_mobile_lcdc_overlay *ovl = info->par;
1485 return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem,
1486 ovl->dma_handle, ovl->fb_size);
1505 sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl)
1507 struct fb_info *info = ovl->info;
1512 unregister_framebuffer(ovl->info);
1516 sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
1518 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
1519 struct fb_info *info = ovl->info;
1531 dev_name(lcdc->dev), ovl->index, info->var.xres,
1544 sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl)
1546 struct fb_info *info = ovl->info;
1555 sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
1557 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc;
1566 ovl->info = info;
1570 info->screen_buffer = ovl->fb_mem;
1571 info->par = ovl;
1578 "SH Mobile LCDC Overlay %u", ovl->index);
1579 info->fix.smem_start = ovl->dma_handle;
1580 info->fix.smem_len = ovl->fb_size;
1581 info->fix.line_length = ovl->pitch;
1583 if (ovl->format->yuv)
1588 switch (ovl->format->fourcc) {
1601 var->xres = ovl->xres;
1602 var->yres = ovl->yres;
1603 var->xres_virtual = ovl->xres_virtual;
1604 var->yres_virtual = ovl->yres_virtual;
1610 if (!ovl->format->yuv)
1611 var->bits_per_pixel = ovl->format->bpp;
1613 var->grayscale = ovl->format->fourcc;
2263 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2265 sh_mobile_lcdc_overlay_fb_cleanup(ovl);
2267 if (ovl->fb_mem)
2268 dma_free_coherent(&pdev->dev, ovl->fb_size,
2269 ovl->fb_mem, ovl->dma_handle);
2349 sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
2352 struct device *dev = ovl->channel->lcdc->dev;
2355 if (ovl->cfg->fourcc == 0)
2359 format = sh_mobile_format_info(ovl->cfg->fourcc);
2361 dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
2365 ovl->enabled = false;
2366 ovl->mode = LCDC_OVERLAY_BLEND;
2367 ovl->alpha = 255;
2368 ovl->rop3 = 0;
2369 ovl->pos_x = 0;
2370 ovl->pos_y = 0;
2375 ovl->format = format;
2376 ovl->xres = ovl->cfg->max_xres;
2377 ovl->xres_virtual = ovl->xres;
2378 ovl->yres = ovl->cfg->max_yres;
2379 ovl->yres_virtual = ovl->yres * 2;
2382 ovl->pitch = ovl->xres_virtual * format->bpp / 8;
2384 ovl->pitch = ovl->xres_virtual;
2387 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres
2389 ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle,
2391 if (!ovl->fb_mem) {
2396 ret = sh_mobile_lcdc_overlay_fb_init(ovl);
2611 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2613 ovl->cfg = &pdata->overlays[i];
2614 ovl->channel = &priv->ch[0];
2616 error = sh_mobile_lcdc_overlay_init(ovl);
2636 struct sh_mobile_lcdc_overlay *ovl = &priv->overlays[i];
2638 error = sh_mobile_lcdc_overlay_fb_register(ovl);