diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 3261ea91253f..96fbb6e1d525 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -36,6 +36,8 @@ #define DEFAULT_PANEL_PREFILL_LINES 25 #define HIGH_REFRESH_RATE_THRESHOLD_TIME_US 500 #define MIN_PREFILL_LINES 40 +#define DSI_PANEL_UNKNOWN_PANEL_NAME "unknown" +#define DSI_PANEL_PANEL_DEFAULT_VER 0xffffffffffffffff static void dsi_dce_prepare_pps_header(char *buf, u32 pps_delay_ms) { @@ -1425,6 +1427,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; @@ -3548,6 +3589,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.c.orig b/msm/dsi/dsi_panel.c.orig new file mode 100644 index 000000000000..0c3c292a35de --- /dev/null +++ b/msm/dsi/dsi_panel.c.orig @@ -0,0 +1,4743 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include