From 8072f67d7da86ef9fecf6a5270faec010e86c350 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Thu, 25 Jul 2019 12:56:02 -0500 Subject: [PATCH] disp: msm: dsi: parsing BL setting ESD and panel After the Boot Loader (BL) detects the panel information, or reading the ESD UTAG setting, the BL will write these information to the DTS. The display driver from kernel and parse and save these setting. Port from: 61c3e44 Change-Id: I3759b73c2e1eff01269a42dfa11d20807affa17a Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1444393 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509795 Reviewed-by: Hua Tan --- msm/dsi/dsi_panel.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ msm/dsi/dsi_panel.h | 6 ++++++ 2 files changed, 54 insertions(+) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 077b909be2a9..f6409bf56f63 100755 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -34,6 +34,9 @@ #define DEFAULT_PANEL_PREFILL_LINES 25 #define MIN_PREFILL_LINES 35 +#define DSI_PANEL_UNKNOWN_PANEL_NAME "unknown" +#define DSI_PANEL_PANEL_DEFAULT_VER 0xffffffffffffffff + enum dsi_dsc_ratio_type { DSC_8BPC_8BPP, DSC_10BPC_8BPP, @@ -1500,6 +1503,45 @@ static int dsi_panel_parse_dyn_clk_caps(struct dsi_panel *panel) return 0; } +static int dsi_panel_parse_panel_cfg(struct dsi_panel *panel) +{ + struct device_node *np; + const char *pname; + u32 panel_ver, tmp; + + np = of_find_node_by_path("/chosen"); + /* Disable ESD only if the prop "mmi,esd" exists and is equal to 0 */ + if (!of_property_read_u32(np, "mmi,esd", &tmp) && tmp == 0) { + panel->esd_utag_enable = false; + DSI_WARN("ESD detection is disabled by UTAGS\n"); + } else + panel->esd_utag_enable = true; + + panel->panel_ver = DSI_PANEL_PANEL_DEFAULT_VER; + of_property_read_u64(np, "mmi,panel_ver", &panel->panel_ver); + + pname = of_get_property(np, "mmi,panel_name", NULL); + if (!pname || strlen(pname) == 0) { + DSI_WARN("Failed to get mmi,panel_name\n"); + strlcpy(panel->panel_name, DSI_PANEL_UNKNOWN_PANEL_NAME, + sizeof(panel->panel_name)); + } else + strlcpy(panel->panel_name, pname, sizeof(panel->panel_name)); + + DSI_DEBUG("esd_utage_enable=%d\n", panel->esd_utag_enable); + + panel_ver = (u32)panel->panel_ver; + DSI_INFO("BL: panel = %s, manufacture_id(0xDA) = 0x%x controller_ver(0xDB) = 0x%x controller_drv_ver(0XDC) = 0x%x, full = 0x%016llx\n", + panel->panel_name, + panel_ver & 0xff, (panel_ver & 0xff00) >> 8, + (panel_ver & 0xff0000) >> 16, + panel->panel_ver); + + of_node_put(np); + + return 0; +} + static int dsi_panel_parse_dfps_caps(struct dsi_panel *panel) { int rc = 0; @@ -3434,6 +3476,12 @@ struct dsi_panel *dsi_panel_get(struct device *parent, goto error; } + rc = dsi_panel_parse_panel_cfg(panel); + if (rc) { + pr_err("failed to parse panel config from dts. rc=%d\n", rc); + goto error; + } + rc = dsi_panel_parse_dfps_caps(panel); if (rc) DSI_ERR("failed to parse dfps configuration, rc=%d\n", rc); diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 85ddad49a71d..3f7593e0489c 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -28,6 +28,8 @@ #define DSI_MODE_MAX 32 +#define DSI_PANEL_MAX_PANEL_LEN 256 + /* * Defining custom dsi msg flag, * continued from drm_mipi_dsi.h @@ -227,6 +229,10 @@ struct dsi_panel { int panel_test_gpio; int power_mode; enum dsi_panel_physical_type panel_type; + + bool esd_utag_enable; + u64 panel_ver; + char panel_name[DSI_PANEL_MAX_PANEL_LEN]; }; static inline bool dsi_panel_ulps_feature_enabled(struct dsi_panel *panel)