display: JDI: workaround to fix resume messy screen

1. The backlight turns on before framebuffer comes out.
   In command mode panel like JDI, there would be messy screen
   when resuming.
2. Framebuffer comes out at first msm_fb_commit_wq_handler()
      -> mdp4_overlay_commit() after resume.
   We should delay backlight to after framebuffer comes out.
3. Add set_recovery_backlight for the backlight in recovery mode.
   Default backlight 40/255, may modify afterwards.

case 01124703

Change-Id: I62ace8bb85ac62b6eaf214588caa8a89ba094a67
Signed-off-by: yetta_wu <yetta_wu@asus.com>
This commit is contained in:
yetta_wu 2013-03-29 19:49:07 +08:00 committed by Iliyan Malchev
parent e1faf299fe
commit c3a2d155e9
5 changed files with 55 additions and 29 deletions

View file

@ -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 = {

View file

@ -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);

View file

@ -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];

View file

@ -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;
}

View file

@ -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 */