diff --git a/arch/arm/mach-msm/asustek/flo/board-flo-display.c b/arch/arm/mach-msm/asustek/flo/board-flo-display.c index ffe11714d4ca..b30c8edf37c0 100644 --- a/arch/arm/mach-msm/asustek/flo/board-flo-display.c +++ b/arch/arm/mach-msm/asustek/flo/board-flo-display.c @@ -793,6 +793,7 @@ static int mipi_JDI_gpio[] = {LPM_CHANNEL}; static struct mipi_dsi_panel_platform_data mipi_JDI_pdata = { .gpio = mipi_JDI_gpio, + .recovery_backlight = 40, /* 1~255 */ }; static struct platform_device mipi_JDI_panel_device = { diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h index 19cd8a5fa718..400aa44d54e5 100644 --- a/arch/arm/mach-msm/include/mach/board.h +++ b/arch/arm/mach-msm/include/mach/board.h @@ -486,6 +486,7 @@ struct mipi_dsi_panel_platform_data { int fpga_ctrl_mode; int fpga_3d_config_addr; int *gpio; + int recovery_backlight; struct mipi_dsi_phy_ctrl *phy_ctrl_settings; char dlane_swap; void (*dsi_pwm_cfg)(void); diff --git a/drivers/video/msm/mipi_JDI.c b/drivers/video/msm/mipi_JDI.c index e2ba82b31839..db2be15fc323 100644 --- a/drivers/video/msm/mipi_JDI.c +++ b/drivers/video/msm/mipi_JDI.c @@ -94,7 +94,6 @@ struct dcs_cmd_req cmdreq_JDI; static int mipi_JDI_lcd_on(struct platform_device *pdev) { struct msm_fb_data_type *mfd; - int ret; pr_info("%s+\n", __func__); @@ -116,20 +115,7 @@ static int mipi_JDI_lcd_on(struct platform_device *pdev) pr_info("%s, JDI display on command-\n", __func__); - msleep(210); - - if (bl_lpm) { - ret = pwm_config(bl_lpm, PWM_DUTY_LEVEL * 40, - PWM_PERIOD_USEC); - if (ret) - pr_err("pwm_config on lpm failed %d\n", ret); - ret = pwm_enable(bl_lpm); - if (ret) - pr_err("pwm enable on lpm failed\n"); - } - msleep(20); - gpio_set_value_cansleep(gpio_LCD_BL_EN, 1); pr_info("%s-\n", __func__); return 0; @@ -148,7 +134,7 @@ static int mipi_JDI_lcd_off(struct platform_device *pdev) if (mfd->key != MFD_KEY) return -EINVAL; - msleep(210); + msleep(20); pr_info("%s, JDI display off command+\n", __func__); cmdreq_JDI.cmds = JDI_display_off_cmds; @@ -209,6 +195,31 @@ static void mipi_JDI_set_backlight(struct msm_fb_data_type *mfd) } } +static void mipi_JDI_set_recovery_backlight(struct msm_fb_data_type *mfd) +{ + int ret; + int recovery_backlight = 100; + + if (mipi_JDI_pdata->recovery_backlight) + recovery_backlight = mipi_JDI_pdata->recovery_backlight; + + pr_info("%s: backlight level %d\n", __func__, recovery_backlight); + + if (bl_lpm) { + ret = pwm_config(bl_lpm, PWM_DUTY_LEVEL * + recovery_backlight, PWM_PERIOD_USEC); + if (ret) { + pr_err("pwm_config on lpm failed %d\n", ret); + return; + } + ret = pwm_enable(bl_lpm); + if (ret) + pr_err("pwm enable on lpm failed, bl=%d\n", + recovery_backlight); + msleep(20); + gpio_set_value_cansleep(gpio_LCD_BL_EN, 1); + } +} static void mipi_JDI_lcd_shutdown(void) { int ret; @@ -298,6 +309,7 @@ static struct msm_fb_panel_data JDI_panel_data = { .on = mipi_JDI_lcd_on, .off = mipi_JDI_lcd_off, .set_backlight = mipi_JDI_set_backlight, + .set_recovery_backlight = mipi_JDI_set_recovery_backlight, }; static int ch_used[3]; diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c index 8a1c39eea471..b11b66b10025 100644 --- a/drivers/video/msm/msm_fb.c +++ b/drivers/video/msm/msm_fb.c @@ -2059,6 +2059,15 @@ static int msm_fb_pan_display_sub(struct fb_var_screeninfo *var, } } + /* set backlight in recovery mode */ + pdata = (struct msm_fb_panel_data *)mfd->pdev-> + dev.platform_data; + if ((pdata) && (pdata->set_recovery_backlight)) { + down(&mfd->sem); + pdata->set_recovery_backlight(mfd); + up(&mfd->sem); + } + ++mfd->panel_info.frame_count; return 0; } @@ -2069,6 +2078,7 @@ static void msm_fb_commit_wq_handler(struct work_struct *work) struct fb_var_screeninfo *var; struct fb_info *info; struct msm_fb_backup_type *fb_backup; + struct msm_fb_panel_data *pdata; mfd = container_of(work, struct msm_fb_data_type, commit_work); fb_backup = (struct msm_fb_backup_type *)mfd->msm_fb_backup; @@ -2085,6 +2095,21 @@ static void msm_fb_commit_wq_handler(struct work_struct *work) complete_all(&mfd->commit_comp); mutex_unlock(&mfd->sync_mutex); + if (unset_bl_level && !bl_updated) { + pdata = (struct msm_fb_panel_data *)mfd->pdev-> + dev.platform_data; + if ((pdata) && (pdata->set_backlight)) { + /* add delay to make sure the fb sending completed */ + msleep(20); + down(&mfd->sem); + mfd->bl_level = unset_bl_level; + pdata->set_backlight(mfd); + bl_level_old = unset_bl_level; + up(&mfd->sem); + bl_updated = 1; + } + } + } static int msm_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) @@ -3222,7 +3247,6 @@ static int msmfb_overlay_play(struct fb_info *info, unsigned long *argp) int ret; struct msmfb_overlay_data req; struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par; - struct msm_fb_panel_data *pdata; if (mfd->overlay_play_enable == 0) /* nothing to do */ return 0; @@ -3256,19 +3280,6 @@ static int msmfb_overlay_play(struct fb_info *info, unsigned long *argp) ret = mdp4_overlay_play(info, &req); - if (unset_bl_level && !bl_updated) { - pdata = (struct msm_fb_panel_data *)mfd->pdev-> - dev.platform_data; - if ((pdata) && (pdata->set_backlight)) { - down(&mfd->sem); - mfd->bl_level = unset_bl_level; - pdata->set_backlight(mfd); - bl_level_old = unset_bl_level; - up(&mfd->sem); - bl_updated = 1; - } - } - return ret; } diff --git a/drivers/video/msm/msm_fb_panel.h b/drivers/video/msm/msm_fb_panel.h index c6e5d6341b4b..242aa99ffbca 100644 --- a/drivers/video/msm/msm_fb_panel.h +++ b/drivers/video/msm/msm_fb_panel.h @@ -190,6 +190,7 @@ struct msm_fb_panel_data { void (*set_rect) (int x, int y, int xres, int yres); void (*set_vsync_notifier) (msm_fb_vsync_handler_type, void *arg); void (*set_backlight) (struct msm_fb_data_type *); + void (*set_recovery_backlight) (struct msm_fb_data_type *); int (*get_backlight_on_status) (void); /* function entry chain */