From 1fd102ea73e94640b664aaaf4e257225cb152434 Mon Sep 17 00:00:00 2001 From: shuoyan Date: Fri, 28 Feb 2020 10:50:21 -0600 Subject: [PATCH] disp: msm: prevent ESD recovery till all panel dead PROPAGATED from (CR) Device reboot when CLI panel dead Quality team hopes Device still alive when one panel dead. Modify the ESD recovery policy that reboot all when all display dead. Change-Id: I78ca19de9723c00416ea43457b6750b7a765c08f Reviewed-on: https://gerrit.mot.com/1782924 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao Reviewed-by: Shanshan Dai Reviewed-by: Yeqing Wang Submit-Approved: Jira Key --- msm/dsi/dsi_display.c | 21 +++++++++++++++++++++ msm/dsi/dsi_panel.c | 27 +++++++++++++++++---------- msm/dsi/dsi_panel.h | 5 +++++ 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index e216d32d3e24..f1f7e23071dc 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -6611,6 +6611,27 @@ int dsi_display_get_num_of_displays(void) return count; } +bool dsi_display_all_displays_dead(void) +{ + int index =0, num_displays =0, num_dead_displays =0; + + for (index = 0; index < MAX_DSI_ACTIVE_DISPLAY; index++) { + struct dsi_display *display = boot_displays[index].disp; + + if (display && display->panel_node) { + num_displays++; + + if (display->panel->is_panel_dead) + num_dead_displays++; + } + } + + pr_info("%d Display Dead(%d)\n", num_dead_displays, num_displays); + + return num_dead_displays == num_displays; +} +EXPORT_SYMBOL(dsi_display_all_displays_dead); + int dsi_display_get_active_displays(void **display_array, u32 max_display_count) { int index = 0, count = 0; diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index e7db86c33b35..052ca33d7f93 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -5462,9 +5462,7 @@ int dsi_panel_enable(struct dsi_panel *panel) { int rc = 0; u8 pwr_mode; - static int panel_recovery_retry; - struct dsi_display *dsi_display = container_of(panel->host, - struct dsi_display, host); + struct dsi_display *dsi_display = container_of(panel->host, struct dsi_display, host); if (!panel) { DSI_ERR("Invalid params\n"); @@ -5490,20 +5488,29 @@ int dsi_panel_enable(struct dsi_panel *panel) } if (pwr_mode != panel->disp_on_chk_val) { - DSI_ERR("%s: Read Pwr_mode=0%x is not matched with expected value =0x%x\n", - __func__, pwr_mode, panel->disp_on_chk_val); + DSI_ERR("%s: %s Read Pwr_mode=0%x is not matched with expected value =0x%x\n", + __func__, panel->name, pwr_mode, panel->disp_on_chk_val); - if (panel_recovery_retry++ > 5) { + if (panel->panel_recovery_retry++ > 5) { DSI_ERR("%s: panel recovery failed for all retries", __func__); - BUG(); - } + panel->is_panel_dead = true; + panel->esd_utag_enable = false; + panel->no_panel_on_read_support = true; - dsi_display_trigger_panel_dead_event(dsi_display); + if (dsi_display_all_displays_dead()) { + DSI_ERR("%s:ALL panel recovery failed with 6 times,reboot\n", + __func__); + BUG(); + } else + DSI_INFO("(%s)Panel dead,disable ESD recovery for it\n", + panel->name); + } else + dsi_display_trigger_panel_dead_event(dsi_display); } else { DSI_INFO("Pwr_mode(0x0A) = 0x%x\n", pwr_mode); - panel_recovery_retry = 0; + panel->panel_recovery_retry = 0; } } else DSI_INFO("-: no_panel_on_read_support is set\n"); diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index c346d703a03f..f2cf1d85afca 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -367,8 +367,13 @@ struct dsi_panel { enum touch_state tp_state; bool tp_state_check_enable; + + int panel_recovery_retry; + bool is_panel_dead; }; +bool dsi_display_all_displays_dead(void); + static inline bool dsi_panel_ulps_feature_enabled(struct dsi_panel *panel) { return panel->ulps_feature_enabled;