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: 2701eb2

Change-Id: Ibd1c9429854655ea7c80222ce64c3b86c6df2eda
Signed-off-by: Bang Nguyen <bangnguyen@motorola.com>
Reviewed-on: https://gerrit.mot.com/1697267
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Shuo Yan <shuoyan@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Bang Nguyen 2019-07-25 12:56:02 -05:00 • committed by tongkun1
commit 0223f45a59
3 changed files with 4795 additions and 0 deletions

View file

@ -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);

4743
msm/dsi/dsi_panel.c.orig Normal file

File diff suppressed because it is too large Load diff

View file

@ -37,6 +37,8 @@
#define MIPI_DSI_MSG_ASYNC_OVERRIDE BIT(4)
#define MIPI_DSI_MSG_CMD_DMA_SCHED BIT(5)
#define DSI_PANEL_MAX_PANEL_LEN 256
enum dsi_panel_rotation {
DSI_PANEL_ROTATE_NONE = 0,
DSI_PANEL_ROTATE_HV_FLIP,
@ -269,6 +271,9 @@ struct dsi_panel {
u32 tlmm_gpio_count;
struct dsi_panel_ops panel_ops;
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)