Exemplo n.º 1
0
int s3cfb_set_buffer_address(struct s3cfb_global *ctrl, int id)
{
	struct fb_fix_screeninfo *fix = &ctrl->fb[id]->fix;
	struct fb_var_screeninfo *var = &ctrl->fb[id]->var;
	struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev);
	dma_addr_t start_addr = 0, end_addr = 0;
	u32 shw;

	if (fix->smem_start) {
		start_addr = fix->smem_start + (var->xres_virtual *
				(var->bits_per_pixel / 8) * var->yoffset);

		end_addr = start_addr + fix->line_length * var->yres;
	}

	if (pdata->hw_ver == 0x62) {
		shw = readl(ctrl->regs + S3C_WINSHMAP);
		shw |= S3C_WINSHMAP_PROTECT(id);
		writel(shw, ctrl->regs + S3C_WINSHMAP);
	}

	writel(start_addr, ctrl->regs + S3C_VIDADDR_START0(id));
	writel(end_addr, ctrl->regs + S3C_VIDADDR_END0(id));

	if (pdata->hw_ver == 0x62) {
		shw = readl(ctrl->regs + S3C_WINSHMAP);
		shw &= ~(S3C_WINSHMAP_PROTECT(id));
		writel(shw, ctrl->regs + S3C_WINSHMAP);
	}

	dev_dbg(ctrl->dev, "[fb%d] start_addr: 0x%08x, end_addr: 0x%08x\n",
		id, start_addr, end_addr);

	return 0;
}
Exemplo n.º 2
0
int s3cfb_set_buffer_address(struct s3cfb_global *ctrl, int id)
{
	struct fb_fix_screeninfo *fix = &ctrl->fb[id]->fix;
	struct fb_var_screeninfo *var = &ctrl->fb[id]->var;
	dma_addr_t start_addr, end_addr;

	start_addr = fix->smem_start + (var->xres_virtual * \
			(var->bits_per_pixel / 8) * var->yoffset);

	end_addr = start_addr + (var->xres_virtual * \
			(var->bits_per_pixel / 8) * var->yres);

	writel(start_addr, ctrl->regs + S3C_VIDADDR_START0(id));
	writel(end_addr, ctrl->regs + S3C_VIDADDR_END0(id));

	dev_dbg(ctrl->dev, "[fb%d] start_addr: 0x%08x, end_addr: 0x%08x\n", \
		id, start_addr, end_addr);

	return 0;
}
Exemplo n.º 3
0
int s3cfb_set_buffer_address(struct s3cfb_global *ctrl, int id)
{
    struct fb_fix_screeninfo *fix = &ctrl->fb[id]->fix;
    struct fb_var_screeninfo *var = &ctrl->fb[id]->var;
    struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev);
    dma_addr_t start_addr = 0, end_addr = 0;
    u32 shw;

    if (fix->smem_start) {
        // namko: Page-align for odd resolutions.
        // This works as long as yoffset is a multiple of yres.
        unsigned int frame_size = ALIGN(fix->line_length * var->yres, PAGE_SIZE);
        start_addr = fix->smem_start + (var->yoffset / var->yres) * frame_size;

        end_addr = start_addr + fix->line_length * var->yres;
    }

    if (pdata->hw_ver == 0x62) {
        shw = readl(ctrl->regs + S3C_WINSHMAP);
        shw |= S3C_WINSHMAP_PROTECT(id);
        writel(shw, ctrl->regs + S3C_WINSHMAP);
    }

    writel(start_addr, ctrl->regs + S3C_VIDADDR_START0(id));
    writel(end_addr, ctrl->regs + S3C_VIDADDR_END0(id));

    if (pdata->hw_ver == 0x62) {
        shw = readl(ctrl->regs + S3C_WINSHMAP);
        shw &= ~(S3C_WINSHMAP_PROTECT(id));
        writel(shw, ctrl->regs + S3C_WINSHMAP);
    }

    dev_dbg(ctrl->dev, "[fb%d] start_addr: 0x%08x, end_addr: 0x%08x\n",
            id, start_addr, end_addr);

    return 0;
}
Exemplo n.º 4
0
int s3cfb_set_oneshot(struct s3cfb_global *ctrl, int id)
{
	struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev);
	struct fb_var_screeninfo *var = &ctrl->fb[id]->var;
	struct fb_fix_screeninfo *fix = &ctrl->fb[id]->fix;
	struct s3cfb_window *win = ctrl->fb[id]->par;
	u32 cfg, shw;
	u32 offset = (var->xres_virtual - var->xres) * var->bits_per_pixel / 8;
	dma_addr_t start_addr = 0, end_addr = 0;

	/*  Shadow Register Protection */
	if ((pdata->hw_ver == 0x62) || (pdata->hw_ver == 0x70)) {
		shw = readl(ctrl->regs + S3C_WINSHMAP);
		shw |= S3C_WINSHMAP_PROTECT(id);
		writel(shw, ctrl->regs + S3C_WINSHMAP);
	}

	/*  s3cfb_set_window_position */
	cfg = S3C_VIDOSD_LEFT_X(win->x) | S3C_VIDOSD_TOP_Y(win->y);
	writel(cfg, ctrl->regs + S3C_VIDOSD_A(id));

	cfg = S3C_VIDOSD_RIGHT_X(win->x + var->xres - 1) |
		S3C_VIDOSD_BOTTOM_Y(win->y + var->yres - 1);
	writel(cfg, ctrl->regs + S3C_VIDOSD_B(id));

	dev_dbg(ctrl->dev, "[fb%d] offset: (%d, %d, %d, %d)\n", id,
			win->x, win->y, win->x + var->xres - 1, win->y + var->yres - 1);

	/* s3cfb_set_buffer_address */
	if (fix->smem_start) {
		start_addr = fix->smem_start + ((var->xres_virtual *
				var->yoffset + var->xoffset) *
				(var->bits_per_pixel / 8));

		end_addr = start_addr + fix->line_length * var->yres;
	}

	writel(start_addr, ctrl->regs + S3C_VIDADDR_START0(id));
	writel(end_addr, ctrl->regs + S3C_VIDADDR_END0(id));

	dev_dbg(ctrl->dev, "[fb%d] start_addr: 0x%08x, end_addr: 0x%08x\n",
		id, start_addr, end_addr);

	/*  s3cfb_set_window_size */
	if (id <= 2) {
		cfg = S3C_VIDOSD_SIZE(var->xres * var->yres);
		if (id == 0)
			writel(cfg, ctrl->regs + S3C_VIDOSD_C(id));
		else
			writel(cfg, ctrl->regs + S3C_VIDOSD_D(id));

		dev_dbg(ctrl->dev, "[fb%d] resolution: %d x %d\n", id,
				var->xres, var->yres);
	}

	/*  s3cfb_set_buffer_size */
	cfg = S3C_VIDADDR_PAGEWIDTH(var->xres * var->bits_per_pixel / 8);
	cfg |= S3C_VIDADDR_OFFSIZE(offset);
	writel(cfg, ctrl->regs + S3C_VIDADDR_SIZE(id));

	/*  Shadow Register Un-Protection */
	if ((pdata->hw_ver == 0x62) || (pdata->hw_ver == 0x70)) {
		shw = readl(ctrl->regs + S3C_WINSHMAP);
		shw &= ~(S3C_WINSHMAP_PROTECT(id));
		writel(shw, ctrl->regs + S3C_WINSHMAP);
	}

	return 0;
}