void s3cfb_early_suspend(struct early_suspend *h) { struct s3cfb_global *fbdev = container_of(h, struct s3cfb_global, early_suspend); pr_debug("s3cfb_early_suspend is called\n"); #ifdef CONFIG_SCREEN_DIMMER if (!screen_is_dimmed()) { s3cfb_display_off(fbdev); clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(fbdev->vlcd); regulator_disable(fbdev->vcc_lcd); regulator_disable(fbdev->regulator); } #else s3cfb_display_off(fbdev); clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(fbdev->vlcd); regulator_disable(fbdev->vcc_lcd); regulator_disable(fbdev->regulator); #endif return ; }
int s3cfb_close_fifo(int id, int (*do_priv) (void *), void *param) { struct s3cfb_global *fbdev = get_fimd_global(id); struct s3cfb_window *win = fbdev->fb[id]->par; win->path = DATA_PATH_DMA; dev_dbg(fbdev->dev, "[fb%d] close fifo\n", win->id); if (do_priv) { s3cfb_display_off(fbdev); if (do_priv(param)) { dev_err(fbdev->dev, "failed to run for" "private fifo close\n"); s3cfb_enable_window(fbdev, id); s3cfb_display_on(fbdev); return -EFAULT; } s3cfb_disable_window(fbdev, id); s3cfb_disable_localpath(fbdev, id); s3cfb_display_on(fbdev); } else { s3cfb_disable_window(fbdev, id); s3cfb_disable_localpath(fbdev, id); } return 0; }
void s3cfb_early_suspend(struct early_suspend *h) { struct s3cfb_global *fbdev = container_of(h, struct s3cfb_global, early_suspend); pr_debug("s3cfb_early_suspend is called\n"); #ifdef CONFIG_FB_S3C_MDNIE writel(0,fbdev->regs + 0x27c); msleep(20); writel(0x2, S5P_MDNIE_SEL); s3c_mdnie_stop(); #endif s3cfb_display_off(fbdev); #ifdef CONFIG_FB_S3C_MDNIE s3c_mdnie_off(); #endif clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(fbdev->vlcd); regulator_disable(fbdev->vcc_lcd); regulator_disable(fbdev->regulator); return ; }
void s3cfb_early_suspend(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 platform_device *pdev = to_platform_device(info->dev); printk("s3cfb_early_suspend is called\n"); #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 (pdata->backlight_off) pdata->backlight_off(pdev); #endif #if defined (CONFIG_FB_S3C_TL2796) tl2796_ldi_disable(); #endif s3cfb_display_off(info); if (pdata->clk_off) pdata->clk_off(pdev, &fbdev->clock); #ifdef ENABLE_SMDKV210_REGULATOR //urbetter /* ldo6 regulator off */ regulator_disable(lcd_regulator); #endif return ; }
/* new function to close fifo */ int s3cfb_close_fifo(int id, int (*do_priv)(void *), void *param, int sleep) { struct s3cfb_window *win = ctrl->fb[id]->par; dev_dbg(ctrl->dev, "[fb%d] close fifo\n", win->id); if (sleep) win->path = DATA_PATH_FIFO; else win->path = DATA_PATH_DMA; s3cfb_set_vsync_interrupt(ctrl, 1); s3cfb_wait_for_vsync(); s3cfb_set_vsync_interrupt(ctrl, 0); s3cfb_display_off(ctrl); s3cfb_check_line_count(ctrl); s3cfb_disable_window(id); if (do_priv) { if (do_priv(param)) { dev_err(ctrl->dev, "failed to run for private fifo close\n"); s3cfb_enable_window(id); s3cfb_display_on(ctrl); return -EFAULT; } } s3cfb_display_on(ctrl); return 0; }
void s3cfb_early_suspend(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); pr_debug("s3cfb_early_suspend is called\n"); // namko: Turn off the backlight; not the regulator. if (pdata->backlight_onoff) pdata->backlight_onoff(pdev, 0); s3cfb_display_off(fbdev); clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif #ifndef CONFIG_MACH_MID regulator_disable(fbdev->vlcd); regulator_disable(fbdev->vcc_lcd); #endif regulator_disable(fbdev->regulator); return ; }
void s3cfb_early_suspend(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); pr_debug("s3cfb_early_suspend is called\n"); if (pdata->backlight_off) pdata->backlight_off(pdev); else if (pdata->backlight_onoff) pdata->backlight_onoff(pdev, 0); s3cfb_display_off(fbdev); clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(fbdev->regulator); if (pdata->lcd_off) pdata->lcd_off(pdev); if (pdata->cfg_gpio) s3cfb_earlysuspend_cfg_gpio(pdev); return ; }
void s3cfb_screen_disable(void) { s3cfb_display_off(screendimmer_fbdev); clk_disable(screendimmer_fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(screendimmer_fbdev->vlcd); regulator_disable(screendimmer_fbdev->vcc_lcd); regulator_disable(screendimmer_fbdev->regulator); return ; }
/* for backward compatibilities */ void s3cfb_enable_dma(int id) { struct s3cfb_window *win = ctrl->fb[id]->par; win->path = DATA_PATH_DMA; s3cfb_set_vsync_interrupt(ctrl, 1); s3cfb_wait_for_vsync(); s3cfb_set_vsync_interrupt(ctrl, 0); s3cfb_disable_window(id); s3cfb_display_off(ctrl); s3cfb_set_window_control(ctrl, id); s3cfb_display_on(ctrl); }
int s3cfb_suspend(struct platform_device *pdev, pm_message_t state) { struct s3c_platform_fb *pdata = to_fb_plat(&pdev->dev); struct s3cfb_window *win; int i; for (i = 0; i < pdata->nr_wins; i++) { win = ctrl->fb[i]->par; if (win->path == DATA_PATH_FIFO && win->suspend_fifo) { if (win->suspend_fifo()) dev_info(ctrl->dev, "failed to run the suspend for fifo\n"); } } s3cfb_display_off(ctrl); clk_disable(ctrl->clock); return 0; }
void s3cfb_early_suspend(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); pr_debug("s3cfb_early_suspend is called\n"); #if 0 /*to be checked*/ /* backlight_onoff function is only used for backlight_off */ if (pdata->backlight_onoff) pdata->backlight_onoff(pdev, false); #else #if defined (CONFIG_FB_S3C_LTE480WV) if (pdata->backlight_off) pdata->backlight_off(pdev); #endif #endif s3cfb_display_off(fbdev); clk_disable(fbdev->clock); #if defined(CONFIG_FB_S3C_TL2796) lcd_cfg_gpio_early_suspend(); #endif regulator_disable(fbdev->regulator); #if defined (CONFIG_FB_S3C_LTE480WV) //=// //s3cfb_lcd_off(pdev); if(pdata->lcd_off) pdata->lcd_off(pdev); if (pdata->cfg_gpio) { s3cfb_earlysuspend_cfg_gpio(pdev); } #endif return ; }
int s3cfb_suspend(struct platform_device *pdev, pm_message_t state) { struct s3c_platform_fb *pdata = to_fb_plat(&pdev->dev); #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 (pdata->backlight_off) pdata->backlight_off(pdev); #endif if (atomic_read(&fbdev->enabled_win) > 0) { /* lcd_off and backlight_off isn't needed. */ if (fbdev->lcd->deinit_ldi) fbdev->lcd->deinit_ldi(); s3cfb_display_off(fbdev); pdata->clk_off(pdev, &fbdev->clock); } return 0; }
int s3cfb_blank(int blank_mode, struct fb_info *fb) { struct s3cfb_window *win = fb->par; struct s3cfb_window *tmp_win; struct s3cfb_global *fbdev = get_fimd_global(fb->node); struct platform_device *pdev = to_platform_device(fbdev->dev); struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev); int enabled_win = 0; int i; dev_dbg(fbdev->dev, "change blank mode\n"); switch (blank_mode) { case FB_BLANK_UNBLANK: if (!fb->fix.smem_start) { dev_info(fbdev->dev, \ "[fb%d] no allocated memory for unblank\n", win->id); break; } if (win->power_state == FB_BLANK_UNBLANK) { dev_info(fbdev->dev, \ "[fb%d] already in FB_BLANK_UNBLANK\n", win->id); break; } else { s3cfb_update_power_state(fbdev, win->id, FB_BLANK_UNBLANK); } enabled_win = atomic_read(&fbdev->enabled_win); if (enabled_win == 0) { pdata->clk_on(pdev, &fbdev->clock); s3cfb_init_global(fbdev); s3cfb_set_clock(fbdev); for (i = 0; i < pdata->nr_wins; i++) { tmp_win = fbdev->fb[i]->par; if (tmp_win->owner == DMA_MEM_FIMD) s3cfb_set_win_params(fbdev, tmp_win->id); } } if (win->enabled) /* from FB_BLANK_NORMAL */ s3cfb_win_map_off(fbdev, win->id); else /* from FB_BLANK_POWERDOWN */ s3cfb_enable_window(fbdev, win->id); if (enabled_win == 0) { s3cfb_display_on(fbdev); if (pdata->backlight_on) pdata->backlight_on(pdev); if (pdata->lcd_on) pdata->lcd_on(pdev); if (fbdev->lcd->init_ldi) fbdev->lcd->init_ldi(); } break; case FB_BLANK_NORMAL: if (win->power_state == FB_BLANK_NORMAL) { dev_info(fbdev->dev, \ "[fb%d] already in FB_BLANK_NORMAL\n", win->id); break; } else { s3cfb_update_power_state(fbdev, win->id, FB_BLANK_NORMAL); } enabled_win = atomic_read(&fbdev->enabled_win); if (enabled_win == 0) { pdata->clk_on(pdev, &fbdev->clock); s3cfb_init_global(fbdev); s3cfb_set_clock(fbdev); for (i = 0; i < pdata->nr_wins; i++) { tmp_win = fbdev->fb[i]->par; if (tmp_win->owner == DMA_MEM_FIMD) s3cfb_set_win_params(fbdev, tmp_win->id); } } s3cfb_win_map_on(fbdev, win->id, 0x0); if (!win->enabled) /* from FB_BLANK_POWERDOWN */ s3cfb_enable_window(fbdev, win->id); if (enabled_win == 0) { s3cfb_display_on(fbdev); if (pdata->backlight_on) pdata->backlight_on(pdev); if (pdata->lcd_on) pdata->lcd_on(pdev); if (fbdev->lcd->init_ldi) fbdev->lcd->init_ldi(); } break; case FB_BLANK_POWERDOWN: if (win->power_state == FB_BLANK_POWERDOWN) { dev_info(fbdev->dev, \ "[fb%d] already in FB_BLANK_POWERDOWN\n", win->id); break; } else { s3cfb_update_power_state(fbdev, win->id, FB_BLANK_POWERDOWN); } s3cfb_disable_window(fbdev, win->id); s3cfb_win_map_off(fbdev, win->id); if (atomic_read(&fbdev->enabled_win) == 0) { if (pdata->backlight_off) pdata->backlight_off(pdev); if (fbdev->lcd->deinit_ldi) fbdev->lcd->deinit_ldi(); if (pdata->lcd_off) pdata->lcd_off(pdev); s3cfb_display_off(fbdev); pdata->clk_off(pdev, &fbdev->clock); } break; case FB_BLANK_VSYNC_SUSPEND: /* fall through */ case FB_BLANK_HSYNC_SUSPEND: /* fall through */ default: dev_dbg(fbdev->dev, "unsupported blank mode\n"); return -EINVAL; } return 0; }
static int __devinit s3cfb_probe(struct platform_device *pdev) { struct s3c_platform_fb *pdata; struct s3cfb_global *fbdev; struct resource *res; int i, j, ret = 0; fbdev = kzalloc(sizeof(struct s3cfb_global), GFP_KERNEL); if (!fbdev) { dev_err(fbdev->dev, "failed to allocate for " "global fb structure\n"); ret = -ENOMEM; goto err_global; } fbdev->dev = &pdev->dev; fbdev->regulator = regulator_get(&pdev->dev, "pd"); if (!fbdev->regulator) { dev_err(fbdev->dev, "failed to get regulator\n"); ret = -EINVAL; goto err_regulator; } ret = regulator_enable(fbdev->regulator); if (ret < 0) { dev_err(fbdev->dev, "failed to enable regulator\n"); ret = -EINVAL; goto err_regulator; } fbdev->vcc_lcd = regulator_get(&pdev->dev, "vcc_lcd"); if (!fbdev->vcc_lcd) { dev_err(fbdev->dev, "failed to get vcc_lcd\n"); ret = -EINVAL; goto err_vcc_lcd; } ret = regulator_enable(fbdev->vcc_lcd); if (ret < 0) { dev_err(fbdev->dev, "failed to enable vcc_lcd\n"); ret = -EINVAL; goto err_vcc_lcd; } fbdev->vlcd = regulator_get(&pdev->dev, "vlcd"); if (!fbdev->vlcd) { dev_err(fbdev->dev, "failed to get vlcd\n"); ret = -EINVAL; goto err_vlcd; } ret = regulator_enable(fbdev->vlcd); if (ret < 0) { dev_err(fbdev->dev, "failed to enable vlcd\n"); ret = -EINVAL; goto err_vlcd; } pdata = to_fb_plat(&pdev->dev); if (!pdata) { dev_err(fbdev->dev, "failed to get platform data\n"); ret = -EINVAL; goto err_pdata; } fbdev->lcd = (struct s3cfb_lcd *)pdata->lcd; if (pdata->cfg_gpio) pdata->cfg_gpio(pdev); if (pdata->clk_on) pdata->clk_on(pdev, &fbdev->clock); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(fbdev->dev, "failed to get io memory region\n"); ret = -EINVAL; goto err_io; } res = request_mem_region(res->start, res->end - res->start + 1, pdev->name); if (!res) { dev_err(fbdev->dev, "failed to request io memory region\n"); ret = -EINVAL; goto err_io; } fbdev->regs = ioremap(res->start, res->end - res->start + 1); if (!fbdev->regs) { dev_err(fbdev->dev, "failed to remap io region\n"); ret = -EINVAL; goto err_mem; } s3cfb_set_vsync_interrupt(fbdev, 1); s3cfb_set_global_interrupt(fbdev, 1); #ifdef CONFIG_FB_S3C_MDNIE s3c_mdnie_setup(); #endif s3cfb_init_global(fbdev); if (s3cfb_alloc_framebuffer(fbdev)) { ret = -ENOMEM; goto err_alloc; } if (s3cfb_register_framebuffer(fbdev)) { ret = -EINVAL; goto err_register; } s3cfb_set_clock(fbdev); #ifdef CONFIG_FB_S3C_MDNIE mDNIe_Mode_Set(); #endif s3cfb_set_window(fbdev, pdata->default_win, 1); s3cfb_set_alpha_value_width(fbdev, pdata->default_win); s3cfb_display_on(fbdev); fbdev->irq = platform_get_irq(pdev, 0); if (request_irq(fbdev->irq, s3cfb_irq_frame, IRQF_SHARED, pdev->name, fbdev)) { dev_err(fbdev->dev, "request_irq failed\n"); ret = -EINVAL; goto err_irq; } #ifdef CONFIG_FB_S3C_LCD_INIT #if defined(CONFIG_FB_S3C_TL2796) if (pdata->backlight_on) pdata->backlight_on(pdev); #endif #ifndef CONFIG_MACH_ARIES if (!bootloaderfb && pdata->reset_lcd) pdata->reset_lcd(pdev); #endif #endif #ifdef CONFIG_HAS_EARLYSUSPEND fbdev->early_suspend.suspend = s3cfb_early_suspend; fbdev->early_suspend.resume = s3cfb_late_resume; fbdev->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; register_early_suspend(&fbdev->early_suspend); #endif ret = device_create_file(&(pdev->dev), &dev_attr_win_power); if (ret < 0) dev_err(fbdev->dev, "failed to add sysfs entries\n"); dev_info(fbdev->dev, "registered successfully\n"); return 0; err_irq: s3cfb_display_off(fbdev); s3cfb_set_window(fbdev, pdata->default_win, 0); for (i = pdata->default_win; i < pdata->nr_wins + pdata->default_win; i++) { j = i % pdata->nr_wins; unregister_framebuffer(fbdev->fb[j]); } err_register: for (i = 0; i < pdata->nr_wins; i++) { if (i == pdata->default_win) s3cfb_unmap_default_video_memory(fbdev->fb[i]); framebuffer_release(fbdev->fb[i]); } kfree(fbdev->fb); err_alloc: iounmap(fbdev->regs); err_mem: release_mem_region(res->start, res->end - res->start + 1); err_io: pdata->clk_off(pdev, &fbdev->clock); err_pdata: regulator_disable(fbdev->vlcd); err_vlcd: regulator_disable(fbdev->vcc_lcd); err_vcc_lcd: regulator_disable(fbdev->regulator); err_regulator: kfree(fbdev); err_global: return ret; }
static int __devinit s3cfb_probe(struct platform_device *pdev) { struct s3c_platform_fb *pdata; struct s3cfb_global *fbdev; struct resource *res; int i, j, ret = 0; printk("%s\n",__func__); fbdev = kzalloc(sizeof(struct s3cfb_global), GFP_KERNEL); if (!fbdev) { dev_err(&pdev->dev, "failed to allocate for " "global fb structure\n"); ret = -ENOMEM; goto err_global; } fbdev->dev = &pdev->dev; #ifdef CONFIG_FB_S3C_LTE480WV s3cfb_set_lcd_info(fbdev); #endif fbdev->regulator = regulator_get(&pdev->dev, "pd"); if (!fbdev->regulator) { dev_err(fbdev->dev, "failed to get regulator\n"); ret = -EINVAL; goto err_regulator; } ret = regulator_enable(fbdev->regulator); if (ret < 0) { dev_err(fbdev->dev, "failed to enable regulator\n"); ret = -EINVAL; goto err_regulator; } pdata = to_fb_plat(&pdev->dev); if (!pdata) { dev_err(fbdev->dev, "failed to get platform data\n"); ret = -EINVAL; goto err_pdata; } //fbdev->lcd = (struct s3cfb_lcd *)pdata->lcd; if (pdata->cfg_gpio) pdata->cfg_gpio(pdev); if (pdata->clk_on) pdata->clk_on(pdev, &fbdev->clock); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(fbdev->dev, "failed to get io memory region\n"); ret = -EINVAL; goto err_io; } res = request_mem_region(res->start, res->end - res->start + 1, pdev->name); if (!res) { dev_err(fbdev->dev, "failed to request io memory region\n"); ret = -EINVAL; goto err_io; } fbdev->regs = ioremap(res->start, res->end - res->start + 1); if (!fbdev->regs) { dev_err(fbdev->dev, "failed to remap io region\n"); ret = -EINVAL; goto err_mem; } /*set gamma LUT*/ //SSCR xuhui 110130 s3cfb_set_gamma(fbdev); s3cfb_set_vsync_interrupt(fbdev, 1); s3cfb_set_global_interrupt(fbdev, 1); s3cfb_init_global(fbdev); if (s3cfb_alloc_framebuffer(fbdev)) { ret = -ENOMEM; goto err_alloc; } if (s3cfb_register_framebuffer(fbdev)) { ret = -EINVAL; goto err_register; } s3cfb_set_clock(fbdev); s3cfb_set_window(fbdev, pdata->default_win, 1); s3cfb_display_on(fbdev); fbdev->irq = platform_get_irq(pdev, 0); if (request_irq(fbdev->irq, s3cfb_irq_frame, IRQF_SHARED, pdev->name, fbdev)) { dev_err(fbdev->dev, "request_irq failed\n"); ret = -EINVAL; goto err_irq; } #ifdef CONFIG_FB_S3C_LCD_INIT if (pdata->backlight_on) pdata->backlight_on(pdev); if (!bootloaderfb && pdata->reset_lcd) pdata->reset_lcd(pdev); if (pdata->lcd_on) pdata->lcd_on(pdev); #endif #ifdef CONFIG_HAS_EARLYSUSPEND fbdev->early_suspend.suspend = s3cfb_early_suspend; fbdev->early_suspend.resume = s3cfb_late_resume; fbdev->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; register_early_suspend(&fbdev->early_suspend); #endif ret = device_create_file(&(pdev->dev), &dev_attr_win_power); if (ret < 0) dev_err(fbdev->dev, "failed to add sysfs entries\n"); dev_info(fbdev->dev, "registered successfully\n"); #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) if (fb_prepare_logo( fbdev->fb[pdata->default_win], FB_ROTATE_UR)) { printk("Start display and show logo\n"); /* Start display and show logo on boot */ fb_set_cmap(&fbdev->fb[pdata->default_win]->cmap, fbdev->fb[pdata->default_win]); fb_show_logo(fbdev->fb[pdata->default_win], FB_ROTATE_UR); } #endif return 0; err_irq: s3cfb_display_off(fbdev); s3cfb_set_window(fbdev, pdata->default_win, 0); for (i = pdata->default_win; i < pdata->nr_wins + pdata->default_win; i++) { j = i % pdata->nr_wins; unregister_framebuffer(fbdev->fb[j]); } err_register: for (i = 0; i < pdata->nr_wins; i++) { if (i == pdata->default_win) s3cfb_unmap_default_video_memory(fbdev->fb[i]); framebuffer_release(fbdev->fb[i]); } kfree(fbdev->fb); err_alloc: iounmap(fbdev->regs); err_mem: release_mem_region(res->start, res->end - res->start + 1); err_io: pdata->clk_off(pdev, &fbdev->clock); err_pdata: regulator_disable(fbdev->regulator); err_regulator: kfree(fbdev); err_global: return ret; }