dev: gcdb: add support to specify the DSI PLL from fastboot oem
For single/split DSI cases, depending on the DSI PHY version, there
is support to select DSI PLL0/PLL1 to drive the DSI controller/PHY.
Add support to specify this using fastboot oem command.
Example:
fastboot oem select-display-panel jdi_1080p_video:pll0
fastboot oem select-display-panel jdi_1080p_video:pll0:disable
fastboot oem select-display-panel jdi_1080p_video:pll1#sim-swte:disable
fastboot oem select-display-panel jdi_1080p_video:skip:pll1
Change-Id: Ie74710c3047ccca4addd9c00611682b726befb76
diff --git a/dev/gcdb/display/gcdb_display.c b/dev/gcdb/display/gcdb_display.c
index bfb1153..d4fe865 100644
--- a/dev/gcdb/display/gcdb_display.c
+++ b/dev/gcdb/display/gcdb_display.c
@@ -408,6 +408,45 @@
return panelstruct;
}
+static void mdss_dsi_set_pll_src(void)
+{
+ struct oem_panel_data *oem_data = mdss_dsi_get_oem_data_ptr();
+
+ if (panelstruct.paneldata->panel_operating_mode & USE_DSI1_PLL_FLAG)
+ oem_data->dsi_pll_src = DSI_PLL1;
+
+ if (strcmp(oem_data->sec_panel, "")) {
+ if (oem_data->dsi_pll_src != DSI_PLL_DEFAULT) {
+ dprintf(CRITICAL, "Dual DSI config detected!"
+ "Use default PLL\n");
+ oem_data->dsi_pll_src = DSI_PLL_DEFAULT;
+ }
+ } else if (panelstruct.paneldata->slave_panel_node_id) {
+ if((dsi_video_mode_phy_db.pll_type != DSI_PLL_TYPE_THULIUM)
+ && (oem_data->dsi_pll_src == DSI_PLL1)) {
+ dprintf(CRITICAL, "Split DSI on 28nm/20nm!"
+ "Use DSI PLL0\n");
+ oem_data->dsi_pll_src = DSI_PLL0;
+ }
+ } else {
+ if ((dsi_video_mode_phy_db.pll_type != DSI_PLL_TYPE_THULIUM)
+ && !strcmp(panelstruct.paneldata->panel_destination,
+ "DISPLAY_1") && (oem_data->dsi_pll_src == DSI_PLL1)) {
+ dprintf(CRITICAL, "Single DSI with DSI-0 on 28nm/20nm!"
+ "Use DSI PLL0\n");
+ oem_data->dsi_pll_src = DSI_PLL0;
+ }
+ }
+
+ if (oem_data->dsi_pll_src == DSI_PLL1)
+ panelstruct.paneldata->panel_operating_mode |=
+ USE_DSI1_PLL_FLAG;
+ else
+ panelstruct.paneldata->panel_operating_mode &=
+ ~USE_DSI1_PLL_FLAG;
+
+}
+
int gcdb_display_init(const char *panel_name, uint32_t rev, void *base)
{
int ret = NO_ERROR;
@@ -419,6 +458,7 @@
if (pan_type == PANEL_TYPE_DSI) {
target_dsi_phy_config(&dsi_video_mode_phy_db);
+ mdss_dsi_set_pll_src();
if (dsi_panel_init(&(panel.panel_info), &panelstruct)) {
dprintf(CRITICAL, "DSI panel init failed!\n");
ret = ERROR;
diff --git a/dev/gcdb/display/gcdb_display.h b/dev/gcdb/display/gcdb_display.h
index 0f38d5e..088aa05 100755
--- a/dev/gcdb/display/gcdb_display.h
+++ b/dev/gcdb/display/gcdb_display.h
@@ -64,6 +64,7 @@
struct msm_panel_info *pinfo, struct mdss_dsi_phy_ctrl *phy_db);
void set_panel_cmd_string(const char *panel_name);
struct oem_panel_data mdss_dsi_get_oem_data(void);
+struct oem_panel_data *mdss_dsi_get_oem_data_ptr(void);
struct panel_struct mdss_dsi_get_panel_data(void);
struct oem_panel_data {
@@ -73,6 +74,13 @@
bool skip;
uint32_t sim_mode;
char dsi_config[DSI_CFG_SIZE];
+ uint32_t dsi_pll_src;
+};
+
+enum {
+ DSI_PLL_DEFAULT,
+ DSI_PLL0,
+ DSI_PLL1,
};
#endif /*_GCDB_DISPLAY_H_ */
diff --git a/dev/gcdb/display/gcdb_display_param.c b/dev/gcdb/display/gcdb_display_param.c
index 328c442..ce98cf0 100644
--- a/dev/gcdb/display/gcdb_display_param.c
+++ b/dev/gcdb/display/gcdb_display_param.c
@@ -37,7 +37,7 @@
#include "target/display.h"
#include "fastboot_oem_display.h"
-struct oem_panel_data oem_data = {{'\0'}, {'\0'}, false, false, SIM_NONE, "single_dsi"};
+struct oem_panel_data oem_data = {{'\0'}, {'\0'}, false, false, SIM_NONE, "single_dsi", DSI_PLL_DEFAULT};
static int panel_name_to_dt_string(struct panel_lookup_list supp_panels[],
uint32_t supp_panels_size,
@@ -85,6 +85,11 @@
return oem_data;
}
+struct oem_panel_data *mdss_dsi_get_oem_data_ptr(void)
+{
+ return &oem_data;
+}
+
static char *get_panel_token_end(const char *string)
{
char *ch_hash = NULL, *ch_col = NULL;
@@ -190,6 +195,16 @@
ch = strstr((char *) panel_name, ":disable");
oem_data.cont_splash = ch ? false : true;
+ /* DSI PLL source */
+ ch = strstr((char *) panel_name, ":pll0");
+ if (ch) {
+ oem_data.dsi_pll_src = DSI_PLL0;
+ } else {
+ ch = strstr((char *) panel_name, ":pll1");
+ if (ch)
+ oem_data.dsi_pll_src = DSI_PLL1;
+ }
+
/* Simulator status */
oem_data.sim_mode = SIM_NONE;
if (strstr((char *) panel_name, "#sim-hwte"))
@@ -259,7 +274,7 @@
struct panel_struct panelstruct;
int panel_mode = SPLIT_DISPLAY_FLAG | DUAL_PIPE_FLAG | DST_SPLIT_FLAG;
int prefix_string_len = strlen(DISPLAY_CMDLINE_PREFIX);
- char *sctl_string;
+ char *sctl_string, *pll_src_string = NULL;
panelstruct = mdss_dsi_get_panel_data();
@@ -355,6 +370,22 @@
arg_size += strlen(sctl_string) + slave_panel_node_len;
+ if (oem_data.skip && !strcmp(oem_data.dsi_config, "dual_dsi") &&
+ (oem_data.dsi_pll_src != DSI_PLL_DEFAULT)) {
+ dprintf(CRITICAL, "Dual DSI config detected!"
+ " Use default PLL\n");
+ oem_data.dsi_pll_src = DSI_PLL_DEFAULT;
+ }
+
+ if (oem_data.dsi_pll_src != DSI_PLL_DEFAULT) {
+ if (oem_data.dsi_pll_src == DSI_PLL0)
+ pll_src_string = DSI_PLL0_STRING;
+ else
+ pll_src_string = DSI_PLL1_STRING;
+
+ arg_size += strlen(pll_src_string);
+ }
+
if (oem_data.sim_mode != SIM_NONE) {
sim_override_to_cmdline(lookup_sim,
ARRAY_SIZE(lookup_sim), oem_data.sim_mode,
@@ -404,6 +435,12 @@
pbuf += strlen(oem_data.dsi_config);
buf_size -= strlen(oem_data.dsi_config);
+ if (pll_src_string) {
+ strlcpy(pbuf, pll_src_string, buf_size);
+ pbuf += strlen(pll_src_string);
+ buf_size -= strlen(pll_src_string);
+ }
+
if (sim_mode_string) {
strlcpy(pbuf, LK_SIM_OVERRIDE, buf_size);
pbuf += LK_SIM_OVERRIDE_LEN;
diff --git a/dev/gcdb/display/include/display_resource.h b/dev/gcdb/display/include/display_resource.h
index d97c424..12437aa 100755
--- a/dev/gcdb/display/include/display_resource.h
+++ b/dev/gcdb/display/include/display_resource.h
@@ -53,6 +53,9 @@
#define DSI_CFG_STRING ":cfg:"
#define DSI_CFG_STRING_LEN 5
+#define DSI_PLL0_STRING ":pll0"
+#define DSI_PLL1_STRING ":pll1"
+
#define NO_PANEL_CONFIG "none"
#define SIM_VIDEO_PANEL "sim_video_panel"
#define SIM_DUALDSI_VIDEO_PANEL "sim_dualdsi_video_panel"