diff options
| author | Adrian Salido-Moreno <adrianm@codeaurora.org> | 2013-05-08 20:10:40 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:17:08 -0700 |
| commit | a717651319b677df74ea0e6245bd7be31da07bfa (patch) | |
| tree | af273d0c8fa7747d61ae513db8a67ff465d438fe | |
| parent | 483a9538632ed00596b75f444409717034c2700e (diff) | |
msm: mdss: add DSI state machine
Maintain state of DSI panel, and avoid performing some operations
depending on the current state.
Change-Id: Id8c2cc30e5058dea7585cc9d06b2ab11368bc337
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi.c | 40 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi.h | 7 |
2 files changed, 36 insertions, 11 deletions
diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c index f0ada7a5eb86..4bbe79d60253 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.c +++ b/drivers/video/fbdev/msm/mdss_dsi.c @@ -431,6 +431,7 @@ int mdss_dsi_cont_splash_on(struct mdss_panel_data *pdata) { int ret = 0; struct mipi_panel_info *mipi; + struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL; pr_info("%s:%d DSI on for continuous splash.\n", __func__, __LINE__); @@ -439,7 +440,16 @@ int mdss_dsi_cont_splash_on(struct mdss_panel_data *pdata) return -EINVAL; } - mipi = &pdata->panel_info.mipi; + mipi = &pdata->panel_info.mipi; + + ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, + panel_data); + + pr_debug("%s+: ctrl=%p ndx=%d\n", __func__, + ctrl_pdata, ctrl_pdata->ndx); + + WARN(ctrl_pdata->panel_state != UNKNOWN_STATE, + "incorrect panel state=%d\n", ctrl_pdata->panel_state); ret = mdss_dsi_panel_power_on(pdata, 1); if (ret) { @@ -453,6 +463,8 @@ int mdss_dsi_cont_splash_on(struct mdss_panel_data *pdata) mdss_dsi_op_mode_config(mipi->mode, pdata); + ctrl_pdata->panel_state = PANEL_ON; + pr_debug("%s-:End\n", __func__); return ret; } @@ -598,12 +610,15 @@ static int mdss_dsi_unblank(struct mdss_panel_data *pdata) panel_data); mipi = &pdata->panel_info.mipi; - ret = ctrl_pdata->on(pdata); - if (ret) { - pr_err("%s: unable to initialize the panel\n", __func__); - return ret; + if (ctrl_pdata->panel_state != PANEL_ON) { + ret = ctrl_pdata->on(pdata); + if (ret) { + pr_err("%s: unable to initialize the panel\n", + __func__); + return ret; + } + ctrl_pdata->panel_state = PANEL_ON; } - mdss_dsi_op_mode_config(mipi->mode, pdata); pr_debug("%s-:\n", __func__); @@ -628,12 +643,14 @@ static int mdss_dsi_blank(struct mdss_panel_data *pdata) mdss_dsi_op_mode_config(DSI_CMD_MODE, pdata); - ret = ctrl_pdata->off(pdata); - if (ret) { - pr_err("%s: Panel OFF failed\n", __func__); - return ret; + if (ctrl_pdata->panel_state == PANEL_ON) { + ret = ctrl_pdata->off(pdata); + if (ret) { + pr_err("%s: Panel OFF failed\n", __func__); + return ret; + } + ctrl_pdata->panel_state = PANEL_OFF; } - pr_debug("%s-:End\n", __func__); return ret; } @@ -1125,6 +1142,7 @@ int dsi_panel_device_register(struct platform_device *pdev, ctrl_pdata->ndx = 1; } + ctrl_pdata->panel_state = UNKNOWN_STATE; pr_debug("%s: Panal data initialized\n", __func__); return 0; } diff --git a/drivers/video/fbdev/msm/mdss_dsi.h b/drivers/video/fbdev/msm/mdss_dsi.h index 197ff7a2790b..9a32dc557ae4 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.h +++ b/drivers/video/fbdev/msm/mdss_dsi.h @@ -89,6 +89,12 @@ enum dsi_ctrl_state { DSI_HS_MODE, }; +enum dsi_panel_state { + UNKNOWN_STATE, + PANEL_ON, + PANEL_OFF, +}; + #define DSI_NON_BURST_SYNCH_PULSE 0 #define DSI_NON_BURST_SYNCH_EVENT 1 #define DSI_BURST_MODE 2 @@ -283,6 +289,7 @@ struct mdss_dsi_ctrl_pdata { struct clk *byte_clk; struct clk *esc_clk; struct clk *pixel_clk; + u8 panel_state; int irq_cnt; int mdss_dsi_clk_on; int rst_gpio; |
