From 06766f7e9bc39377fae8957b86a53b4a25899f82 Mon Sep 17 00:00:00 2001 From: Devin Kim <dojip.kim@lge.com> Date: Fri, 31 Oct 2014 14:12:07 -0700 Subject: [PATCH] msm: mdss: Fix the intermittent idle control during stepping down backlight If the idle control is called during stepping down backlight, just peding the idle control and then control it when backlight is off. Change-Id: I648f8dd0c15cbae09223200d25a89b2e2813c087 Siggned-off-by: Devin Kim <dojip.kim@lge.com> --- drivers/video/msm/mdss/mdss_dsi_panel.c | 55 ++++++++++++++++--------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/drivers/video/msm/mdss/mdss_dsi_panel.c b/drivers/video/msm/mdss/mdss_dsi_panel.c index 03b132e1ee71..4ab037ddaa5c 100644 --- a/drivers/video/msm/mdss/mdss_dsi_panel.c +++ b/drivers/video/msm/mdss/mdss_dsi_panel.c @@ -30,6 +30,9 @@ static int mdss_panel_height = 480; DEFINE_LED_TRIGGER(bl_led_trigger); +static void __mdss_dsi_panel_set_idle_mode(struct mdss_dsi_ctrl_pdata *ctrl, + int enable); + void mdss_dsi_panel_pwm_cfg(struct mdss_dsi_ctrl_pdata *ctrl) { ctrl->pwm_bl = pwm_request(ctrl->pwm_lpg_chan, "lcd-bklt"); @@ -161,13 +164,9 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level) struct dsi_cmd_desc cmds[2]; struct mdss_panel_info *pinfo = &ctrl->panel_data.panel_info; unsigned char new_level = level; + bool do_idle = false; pr_debug("%s: level=%d\n", __func__, level); - if (ctrl->idle) { - pr_debug("%s: skip backlight control due to idle mode\n", - __func__); - return; - } if (pinfo->blmap && pinfo->blmap_size) { if (level >= pinfo->blmap_size) @@ -206,6 +205,7 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level) sizeof(struct dsi_cmd_desc)); cmdreq.cmds_cnt++; ctrl->bklt_off = true; + do_idle = true; } } @@ -217,6 +217,9 @@ static void mdss_dsi_panel_bklt_dcs(struct mdss_dsi_ctrl_pdata *ctrl, int level) mdss_dsi_cmdlist_put(ctrl, &cmdreq); } + + if (do_idle) + __mdss_dsi_panel_set_idle_mode(ctrl, 1); } static void idle_on_work(struct work_struct *work) @@ -259,29 +262,22 @@ static void idle_on_work(struct work_struct *work) wake_unlock(&ctrl->idle_on_wakelock); } -static void mdss_dsi_panel_set_idle_mode(struct mdss_panel_data *pdata, +static void __mdss_dsi_panel_set_idle_mode(struct mdss_dsi_ctrl_pdata *ctrl, int enable) { - struct mdss_dsi_ctrl_pdata *ctrl = NULL; - - if (pdata == NULL) { - pr_err("%s: Invalid input data\n", __func__); - return; - } - - ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, - panel_data); - /* don't need to set idle mode if display is blanked */ if (ctrl->blanked) { - pr_debug("%s: skipped the idle mode\n", __func__); + ctrl->idle = 0; + pr_debug("%s: idle: already blanked\n", __func__); return; } - pr_debug("%s: enabled %d\n", __func__, enable); - - if (ctrl->idle == enable) + if (ctrl->idle == enable) { + pr_debug("%s: idle: no change(%d)\n", __func__, enable); return; + } + + pr_debug("%s: idle %d->%d\n", __func__, ctrl->idle, enable); ctrl->idle = enable; @@ -296,6 +292,25 @@ static void mdss_dsi_panel_set_idle_mode(struct mdss_panel_data *pdata, } } +static void mdss_dsi_panel_set_idle_mode(struct mdss_panel_data *pdata, + int enable) +{ + struct mdss_dsi_ctrl_pdata *ctrl = NULL; + + if (pdata == NULL) { + pr_err("%s: Invalid input data\n", __func__); + return; + } + + ctrl = container_of(pdata, struct mdss_dsi_ctrl_pdata, + panel_data); + + if (enable && !ctrl->bklt_off) + return; // will enable idle later when blkt is off + + __mdss_dsi_panel_set_idle_mode(ctrl, enable); +} + static int mdss_dsi_panel_get_idle_mode(struct mdss_panel_data *pdata) { struct mdss_dsi_ctrl_pdata *ctrl = NULL; -- GitLab