mako: backlight: sync backlight on/off with lcd on/off
To avoid dispalying garbage during lcd on/off, the turning on lcd should be done before backlight on and turning off backlight should be finished before lcd off. But current implementation doesn't guarantee these on/off sequence. This patch ensure the sequence of lcd and backligth on/off. Change-Id: I11771d395c1a68b4e70b63639f50c773a665b441 Signed-off-by: Iliyan Malchev <malchev@google.com> Conflicts: drivers/video/msm/msm_fb.c
This commit is contained in:
committed by
Iliyan Malchev
parent
9124cb89b9
commit
2cb854aebc
@@ -413,6 +413,7 @@ struct msm_panel_common_pdata {
|
||||
char cont_splash_enabled;
|
||||
char mdp_iommu_split_domain;
|
||||
void (*bl_pwm_disable)(void);
|
||||
int (*bl_on_status)(void);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -717,10 +717,6 @@ static int hdmi_cec_power(int on)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (CONFIG_BACKLIGHT_LM3530)
|
||||
extern void lm3530_lcd_backlight_set_level( int level);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT)
|
||||
static int mipi_lgit_backlight_level(int level, int max, int min)
|
||||
{
|
||||
@@ -888,6 +884,7 @@ static struct msm_panel_common_pdata mipi_lgit_pdata = {
|
||||
#ifdef CONFIG_LGIT_VIDEO_WXGA_CABC
|
||||
.bl_pwm_disable = lm3530_lcd_backlight_pwm_disable,
|
||||
#endif
|
||||
.bl_on_status = lm3530_lcd_backlight_on_status,
|
||||
};
|
||||
|
||||
static struct platform_device mipi_dsi_lgit_panel_device = {
|
||||
|
||||
@@ -135,7 +135,6 @@ static void lm3530_backlight_on(struct i2c_client *client, int level)
|
||||
|
||||
lm3530_write_reg(dev->client, 0xA0, 0x00);
|
||||
lm3530_write_reg(dev->client, 0x10, dev->max_current);
|
||||
lm3530_write_reg(dev->client, 0x30, 0x25);
|
||||
}
|
||||
|
||||
lm3530_set_main_current_level(dev->client, level);
|
||||
@@ -199,6 +198,12 @@ void lm3530_lcd_backlight_pwm_disable(void)
|
||||
}
|
||||
EXPORT_SYMBOL(lm3530_lcd_backlight_pwm_disable);
|
||||
|
||||
int lm3530_lcd_backlight_on_status(void)
|
||||
{
|
||||
return backlight_status;
|
||||
}
|
||||
EXPORT_SYMBOL(lm3530_lcd_backlight_on_status);
|
||||
|
||||
static int bl_set_intensity(struct backlight_device *bd)
|
||||
{
|
||||
int brightness = bd->props.brightness;
|
||||
|
||||
@@ -100,7 +100,7 @@ static int mipi_lgit_lcd_on(struct platform_device *pdev)
|
||||
|
||||
ret = lgit_external_dsv_onoff(1);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to turn on exteranl dsv\n", __func__);
|
||||
pr_err("%s: failed to turn on external dsv\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ static int mipi_lgit_lcd_off(struct platform_device *pdev)
|
||||
|
||||
ret = lgit_external_dsv_onoff(0);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to turn off exteranl dsv\n", __func__);
|
||||
pr_err("%s: failed to turn off external dsv\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,11 @@ static int mipi_lgit_lcd_off(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mipi_lgit_backlight_on_status(void)
|
||||
{
|
||||
return (mipi_lgit_pdata->bl_on_status());
|
||||
}
|
||||
|
||||
static void mipi_lgit_set_backlight_board(struct msm_fb_data_type *mfd)
|
||||
{
|
||||
int level;
|
||||
@@ -199,6 +204,7 @@ static struct msm_fb_panel_data lgit_panel_data = {
|
||||
.on = mipi_lgit_lcd_on,
|
||||
.off = mipi_lgit_lcd_off,
|
||||
.set_backlight = mipi_lgit_set_backlight_board,
|
||||
.get_backlight_on_status = mipi_lgit_backlight_on_status,
|
||||
};
|
||||
|
||||
static int ch_used[3];
|
||||
|
||||
@@ -802,8 +802,6 @@ static void msmfb_early_resume(struct early_suspend *h)
|
||||
static int unset_bl_level, bl_updated;
|
||||
#if defined(CONFIG_BACKLIGHT_LM3530)
|
||||
static int bl_level_old = 0x2A;
|
||||
#elif defined(CONFIG_BACKLIGHT_LM3533)
|
||||
static int bl_level_old = 0x2E;
|
||||
#else
|
||||
static int bl_level_old;
|
||||
#endif
|
||||
@@ -843,15 +841,7 @@ void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl)
|
||||
{
|
||||
struct msm_fb_panel_data *pdata;
|
||||
__u32 temp = bkl_lvl;
|
||||
if (!mfd->panel_power_on || !bl_updated) {
|
||||
unset_bl_level = bkl_lvl;
|
||||
#if defined(CONFIG_BACKLIGHT_LM3530) || defined(CONFIG_BACKLIGHT_LM3533)
|
||||
if (system_state != SYSTEM_BOOTING)
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
unset_bl_level = 0;
|
||||
}
|
||||
int time_out = 300;
|
||||
|
||||
msm_fb_scale_bl(&temp);
|
||||
pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;
|
||||
@@ -863,6 +853,14 @@ void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl)
|
||||
return;
|
||||
}
|
||||
mfd->bl_level = temp;
|
||||
|
||||
while (!mfd->panel_power_on && time_out) {
|
||||
msleep(1);
|
||||
time_out --;
|
||||
}
|
||||
if (time_out == 0)
|
||||
pr_err("%s : timeout for waitng lcd turn on\n", __func__);
|
||||
|
||||
pdata->set_backlight(mfd);
|
||||
mfd->bl_level = bkl_lvl;
|
||||
bl_level_old = temp;
|
||||
@@ -876,6 +874,7 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
|
||||
struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par;
|
||||
struct msm_fb_panel_data *pdata = NULL;
|
||||
int ret = 0;
|
||||
int time_out = 300;
|
||||
|
||||
if (!op_enable)
|
||||
return -EPERM;
|
||||
@@ -889,21 +888,9 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
|
||||
switch (blank_mode) {
|
||||
case FB_BLANK_UNBLANK:
|
||||
if (!mfd->panel_power_on) {
|
||||
msleep(16);
|
||||
ret = pdata->on(mfd->pdev);
|
||||
if (ret == 0) {
|
||||
mfd->panel_power_on = TRUE;
|
||||
|
||||
/* ToDo: possible conflict with android which doesn't expect sw refresher */
|
||||
/*
|
||||
if (!mfd->hw_refresh)
|
||||
{
|
||||
if ((ret = msm_fb_resume_sw_refresher(mfd)) != 0)
|
||||
{
|
||||
MSM_FB_INFO("msm_fb_blank_sub: msm_fb_resume_sw_refresher failed = %d!\n",ret);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -918,9 +905,12 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
|
||||
|
||||
mfd->op_enable = FALSE;
|
||||
curr_pwr_state = mfd->panel_power_on;
|
||||
msleep(300); // HACK: wait for backlight control
|
||||
mfd->panel_power_on = FALSE;
|
||||
bl_updated = 0;
|
||||
while (pdata->get_backlight_on_status() && time_out) {
|
||||
msleep(1);
|
||||
time_out --;
|
||||
}
|
||||
if (time_out == 0)
|
||||
pr_err("%s : timeout for waiting backlight turn on\n", __func__);
|
||||
|
||||
/* clean fb to prevent displaying old fb */
|
||||
memset((void *)info->screen_base, 0,
|
||||
@@ -929,6 +919,8 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info,
|
||||
ret = pdata->off(mfd->pdev);
|
||||
if (ret)
|
||||
mfd->panel_power_on = curr_pwr_state;
|
||||
else
|
||||
mfd->panel_power_on = FALSE;
|
||||
|
||||
mfd->op_enable = TRUE;
|
||||
}
|
||||
|
||||
@@ -189,6 +189,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 *);
|
||||
int (*get_backlight_on_status) (void);
|
||||
|
||||
/* function entry chain */
|
||||
int (*on) (struct platform_device *pdev);
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
#define __LM35XX_BL_H
|
||||
|
||||
#ifdef CONFIG_BACKLIGHT_LM3530
|
||||
void lm3530_lcd_backlight_set_level( int level);
|
||||
void lm3530_lcd_backlight_pwm_disable(void);
|
||||
int lm3530_lcd_backlight_on_status(void);
|
||||
#endif
|
||||
|
||||
struct backlight_platform_data {
|
||||
void (*platform_init)(void);
|
||||
int gpio;
|
||||
|
||||
Reference in New Issue
Block a user