From c8f9e73f0ee72da4ee52034a1d1b5492f87a625e Mon Sep 17 00:00:00 2001 From: Christopher Braga Date: Fri, 5 Jun 2020 16:45:05 -0400 Subject: [PATCH] disp: msm: dsi: move demura panel ID fetching to DTSI Previous design had the demura panel ID passed in on the Linux kernel command line. Update the DSI driver to read this information from the DTSI instead. Change-Id: I7697bb34a313f1837b80ba5ff78e720e8131a819 Signed-off-by: Christopher Braga --- msm/dsi/dsi_display.c | 35 ++++++++++++++++++++++------------- msm/sde/sde_connector.c | 14 ++++++-------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 8d82e3b209..64b095b4f0 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -618,6 +618,24 @@ static bool dsi_display_validate_reg_read(struct dsi_panel *panel) return false; } +static void dsi_display_parse_demura_data(struct dsi_display *display) +{ + int rc = 0; + + display->panel_id = 0; + if (display->fw) { + DSI_INFO("FW definition unsupported for Demura panel data\n"); + return; + } + + rc = of_property_read_u64(display->pdev->dev.of_node, + "qcom,demura-panel-id", &display->panel_id); + if (rc) + DSI_INFO("No panel ID is present for this display\n"); + else + DSI_INFO("panel id found: %lx\n", display->panel_id); +} + static void dsi_display_parse_te_data(struct dsi_display *display) { struct platform_device *pdev; @@ -2510,7 +2528,6 @@ static void dsi_display_parse_cmdline_topology(struct dsi_display *display, char *sw_te = NULL; unsigned long cmdline_topology = NO_OVERRIDE; unsigned long cmdline_timing = NO_OVERRIDE; - unsigned long panel_id = NO_OVERRIDE; if (display_type >= MAX_DSI_ACTIVE_DISPLAY) { DSI_ERR("display_type=%d not supported\n", display_type); @@ -2526,17 +2543,6 @@ static void dsi_display_parse_cmdline_topology(struct dsi_display *display, if (sw_te) display->sw_te_using_wd = true; - str = strnstr(boot_str, ":panelid", strlen(boot_str)); - if (str) { - if (kstrtol(str + strlen(":panelid"), INT_BASE_10, - (unsigned long *)&panel_id)) { - DSI_INFO("panel id not found: %s\n", boot_str); - } else { - DSI_INFO("panel id found: %lx\n", panel_id); - display->panel_id = panel_id; - } - } - str = strnstr(boot_str, ":config", strlen(boot_str)); if (str) { if (sscanf(str, ":config%lu", &cmdline_topology) != 1) { @@ -4027,6 +4033,9 @@ static int dsi_display_parse_dt(struct dsi_display *display) break; } + /* Parse Demura data */ + dsi_display_parse_demura_data(display); + DSI_DEBUG("success\n"); error: return rc; @@ -8027,7 +8036,7 @@ static void dsi_display_panel_id_notification(struct dsi_display *display) display->ctrl[0].ctrl->panel_id_cb.event_cb( display->ctrl[0].ctrl->panel_id_cb.event_usr_ptr, display->ctrl[0].ctrl->panel_id_cb.event_idx, - 0, ((display->panel_id & 0xffffffff00000000) >> 31), + 0, ((display->panel_id & 0xffffffff00000000) >> 32), (display->panel_id & 0xffffffff), 0, 0); } } diff --git a/msm/sde/sde_connector.c b/msm/sde/sde_connector.c index f8cb79cc24..56d834fb2e 100644 --- a/msm/sde/sde_connector.c +++ b/msm/sde/sde_connector.c @@ -484,23 +484,21 @@ static int sde_connector_handle_panel_id(uint32_t event_idx, struct sde_connector *c_conn = usr; int i; u64 panel_id; - u8 arr[8], shift; - u64 mask = 0xff; + u8 msb_arr[8]; if (!c_conn) return -EINVAL; - panel_id = (((u64)data0) << 31) | data1; + panel_id = (((u64)data0) << 32) | data1; if (panel_id == ~0x0) return 0; - for (i = 0; i < 8; i++) { - shift = 8 * i; - arr[7 - i] = (u8)((panel_id & (mask << shift)) >> shift); - } + for (i = 0; i < 8; i++) + msb_arr[i] = (panel_id >> (8 * (7 - i))); + /* update the panel id */ msm_property_set_blob(&c_conn->property_info, - &c_conn->blob_panel_id, arr, sizeof(arr), + &c_conn->blob_panel_id, &msb_arr, sizeof(msb_arr), CONNECTOR_PROP_DEMURA_PANEL_ID); sde_connector_register_event(&c_conn->base, SDE_CONN_EVENT_PANEL_ID, NULL, c_conn);