Ejemplo n.º 1
0
static int s3cfb_register_framebuffer(struct s3cfb_global *ctrl)
{
	struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev);
	int ret, i, j;

	for (i = pdata->default_win;
		i < pdata->nr_wins + pdata->default_win; i++) {
			j = i % pdata->nr_wins;
			ret = register_framebuffer(ctrl->fb[j]);
			if (ret) {
				dev_err(ctrl->dev, "failed to register "
						"framebuffer device\n");
				return -EINVAL;
				goto err_register_fb;
			}
#ifndef CONFIG_FRAMEBUFFER_CONSOLE
			if (j == pdata->default_win) {
				s3cfb_check_var(&ctrl->fb[j]->var, ctrl->fb[j]);
				s3cfb_set_par(ctrl->fb[j]);
				s3cfb_draw_logo(ctrl->fb[j]);
			}
#endif
	}

	return 0;
err_register_fb:
	while (--i >= pdata->default_win) {
		j = i % pdata->nr_wins;
		unregister_framebuffer(ctrl->fb[j]);
	}
	return ret;
}
Ejemplo n.º 2
0
int s3cfb_register_framebuffer(void)
{
	struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev);
	int ret, i, j;

	/* on registering framebuffer, framebuffer of default window is registered at first. */
	for (i = pdata->default_win; i < pdata->nr_wins + pdata->default_win; i++) {
		j = i % pdata->nr_wins;
		ret = register_framebuffer(fbdev->fb[j]);
		if (ret) {
			dev_err(fbdev->dev, "failed to register "
				"framebuffer device\n");
			return -EINVAL;
		}
#ifndef CONFIG_FRAMEBUFFER_CONSOLE
		if (j == pdata->default_win) {
			s3cfb_check_var(&fbdev->fb[j]->var, fbdev->fb[j]);
			s3cfb_set_par(fbdev->fb[j]);
			s3cfb_draw_logo(fbdev->fb[j]);
		}
#endif
	}

	return 0;
}
Ejemplo n.º 3
0
void s3cfb_late_resume(struct early_suspend *h)
{
    struct s3cfb_global *fbdev =
        container_of(h, struct s3cfb_global, early_suspend);
    struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev);
    struct platform_device *pdev = to_platform_device(fbdev->dev);
    struct fb_info *fb;
    struct s3cfb_window *win;
    int i, j, ret;

    pr_info("s3cfb_late_resume is called\n");

    ret = regulator_enable(fbdev->regulator);
    if (ret < 0)
        dev_err(fbdev->dev, "failed to enable regulator\n");

    ret = regulator_enable(fbdev->vcc_lcd);
    if (ret < 0)
        dev_err(fbdev->dev, "failed to enable vcc_lcd\n");

    ret = regulator_enable(fbdev->vlcd);
    if (ret < 0)
        dev_err(fbdev->dev, "failed to enable vlcd\n");

#if defined(CONFIG_FB_S3C_TL2796)
    lcd_cfg_gpio_late_resume();
#endif
    dev_dbg(fbdev->dev, "wake up from suspend\n");
    if (pdata->cfg_gpio)
        pdata->cfg_gpio(pdev);

    clk_enable(fbdev->clock);
    s3cfb_init_global(fbdev);
    s3cfb_set_clock(fbdev);

    s3cfb_display_on(fbdev);

    for (i = pdata->default_win;
            i < pdata->nr_wins + pdata->default_win; i++) {
        j = i % pdata->nr_wins;
        fb = fbdev->fb[j];
        win = fb->par;
        if ((win->path == DATA_PATH_DMA) && (win->enabled)) {
            s3cfb_set_par(fb);
            s3cfb_set_window(fbdev, win->id, 1);
        }
    }

    s3cfb_set_vsync_interrupt(fbdev, 1);
    s3cfb_set_global_interrupt(fbdev, 1);

    if (pdata->backlight_on)
        pdata->backlight_on(pdev);

    if (pdata->reset_lcd)
        pdata->reset_lcd(pdev);

    pr_info("s3cfb_late_resume is complete\n");
    return ;
}
Ejemplo n.º 4
0
int s3cfb_resume(struct platform_device *pdev)
{
	struct s3c_platform_fb *pdata = to_fb_plat(&pdev->dev);
	struct fb_info *fb;
	struct s3cfb_window *win;
	int i;

	dev_dbg(ctrl->dev, "wake up from suspend\n");

	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);

	if (pdata->backlight_on)
		pdata->backlight_on(pdev);

	if (pdata->lcd_on)
		pdata->lcd_on(pdev);

	if (ctrl->lcd->init_ldi)
		ctrl->lcd->init_ldi();

	clk_enable(ctrl->clock);
	s3cfb_init_global();
	s3cfb_set_clock(ctrl);
	s3cfb_display_on(ctrl);

	for (i = 0; i < pdata->nr_wins; i++) {
		fb = ctrl->fb[i];
		win = fb->par;

		if (win->path == DATA_PATH_FIFO && win->resume_fifo) {
			if (win->resume_fifo())
				dev_info(ctrl->dev, "failed to run the resume for fifo\n");
		} else {
			if (win->enabled) {
				s3cfb_check_var(&fb->var, fb);
				s3cfb_set_par(fb);
				s3cfb_enable_window(win->id);
			}
		}
	}

	return 0;
}
Ejemplo n.º 5
0
int s3cfb_register_framebuffer(void)
{
	struct s3c_platform_fb *pdata = to_fb_plat(ctrl->dev);
	int ret, i;

	for (i = 0; i < pdata->nr_wins; i++) {
		ret = register_framebuffer(ctrl->fb[i]);
		if (ret) {
			dev_err(ctrl->dev, "failed to register framebuffer device\n");
			return -EINVAL;
		}

#ifndef CONFIG_FRAMEBUFFER_CONSOLE
		if (i == pdata->default_win) {
			s3cfb_check_var(&ctrl->fb[i]->var, ctrl->fb[i]);
			s3cfb_set_par(ctrl->fb[i]);
			s3cfb_draw_logo(ctrl->fb[i]);
		}
#endif
	}

	return 0;
}
Ejemplo n.º 6
0
void s3cfb_late_resume(struct early_suspend *h)
{
	struct s3cfb_global *info = container_of(h,struct s3cfb_global,early_suspend);
	struct s3c_platform_fb *pdata = to_fb_plat(info->dev);
	struct fb_info *fb;
	struct s3cfb_window *win;
	int i, j;
	struct platform_device *pdev = to_platform_device(info->dev);

	printk("s3cfb_late_resume is called\n");

	//urbetter
	if (pdata->backlight_off)
		pdata->backlight_off(pdev);

#ifdef ENABLE_SMDKV210_REGULATOR //urbetter
	/* ldo6 regulator on */
	regulator_enable(lcd_regulator);
#endif
	dev_dbg(info->dev, "wake up from suspend\n");
	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);

#if defined(CONFIG_FB_S3C_DUMMYLCD)
	max8698_ldo_enable_direct(MAX8698_LDO4);
#endif


#if defined (CONFIG_FB_S3C_LTE480WV) || defined(CONFIG_FB_S3C_UT10GM) || defined(CONFIG_FB_S3C_UT7GM) || defined(CONFIG_FB_URBETTER_SERIAL) || defined(CONFIG_FB_S3C_UTAUO104)
	if (info->lcd->init_ldi)
		fbdev->lcd->init_ldi();
	else
		printk("no init_ldi\n");
#endif

	if (pdata->clk_on)
		pdata->clk_on(pdev, &fbdev->clock);
	s3cfb_init_global();
	s3cfb_set_clock(info);

	s3cfb_display_on(info);

	for (i = pdata->default_win; i < pdata->nr_wins + pdata->default_win; i++) {
		j = i % pdata->nr_wins;
		fb = info->fb[j];
		win = fb->par;
		if ((win->path == DATA_PATH_DMA) && (win->enabled)) {
			s3cfb_set_par(fb);
			s3cfb_enable_window(win->id);
		}
	}

#if 1
	// enable VSYNC
	s3cfb_set_vsync_interrupt(fbdev, 1);
	s3cfb_set_global_interrupt(fbdev, 1);
#endif

	/* Reset the LDI chip */
	if (pdata->lcd_on)
		pdata->lcd_on(pdev);

#if defined(CONFIG_FB_S3C_TL2796)
	tl2796_ldi_init();
	tl2796_ldi_enable();
#elif defined (CONFIG_FB_S3C_LTE480WV) || defined(CONFIG_FB_S3C_UT10GM) || defined(CONFIG_FB_S3C_UT7GM) || defined(CONFIG_FB_URBETTER_SERIAL) || defined(CONFIG_FB_S3C_UTAUO104)
	if (info->lcd->init_ldi)
		fbdev->lcd->init_ldi();
	else
		printk("no init_ldi\n");
#endif

	if (pdata->backlight_on)
		pdata->backlight_on(pdev);
	return ;
}
Ejemplo n.º 7
0
int s3cfb_direct_ioctl(int id, unsigned int cmd, unsigned long arg)
{
	struct fb_info *fb = ctrl->fb[id];
	struct fb_var_screeninfo *var = &fb->var;
	struct s3cfb_window *win = fb->par;
	struct s3cfb_lcd *lcd = ctrl->lcd;
	struct s3cfb_user_window user_win;
	void *argp = (void *) arg;
	int ret = 0;

	switch (cmd) {
	case FBIO_ALLOC:
		win->path = (enum s3cfb_data_path_t) argp;
		break;

	case FBIOGET_FSCREENINFO:
		ret = memcpy(argp, &fb->fix, sizeof(fb->fix)) ? 0 : -EFAULT;
		break;

	case FBIOGET_VSCREENINFO:
		ret = memcpy(argp, &fb->var, sizeof(fb->var)) ? 0 : -EFAULT;
		break;

	case FBIOPUT_VSCREENINFO:
		ret = s3cfb_check_var((struct fb_var_screeninfo *) argp, fb);
		if (ret) {
			dev_err(ctrl->dev, "invalid vscreeninfo\n");
			break;
		}

		ret = memcpy(&fb->var, (struct fb_var_screeninfo *) argp,
				sizeof(fb->var)) ? 0 : -EFAULT;
		if (ret) {
			dev_err(ctrl->dev, "failed to put new vscreeninfo\n");
			break;
		}

		ret = s3cfb_set_par(fb);
		break;

	case S3CFB_WIN_POSITION:
		ret = memcpy(&user_win, (struct s3cfb_user_window __user *) arg,
				sizeof(user_win)) ? 0 : -EFAULT;
		if (ret) {
			dev_err(ctrl->dev, "failed to S3CFB_WIN_POSITION.\n");
			break;
		}

		if (user_win.x < 0)
			user_win.x = 0;

		if (user_win.y < 0)
			user_win.y = 0;

		if (user_win.x + var->xres > lcd->width)
			win->x = lcd->width - var->xres;
		else
			win->x = user_win.x;

		if (user_win.y + var->yres > lcd->height)
			win->y = lcd->height - var->yres;
		else
			win->y = user_win.y;

		s3cfb_set_window_position(ctrl, win->id);
		break;

	case S3CFB_SET_SUSPEND_FIFO:
		win->suspend_fifo = argp;
		break;

	case S3CFB_SET_RESUME_FIFO:
		win->resume_fifo = argp;
		break;

	/*
	 * for FBIO_WAITFORVSYNC
	*/
	default:
		ret = s3cfb_ioctl(fb, cmd, arg);
		break;
	}

	return ret;
}
Ejemplo n.º 8
0
void s3cfb_late_resume(struct early_suspend *h)
{
	struct s3cfb_global *fbdev =
		container_of(h, struct s3cfb_global, early_suspend);
	struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev);
	struct platform_device *pdev = to_platform_device(fbdev->dev);
	struct fb_info *fb;
	struct s3cfb_window *win;
	int i, j, ret;

	pr_info("s3cfb_late_resume is called\n");

	ret = regulator_enable(fbdev->regulator);
	if (ret < 0)
		dev_err(fbdev->dev, "failed to enable regulator\n");

#ifdef CONFIG_MACH_ARIES
	ret = regulator_enable(fbdev->vcc_lcd);
	if (ret < 0)
		dev_err(fbdev->dev, "failed to enable vcc_lcd\n");

	ret = regulator_enable(fbdev->vlcd);
	if (ret < 0)
		dev_err(fbdev->dev, "failed to enable vlcd\n");
#endif

#if defined(CONFIG_FB_S3C_TL2796)
	lcd_cfg_gpio_late_resume();
#endif
	dev_dbg(fbdev->dev, "wake up from suspend\n");
	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);

	clk_enable(fbdev->clock);
#ifdef CONFIG_FB_S3C_MDNIE
	writel(0x1, S5P_MDNIE_SEL);
	writel(3,fbdev->regs + 0x27c);
#endif
	s3cfb_init_global(fbdev);
	s3cfb_set_clock(fbdev);
#ifdef CONFIG_FB_S3C_MDNIE
	s3c_mdnie_init_global(fbdev);
	s3c_mdnie_start(fbdev);
#endif

#ifdef CONFIG_FB_S3C_CMC623
	tune_cmc623_pre_resume();
#endif
	s3cfb_set_alpha_value_width(fbdev, pdata->default_win);

	s3cfb_display_on(fbdev);

#ifdef CONFIG_FB_S3C_CMC623
	tune_cmc623_resume();
#endif

#if defined (CONFIG_FB_S3C_LVDS)
	lms700_powerup();
#endif

	for (i = pdata->default_win;
		i < pdata->nr_wins + pdata->default_win; i++) {
			j = i % pdata->nr_wins;
			fb = fbdev->fb[j];
			win = fb->par;
			if ((win->path == DATA_PATH_DMA) && (win->enabled)) {
				s3cfb_set_par(fb);
				s3cfb_set_window(fbdev, win->id, 1);
			}
	}

	s3cfb_set_vsync_interrupt(fbdev, 1);
	s3cfb_set_global_interrupt(fbdev, 1);

	if (pdata->backlight_on)
		pdata->backlight_on(pdev);

	if (pdata->reset_lcd)
		pdata->reset_lcd(pdev);

	pr_info("s3cfb_late_resume is complete\n");
	return ;
}